SlowGuess/NeurIPS_2023_OCR huggingface dataset:
The interleaved encoding gate consists of 9 layers. Each layer has a rotational layer and a linear entanglement layer. On the rotational layer, each qubit has three rotational gates  $R_{X}, R_{Z}, R_{X}$  in a sequence. Therefore, each layer has 30 rotational angles, and the whole QML architecture has 270 rotational angles, i.e.,  $n_{\mathrm{params}} = 270$ . Since each input example  $x$  is 256-dimensional, we only use the first 256 rotational angles to encode the input data. The parameters  $\theta$  are also encoded in the rotational angles such that the angles are  $x + \theta$ .
Quantum measurements, as the last part of the quantum circuit, map the quantum output to the classical probability data. In each quantum measurement, each qubit is in the 0-state or the 1-state, and the probability for the qubit to be in the 0-state is between 0 and 1. We regard this probability as
Figure 8: Quantum machine learning architecture with interleaved encoding of 10-qubit quantum circuit for a binary classification task on MNIST.
the probability for the image to be a digit "1". We only use the probability on the 5th qubit  $(i = 5)$  as the output and compute the cross-entropy loss with the labels.
In the phase of training, all the training examples share the same  $\theta$  but have different  $x$ , and we optimize the final average loss with respect to  $\theta$  as
$$
\boldsymbol {\theta} ^ {*} = \underset {\boldsymbol {\theta}} {\arg \min } \frac {1}{n _ {\text {t r a i n}}} \sum_ {i = 1} ^ {n _ {\text {t r a i n}}} \mathcal {L} \left(\boldsymbol {x} _ {i} ^ {\text {t r a i n}}; \boldsymbol {\theta}\right), \tag {16}
$$
in the case of  $n_{\mathrm{train}}$  training examples. The combination  $\pmb{x}_i^{\mathrm{train}} + \pmb{\theta}$  is entered into the quantum circuit rotational angles, and we need to build  $n_{\mathrm{train}}$  separate quantum circuits (which can be built either sequentially or in parallel). The interleaved encoding gate as a whole can be viewed as a deep layer, and serve dual roles of encoding the classical data  $\pmb{x}$  and containing the machine learning parameters  $\pmb{\theta}$ . In the phase of inference, with the optimal parameter  $\pmb{\theta}^{*}$ , we feed each test example  $\pmb{x}_i^{\mathrm{test}}$  into the quantum circuit as a combination  $\pmb{x}_i^{\mathrm{test}} + \pmb{\theta}^{*}$  and measure the output probability to compute the test accuracy.
We use 500 training examples and 500 test examples. During training, we use the stochastic gradient descent optimizer with the batch size 50 and learning rate 0.05. The full QML training has  $T_{b,t} = 400$  iterations. We choose  $n_{\mathrm{sim}} = 10$ ,  $n_{\mathrm{DMD}} = 20$ , and  $n_{\mathrm{SW}} = 6$  for SW-DMD and MLP-SW-DMD.
In neural DMD including MLP-DMD, MLP-SW-DMD, CNN-DMD, we use layerwise partitioning that groups  $\theta$  by layers in the encoding gate. There are 9 groups with group size 30. We perform neural DMD for each group, so that the number of parameters in the neural networks for DMD is not too large. After predicting each group separately, we combine all groups of  $\theta$  to evaluate the loss and accuracy. In CNN-DMD for QML, we use 160k steps for sufficient CNN training. For the stability of CNN-DMD in presence of the layerwise partitioning, we choose  $n_{\mathrm{SW}} = 1$  for CNN-DMD.
E.2 Wallclock Time in Classical Simulations
We define the wallclock time as the time of DMD learning plus the time of quantum optimization. The DMD learning on classical computers is indeed very efficient (for each piece, only milliseconds for DMD and SW-DMD, and less than 1 minute for neural DMD), and thus it is not the bottleneck. The main bottleneck is the time of quantum optimization, and our QuACK is designed to speed up this. In our work, the quantum optimization is simulated by classical computers. The simulations on a classical computer (a single CPU) take the time at orders from minutes to an hour depending on the details of the task and hyperparameters. As a representative example, for the 12-qubit Ising model with Adam in Figure 3b of Sec. 6.5, the time costs of simulations (with the parameter-shift gradient updates explicitly to mimic the actual quantum optimization) are listed in Table 2. Thanks to the acceleration by our QuACK, we can see the benefit of having less wallclock time by our various DMD methods compared to the baseline VQE. We note that these wallclock times are for classical simulations of quantum optimization. For actual quantum optimization, it is expected that
Method	Wallclock time (seconds)
VQE (baseline)	2866
DMD (ours)	646
SW-DMD (ours)	663
MLP-DMD (ours)	818
SW-MLP-DMD (ours)	849
CNN-DMD (ours)	828
our approach can gain much more benefit, since the dominant cost is from each gradient step of quantum optimization. The wallclock time saved on an actual quantum computer will be proportional to the speedup factor multiplying the actual time of each iteration in quantum optimization. This will help us to save more resources since the actual quantum optimization time is more expensive than the classical simulations of the quantum optimization.
E.3 Speedup in Sec. 6.5
Table 2: Wallclock time costs of simulations with the parameter-shift rule explicitly implemented on a classical computer with a single CPU. Our various QuACK methods are faster than the baseline because they use fewer gradient steps.
Task	Speedup
DMD	SW-DMD	MLP-DMD	MLP-SW-DMD	CNN-DMD
12-qubit Ising	3.43x	4.63x	2.04x	3.43x	2.32x
10-qubit LiH	2.31x	3.24x	1.82x	2.42x	1.16x
10-qubit QML	3.76x	4.38x	1.86x	4.11x	3.46x
Table 3: Speedup ratios for all DMD methods for various tasks under the condition of non-smooth optimization.
The speedup ratios in Sec. 6.5 for non-smooth optimization by QuACK from our QuACK with all the DMD methods are given in Table 3.
E.4 Dynamics Prediction in the Quantum Natural Gradient, Overparameterization, and Smooth Optimizatoin Regimes
We show the dynamics prediction of the DMD prediction in our QuACK framework compared with the intrinsic dynamics of the baseline VQE in the cases of the quantum natural gradient, overparameterization, and smooth optimization regimes, as a supplement of the discussion in Sec. 6.2, 6.3, 6.4.
Quantum natural gradient. As a supplement of Sec. 6.2, in Figure 9, we show the prediction matching of the 10-qubit quantum Ising model (RealAmplitidues ansatz with  $\mathrm{refs} = 1$ ) with transverse field  $h = 0.5$  using the quantum natural gradient with learning rate 0.01. The prediction from all the DMD methods in our QuACK framework is accurate, as they almost overlap with the intrinsic dynamics of energy from the baseline VQE ( $T_{b,t} = 150$ ). We use  $n_{\mathrm{sim}} = 10$ ,  $n_{\mathrm{DMD}} = 20$  with  $n_{\mathrm{iter}} = 5$ . We choose  $n_{\mathrm{SW}} = 6$  for SW-DMD, MLP-SW-DMD, and CNN-DMD. For the neural DMD, to achieve good performance, we use 160k training steps for MLP-DMD, and 80k training steps for MLP-SW-DMD and CNN-DMD.
Overparameterization Regime. In Figure 10, we present examples used in Sec. 6.3. The DMD prediction prediction matches the intrinsic dynamics of VQE, with short training  $(n_{\mathrm{sim}} = 4)$  and long prediction  $(n_{\mathrm{DMD}} = 1000)$ . Therefore, a great effect of  $>200\mathrm{x}$  speedup can be achieved.
Smooth Optimization Regimes. In the smooth optimization regimes we consider, the optimization dynamics is not as linear as the cases of the quantum natural gradient and overparameterization. In
Figure 9: Quantum natural gradient for VQE of 10-qubit quantum Ising model. All the DMD methods using our QuACK framework provide accurate prediction for the intrinsic dynamics of energy of the VQE. For the various DMD methods, solid parts are VQE runs, and the dashed parts are DMD predictions.
(a)  $N = 2$ $n_{\mathrm{params}} = 1000$
(c)  $N = 4$ ,  $n_{\mathrm{params}} = 2000$
Figure 10: Prediction from DMD in our QuACK framework matches the intrinsic dynamics of energy in the overparameterization regime for VQE of the  $N$ -qubit quantum Ising model.
(b)  $N = 3$ ,  $n_{\mathrm{params}} = 1500$
(d)  $N = 5$ ,  $n_{\mathrm{params}} = 2500$
(a)  $N = 2$ ,  $n_{\mathrm{params}} = 4$
(b)  $N = 3$ ,  $n_{\mathrm{params}} = 6$
(c)  $N = 4$ $n_{\mathrm{params}} = 8$
(d)  $N = 5$ ,  $n_{\mathrm{params}} = 10$
(e)  $N = 6$ ,  $n_{\mathrm{params}} = 12$
(g)  $N = 8$ ,  $n_{\mathrm{params}} = 16$
(f)  $N = 7$ ,  $n_{\mathrm{params}} = 14$
(i)  $N = 10$ ,  $n_{\mathrm{params}} = 20$
(j)  $N = 11$ $n_{\mathrm{params}} = 22$
Figure 11: Prediction from DMD in our QuACK framework compared to the intrinsic dynamics of energy in the smooth optimization regime for VQE of the  $N$ -qubit quantum Ising model with  $n_{\mathrm{params}} = 2N$ .
(h)  $N = 9$ ,  $n_{\mathrm{params}} = 18$
(k)  $N = 12$ ,  $n_{\mathrm{params}} = 24$
addition, the dynamics from the Adam optimizer tends to be more complicated than the quantum natural gradient optimizer and the gradient descent. The above factors make challenges for the DMD prediction. In Figure 11, we present examples used in Sec. 6.4. The DMD prediction, with short training  $(n_{\mathrm{sim}} = 3)$  and long prediction  $(n_{\mathrm{DMD}} = 60)$ , still captures the trend of decrease of the loss (energy) and has a good alignment in most cases. In some cases when the loss is almost already converged at a late optimization time with steps  $\gtrsim 500$ , the rate of change of  $\theta$  is slow so that the DMD might overfit the flat dynamics and have divergence in its prediction. However, this is not a problem for the practical thanks to the robustness of the alternating controlled scheme in our QuACK, manifestly explained in the example of Figure 6b. Therefore, a great acceleration with  $>10x$  speedup can still be achieved. We also comment that intriguingly, in some examples of Figure 11, e.g., 11b, the loss from DMD in our QuACK might decrease faster than baseline VQE, which could lead to  $a > 1$  and a higher speedup, as we have mentioned in Sec. 5.2.
E.5 Experiments with Noise
In Sec. 6.6 and this section, we use the RealAmplitudes ansatz with  $\mathrm{refs} = 1$  ( $n_{\mathrm{params}} = 2N$ ). The task is VQE of the quantum Ising model with  $h = 0.5$  initialized at a random initialization (with a fixed random seed for comparing different cases with the same  $N$ ). The optimizer is Adam with the
(a) 10-qubit shot noise,  $n_{\mathrm{shots}} = 100$ .
(b) 10-qubit shot noise,  $n_{\mathrm{shots}} = 1.000$ .
(c) 10-qubit shot noise,  $n_{\mathrm{shots}} = 10,000$ .
(d) 5-qubit shot noise,  $n_{\mathrm{shots}} = 100$ .
(e) 5-qubit shot noise,  $n_{\mathrm{shots}} = 1,000$ .
(f) 5-qubit shot noise,  $n_{\mathrm{shots}} = 10,000$ .
(g) 5-qubit FakeLima,  $n_{\mathrm{shots}} = 100$ .
(h) 5-qubit FakeLima,  $n_{\mathrm{shots}} = 1,000$ .
(i) 5-qubit FakeLima,  $n_{\mathrm{shots}} = 10,000$
(j) 5-qubit FakeManila,  $n_{\mathrm{shots}} = 100$ .
(k) 5-qubit FakeManila,  $n_{\mathrm{shots}} = 1.000$ .
(1) 5-qubit FakeManila,  $n_{\mathrm{shots}} = 10,000$ .
Figure 12: Experiments with different noise systems at  $n_{\mathrm{shots}} = 100, 1000, 10000$ . Optimization histories for energy of full VQE and various DMD methods with our QuACK are shown. Dashed lines indicate that the DMD methods are used to accelerate the optimization. The error bands are the statistical uncertainty of from finite- $n_{\mathrm{shots}}$  quantum measurements.
learning rate 0.01. We have also applied measurement error mitigation [5] to reduce the effect of quantum noise.
In Figure 12 with statistical error from shots plotted as error bands, we show the experiments with the acceleration effects by our QuACK framework using all the DMD methods with different noise systems (10-qubit and 5-qubit shots noise, FakeLima, and FakeManila) at  $n_{\mathrm{shots}} = 100$ , 1000, 10000. The full baseline VQE has  $T_{b,t} = 200$  iterations. We choose  $n_{\mathrm{sim}} = 10$  and  $n_{\mathrm{DMD}} = 20$ . SW-DMD, MLP-SW-DMD, and CNN-DMD use window size  $n_{\mathrm{SW}} = 6$ . The acceleration effects with numerical speedups are given in Table 1 of main text. There are more fluctuations in the small  $n_{\mathrm{shots}}$  cases, but our QuACK is still able to accelerate the VQE.
The spikes in the DMD results occur every  $n_{\mathrm{sim}} = 10$  iterations at the beginning of every piece of VQE, and are more distinct when  $n_{\mathrm{shots}}$  is smaller. This may be because it is harder to make
predictions of the VQE history when the parameter updates time series from measurement is more noisy. Despite the occasional spikes in energy, our QuACK with all the DMD methods still helps to get closer to the better parameters for optimization in later steps.
Figure 13: Ablations of  $n_{\mathrm{sim}}$  on the 12-qubit Ising model with Adam for all DMD methods.
Figure 14: Ablations of  $n_{\mathrm{DMD}}$  on the 12-qubit Ising model with Adam for all DMD methods.
E.6 Ablation Study for  $n_{\mathrm{sim}}$  and  $n_{\mathrm{DMD}}$
In Figures 13 and 14, we show the ablation study of  $n_{\mathrm{sim}}$  and  $n_{\mathrm{DMD}}$  of all the DMD methods with our QuACK framework. The experimental setup is the same as the experiment in Sec. 6.5, 12-qubit Ising model with Adam (including having the same initial point), except for varying  $n_{\mathrm{sim}}$ . (For CNN-DMD, we increase  $n_{\mathrm{iter}}$  from 12 to 20 to ensure convergence.) With  $n_{\mathrm{sim}} \in [4,10]$  in Figure 13 and  $n_{\mathrm{DMD}} \in [8,100]$  in Figure 14, all the DMD methods have acceleration effects ( $>1x$  speedup), which shows that our QuACK is robust in a range of  $n_{\mathrm{sim}}$ . In Sec. 6.5 for the quantum Ising model, we have used  $n_{\mathrm{sim}} = 5$  and  $n_{\mathrm{DMD}} = 40$ . The choice of  $n_{\mathrm{sim}}$  and  $n_{\mathrm{DMD}}$  will affect the speedup, and understanding the behavior from varying  $n_{\mathrm{sim}}$  and  $n_{\mathrm{DMD}}$  needs future study.
E.7 Experiments on the Real IBM Quantum Computer Lima
In the current era, the practical cost of using the real quantum resources is still very high (both in waiting time and actual expense), which makes implementing gradient-based optimizers on real quantum hardware an expensive task. However, we still try our best to perform an experiment on real IBM quantum computer Lima and demonstrate how our QuACK can accelerate optimization in complicated settings.
Given our limited access to real quantum hardware, gradient-based optimization with quantum computer is too costly and time consuming. We use the gradient-free optimizer SPSA as an alternative, which updates the parameters by random perturbation. Before we dive in the data, We would like to point out that the gradient-free optimizer is very different from gradient-based optimizer and our main theoretical advantages in this work are for gradient-based quantum optimization. In addition, we find that the real quantum hardware is also subject to fluctuation of day-to-day calibration which could affect the performance of our approach (it can be removed if one has direct timely access to
the quantum computer). Hence, the results in this section should not be directly compared to the experiments in our main text.
(a) FakeLima with SPSA.
(b) Real Lima with SPSA.
Figure 15: For the 5-qubit quantum Ising model at  $h = 0.5$ , SPSA on (a) FakeLima and (b) the real quantum computer IBM Lima with  $n_{\mathrm{shots}} = 10,000$ . Optimization histories for energy of full VQE, SW-DMD, and MLP-SW-DMD are shown. Dashed lines indicate that the DMD methods are used to accelerate the optimization. The error bands are the statistical uncertainty of from finite- $n_{\mathrm{shots}}$  quantum measurements.
We use  $n_{\mathrm{shots}} = 10,000$  for the 5-qubit Ising model at  $h = 0.5$  on both FakeLima and real Lima. For our QuACK, we use SW-DMD and MLP-SW-DMD with  $n_{\mathrm{SW}} = 15$ ,  $n_{\mathrm{sim}} = 20$ ,  $n_{\mathrm{DMD}} = 20$  due to our limited access to the real quantum hardware. We show the results in Figure 15b. Moreover, both the baseline VQE and our QuACK have more fluctuation on real Lima than FakeLima, which can be due to experimental instability in the real lab apparatus, such as day-to-day calibration. However, applying QuACK to this real physical case still help accelerate VQE, as SW-DMD and MLP-SW-DMD partly predict the dynamics and decrease the loss faster than the baseline. This is a positive message as our approach can also be helpful for gradient-free optimization which our theorems are not designed for. Meanwhile, we would like to point out this is not the main focus of this paper because the gradient-based quantum optimization has been shown to have convergence guarantee and better than gradient-free methods [37, 44, 87, 38]. In the coming few years when the quantum hardware become more suitable for gradient-based optimization, our QuACK will demonstrate more advantage for practical applications.
F Additional Information
F.1 Ethics Statement
This work introduces the Quantum-circuit Alternating Controlled Koopman learning (QuACK), a novel algorithm enhancing the efficiency of quantum optimization and machine learning. As a significant advancement in quantum computing, QuACK promises benefits across numerous scientific and technological applications. However, the potential misuse of such technology, particularly in areas like quantum chemistry, could lead to unintended consequences. For example, the increased efficiency in quantum chemistry simulations could inadvertently facilitate the development of chemical weapons if used irresponsibly.
F.2 Compute
All of our experiments for classically simulating quantum computation are performed on a single CPU. These include all the experiments presented in the main text and the Appendix, except for the experiment run on the IBM quantum computer ibmq_lima, which is one of the IBM Quantum Falcon Processors. The views expressed are those of the authors, and do not reflect the official policy or position of IBM or the IBM Quantum team.
F.3 Reproducibility
We have stated all of our hyperparameter choices for the experimental settings in the main text and in the appendix. We perform simulations of VQE using Qiskit [2], a python framework for quantum computation, and Yao [47], a framework for quantum algorithms in Julia [7]. Our neural network code is based on Qiskit and Pytorch [57]. Our implementation of quantum machine learning is based on Julia Yao. We use the quantum chemistry module from Pennylane [6] to obtain the Hamiltonian of the molecule. Our code is available at https://github.com/qkoopman/QuACK.
F.4 Broader Impact
The development and implementation of the our QuACK framework could be impactful to the broader scientific and technological community. This approach to quantum optimization can drastically accelerate a multitude of computations in quantum chemistry, quantum condensed matter, and quantum machine learning, which can lead to groundbreaking advancements in these fields.
For instance, in quantum chemistry, the rapid optimization enabled by QuACK could expedite the design of new molecules and materials, potentially leading to the creation of novel drugs, eco-friendly fuels, and advanced materials with superior properties. In quantum condensed matter, faster computations could expedite our understanding of complex quantum systems, possibly catalyzing new insights in physics and material science.
In the realm of quantum machine learning, this acceleration could potentially revolutionize our ability to deal with large datasets and complex models, ultimately leading to more accurate and efficient machine learning algorithms. This, in turn, could benefit a broad range of sectors, from healthcare, where it could be used to better diagnose and treat diseases, to finance, where it could be used to model and predict market trends.
Moreover, the increased speed of quantum optimization could result in energy savings and reduced computing time, contributing to a more sustainable and efficient use of computational resources.