SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Our main contribution in this more general quantum data setting with multi-copy access, is the establishment of a connection between gradient estimation and shadow tomography. This gives an exponential improvement to the sample complexity of the input state from  $\tilde{O}(M)$  to  $O(\mathrm{polylog}(M))$  for computing gradients. It also gives a quadratic improvement in the number of quantum operations from  $\tilde{O}(M^2)$  to  $\tilde{O}(M)$ , analogous to classical backpropagation. The algorithm is depicted diagrammatically in Figure 1. Our proposal, however, houses a large caveat: it requires the classical storage and manipulation of a hypothesis state, which results in an exponential classical overhead, unless an approximation scheme can be effectively applied. It is argued in Aaronson [2019] that this cost is unavoidable in general, since removing it would imply that quantum advice can always be simulated by classical advice. Nevertheless, the exponential saving in sample complexity could be important in settings where the labelled quantum states coming from Nature are limited, and valuable. In Huang et al. [2022] for example, there were sources of quantum data that, when limited in quantity, could achieve a substantial data advantage over classical learners - even in the range of 20-40 qubits. In this size range, keeping the classical model in full detail would be completely feasible without ruining the potential for quantum advantage. Further, the linear scaling of quantum operations, even in the face of exponential classical overhead, could be beneficial if classical computation is extremely cheap when compared to quantum computation.
Our protocol will apply to an even more general model than Equation (3), which we term a quantum neural network.
Definition 8 (Quantum neural network). Let a quantum neural network be a variational quantum circuit on  $n + 1$  qubits, numbered  $0, 1, \ldots, n$ . Qubits  $1, \ldots, n$  act as the data register, which will take as input an unknown quantum state  $|\varphi \rangle$  to be classified. Qubit  $0$  acts as the output register, which is measured in the  $Z$ -basis and initialized to  $|0\rangle$ . The variational circuit belongs to the following simple class
$$
\mathcal {U} (\vec {\theta}) = e ^ {i \theta_ {M} P _ {M}} U _ {M} \dots e ^ {i \theta_ {1} P _ {1}} U _ {1},
$$
where  $\{P_k\}$  are fixed  $(n + 1)$ -qubit Pauli operators and  $\{U_k\}$  are fixed circuits. The output prediction on  $|\varphi\rangle$  is then given by a quantum neural network function defined as
$$
\mathrm {Q N N} _ {\vec {\theta}} (| \varphi \rangle) = \langle 0 | \langle \varphi | \mathcal {U} ^ {\dagger} (\vec {\theta}) Z _ {0} \mathcal {U} (\vec {\theta}) | 0 \rangle | \varphi \rangle \in [ - 1, 1 ]. \tag {8}
$$
Note that running the circuit on  $|0\rangle |\varphi \rangle$  gives a coin flip  $\mathrm{Ber}(\frac{1}{2} +\frac{1}{2}\mathrm{QNN}_{\vec{\theta}}(|\varphi \rangle))$  rather than  $\mathrm{QNN}_{\vec{\theta}}(|\varphi \rangle)$  itself. This allows us to estimate  $\mathrm{QNN}_{\vec{\theta}}(|\varphi \rangle)$  to  $\varepsilon$  precision with high probability by running the circuit poly  $(\varepsilon^{-1})$  times, as usual. Furthermore, note the sequential nature of the function's gradients, highlighted in a similar sense in Equation (4). This leads us to the following theorem.
Theorem 9 (Quantum-efficient backpropagation). Given an unknown  $n$  qubit input state  $|\varphi \rangle$ , there exists an explicit algorithm which produces estimates  $b_{k}$  for all  $k = 1, \dots, M$  such that  $|b_{k} - \frac{1}{2}\partial_{\theta_{k}}QNN_{\vec{\theta}}(|\varphi \rangle)| \leq \varepsilon$  using only
$$
m = O \left(\frac {n \log^ {2} M}{\varepsilon^ {4}}\right),
$$
copies of  $|\varphi \rangle$ . The required number of quantum operations for the proposed algorithm is  $\tilde{O}(mM)$ , which is quasi-linear in  $M$ . However, classical storage of a hypothesis state is used and incurs a classical cost of  $M \cdot 2^{\tilde{O}(n)}$  when no effective approximation schemes are known.
The full details of the proof and the explicit quantum backpropagation algorithm are given in Appendix D. We first show that estimating the gradient component  $\partial_{\theta_k}\mathrm{QNN}_{\vec{\theta}}(|\varphi\rangle)$  reduces to estimating the expectation value of a certain traceless Hermitian unitary operator on  $|+\rangle |0\rangle |\varphi\rangle$ . Shadow tomography results then imply that estimating all gradient components to precision  $\varepsilon$  is possible using only  $\mathrm{poly}(\log M,n,\varepsilon^{-1})$  copies of  $|\varphi\rangle$ . In order to fully specify the algorithm, we adapt an improved shadow tomography protocol from Bădescu and O'Donnell [2021] that makes use of gentle measurements and is online. The key difference in our proposal, which enables us to achieve linear scaling in  $M$ , is the reuse of quantum computation in a way reminiscent of backpropagation through observation that one can rotate through the layers of the quantum neural network sequentially and estimate the appropriate expectation value between each rotation step, as shown in Figure 1. Naive implementation of the shadow tomography protocol for gradients would yield  $\tilde{O}(M^2)$  quantum operations, in line with most existing methods for quantum gradient estimation.
5.2 Reduction from shadow tomography
We now show that a fully efficient algorithm for computing gradients would give rise to a fully efficient shadow tomography procedure for observables which can be efficiently implemented. This very general class of observables, however, is not known to have a computationally efficient shadow tomography protocol. Thus, this connection presents yet another obstacle to improving the exponential classical run time of our quantum backpropagation algorithm since removing the  $\exp (n)$  classical run time overhead in general, necessitates a breakthrough in shadow tomography.
Definition 10 (Shadow tomography problem). Let  $\mathcal{E}$  be a class of two-outcome measurements with outcomes in  $\{\pm 1\}$ . Given an unknown  $n$ -qubit quantum state  $|\psi\rangle$ , and known measurements  $E_1, \ldots, E_M \in \mathcal{E}$ , output estimates  $b_1, \ldots, b_M \in [-1,1]$  such that  $|b_k - \langle \psi |E_k|\psi \rangle| \leq \varepsilon \forall k$ . In particular, do this via a measurement of  $|\psi\rangle^{\otimes m}$  where  $m$  is as small as possible.
Definition 11 (Poly-time observables). A poly-time observable on  $n$  qubits is defined to be an observable of the form  $U^{\dagger}Z_{1}U$  where  $U$  is a poly-size circuit.
The shadow tomography problem is well-studied in quantum information theory. There are indeed special cases where this problem may produce a favourable scaling in  $M$  and  $n$ , as outlined in Proposition 7. But, in general, it is not trivial to remove the exponential classical cost when it comes to shadow tomography.
Theorem 12 (Shadow tomography reduction). Suppose there is an algorithm which can estimate the gradients  $\partial_{\theta_k}QNN_{\overline{\theta}}(|\psi \rangle)$ ,  $k = 1,\dots ,M$ , to precision  $\varepsilon$ , with  $m$  copies of  $|\psi \rangle$ , and with runtime  $T$ . Then, this gives an algorithm for shadow tomography of poly-time observables, to precision  $\frac{\varepsilon}{2}$ , with  $m$  copies of  $|\psi \rangle$  and runtime  $T$ .
Proof. Consider an instance of shadow tomography on  $n$  qubits, with  $E_1, \ldots, E_M$  given by  $E_k = U_k^\dagger Z_1 U_k$ , where  $\{U_k\}$  are poly-size circuits. Construct the quantum neural network with the following
variational circuit
$$
\begin{array}{l} \mathcal {U} (\vec {\theta}) | 0 \rangle | \psi \rangle = e ^ {i \theta_ {M} Y _ {0} \otimes Z _ {1}} \hat {U} _ {M} \dots e ^ {i \theta_ {1} Y _ {0} \otimes Z _ {1}} \hat {U} _ {1} H _ {0} | 0 \rangle | \psi \rangle \\ = e ^ {i \theta_ {M} Y _ {0} \otimes Z _ {1}} \hat {U} _ {M} \dots e ^ {i \theta_ {1} Y _ {0} \otimes Z _ {1}} \hat {U} _ {1} | + \rangle | \psi \rangle \\ \end{array}
$$
$$
\hat {U} _ {1} = \mathbb {1} _ {0} \otimes U _ {1}
$$
$$
\hat {U} _ {k} = \mathbb {1} _ {0} \otimes U _ {k} U _ {k - 1} ^ {\dagger}, \quad 1 <   k \leq M
$$
Then, by Equation (7), the gradients at  $\vec{\theta} = \vec{0}$  are
$$
\begin{array}{l} \partial_ {\theta_ {k}} \mathrm {Q N N} _ {\vec {\theta}} (| \psi \rangle) | _ {\vec {\theta} = \vec {0}} = 2 \operatorname {R e} \langle 0 | \langle \psi | \mathcal {U} ^ {\dagger} (\vec {0}) Z _ {0} \partial_ {\theta_ {k}} \mathcal {U} (\vec {0}) | 0 \rangle | \psi \rangle \\ = 2 \operatorname {R e} \langle + | \langle \psi | \hat {U} _ {1} ^ {\dagger} \dots \hat {U} _ {M} ^ {\dagger} Z _ {0} \hat {U} _ {M} \dots \hat {U} _ {k + 1} (i Y _ {0} \otimes Z _ {1}) \hat {U} _ {k} \dots \hat {U} _ {1} | + \rangle | \psi \rangle \\ = 2 \operatorname {R e} \langle + | \langle \psi | \hat {U} _ {1} ^ {\dagger} \dots \hat {U} _ {k} ^ {\dagger} (i Z _ {0} (Y _ {0} \otimes Z _ {1})) \hat {U} _ {k} \dots \hat {U} _ {1} | + \rangle | \psi \rangle \\ = 2 \langle + | \langle \psi | (\mathbb {1} _ {0} \otimes U _ {k} ^ {\dagger}) (X _ {0} \otimes Z _ {1}) (\mathbb {1} _ {0} \otimes U _ {k}) | + \rangle | \psi \rangle \\ = 2 \langle + | \langle \psi | (X _ {0} \otimes E _ {k}) | + \rangle | \psi \rangle \\ = 2 \langle \psi | E _ {k} | \psi \rangle \\ \end{array}
$$
Thus computing the gradients allows us to solve the shadow tomography instance.
Seeing as there is no known classically efficient procedure for shadow tomography with respect to poly-time observables, this reduction illustrates the difficulty of replicating true backpropagation scaling in general.
5.3 A fully gentle gradient strategy
Shadow tomography makes use of multiple copies and a hypothesis state model, often stored classically, to require a minimal number of destructive measurements. It is useful to examine the limits of gentle measurement alone for gradient estimation in order to reduce the classical overhead. In particular, it would be ideal if it were possible to use a small number of copies (e.g.  $\mathrm{polylog}(1 / \alpha)$ ) of a quantum state to achieve  $\alpha$ -gentleness in the general case through a simple, direct measurement scheme. While we do not explicitly construct a protocol here, this capability would naturally lead to a scheme for gradient estimation that achieves backpropagation scaling. This capability, however, would also allow us to violate known query lower bounds for the unstructured search problem. Thus, for our gradient purposes, it seems as if successful schemes must limit the number of potentially destructive accesses to a quantum state via the use of a classical model. We formalize the general failure of gentle measurement alone in the following theorem.
Theorem 13 (Repeated gentle measurements). Assume it is possible to perform an arbitrary two-outcome measurement gently by using up to a polylogarithmic number of copies of the state. Specifically, assume that any measurement can be made  $\alpha$ -gentle by using  $O(\mathrm{polylog}(1 / \alpha))$  copies of the state. Such an ability leads to a violation of known query bounds given by Grover's search algorithm, and thus, cannot be possible in general.
Proof. The proof is adapted from results in Aaronson et al. [2016]. Consider the  $n$ -qubit Grover state after  $i$  iterations with an ancilla present to mark the state  $|x\rangle$ ,
$$
\sin ((2 i + 1) \theta) | x \rangle | 1 \rangle + \cos ((2 i + 1) \theta) \sum_ {y \in \{0, 1 \} ^ {n}} \frac {1}{\sqrt {M - 1}} | y \rangle | 0 \rangle , \tag {9}
$$
where  $\theta = \arcsin 2^{-\frac{M}{2}}$ . For each of the  $M = 2^n$  possible marked elements  $x$ , one can define a two-element POVM of the form  $\{|x\rangle |1\rangle \langle x|\langle 1|$ ,  $I - |x\rangle |1\rangle \langle x|\langle 1|$ . One may ensure that the marked bit string is found with high probability by performing a measurement of each of these POVMs with respect to the Grover state  $\tilde{O}(2^n)$  times, even in the case where the state is constructed with a single Grover oracle query. Performing this procedure using standard, destructive, measurements of the POVMs would require a fresh set of oracle queries with each round. However, using sufficiently gentle measurements removes this requirement. If the distance between the pre- and post-measurement
states is sufficiently small, one obtains results that are close to those that one would obtain from a fresh copy of the state. In order to guarantee that the marked bit string can be extracted with high probability, we demand that the state obtained after any number of measurement rounds be within  $\frac{2^{-n}}{3}$  in the trace distance of the state prior to any measurements<sup>1</sup>. To guarantee that the state be sufficiently unchanged by the end of the series of  $\tilde{O}(2^{2n})$  measurements, each measurement should therefore be  $\tilde{O}(2^{-3n})$ -gentle. By assumption, this is possible with polylog $(2^{3n})$ , or simply poly $(n)$ , copies of the original state, each of which is prepared using the Grover oracle a set number of times. By performing the whole sequence of measurements gently, one can avoid biasing the result too much before the marked state is found. Hence, one can identify  $x$  with high probability, using  $\mathrm{poly}(n) \ll 2^{n/2}$  Grover oracle calls, which is a violation of known lower bounds [Grover, 1996]. In Appendix E.4, we discuss how sufficiently gentle measurements lead to a violation of known bounds when considering a different notion of time complexity that combines measurements and oracle queries.
Remark 14 (Shadow tomography does not violate known bounds). After seeing this result, one might question how this relates to shadow tomography schemes that use gentle measurement plus classical computation. It is consistent when one considers that  $\alpha$ -gentleness considered in isolation must apply to both the number of distinct measurements one may perform and the precision to which one performs a particular repeated measurement. That is, from the point of view of gentle measurement alone, gentleness on different measurements and gentleness on repeated measurement to high precision  $\varepsilon$ , are on the same footing and hence, must respect known bounds for information extraction. Indeed, all known shadow tomography schemes are consistent with a number of copies of the state scaling polynomially with  $1 / \varepsilon$ , despite scaling logarithmically in the number of distinct measurements, which prevents the above violation of known Grover query and time complexity bounds. This reflects an asymmetry between the number of distinct measurements and the precision of a single measurement present in all shadow tomography schemes and noted in the original work on the topic [Aaronson, 2019] that hypothesized that there are fewer independent observables within a quantum state than one might expect intuitively. The success of shadow tomography schemes, as distinct from simple gentle measurement, depends crucially on the existence of models that update quickly enough to limit the number of measurements made to the actual quantum states.
5.4 Approximate schemes
The failure of a fully gentle approach points to the necessity of a classical model to enable backpropagation scaling. But, the key challenge in the general application of the proposed shadow tomography algorithm is the use of an explicit classical representation of the quantum state, which in general, scales exponentially with system size. While there have been a few special cases found that have fully efficient schemes, like with Pauli operators [Huang et al., 2021], the case of whether there exists an efficient computational scheme for poly-time observables remains open. However, an exact scheme may not be required in practice, especially when dealing with noisy data. This raises the possibility of using approximate classical representations of the state. For example, it is known that in cases where states exhibit low entanglement, they may be efficiently represented by matrix product or tensor network states [White, 1992, Perez-Garcia et al., 2006, Cramer et al., 2010, Evenbly and Vidal, 2015, Orus, 2019]. Moreover, in the case of shadow tomography, one is not explicitly seeking an exact representation of the density matrix, but rather a proxy, capable of reproducing the desired observables with high probability. This relaxation of requirements may render an approximation scheme effective, even when the true state is challenging to represent with a particular ansatz. This area represents an interesting and potentially fruitful research direction that could dramatically increase the efficiency of training in quantum machine learning models, and we leave it open for future work.
Special cases aside, the inadequacy of current gradient methods to provide backpropagation scaling in parameterized quantum models leaves room for many questions. One particular conclusive direction
This choice of distance guarantees that, even in the presence of damage, the POVM used to identify the actual marked element will correctly return a positive result with probability at least  $\frac{2}{3} 2^{-n}$ . Likewise, any POVM corresponding to an unmarked element will incorrectly return a positive result with probability at most  $\frac{1}{3} 2^{-n}$ .
would be developing a concrete computational argument to rule out backpropagation scaling in the multi-copy setting, thereby confirming the true computational complexity of shadow tomography. Even though the proposed information-efficient scheme in this study fails to satisfy classical cost requirements of backpropagation, the possibility of a computationally efficient procedure remains open, especially for cases with known, structured observables. Similarly, failure in the general case of gentle measurements again suggests potential approximate or restricted models that may be more trainable. One may find an alternative architecture where gradient computation has favorable scaling, and even though the model is perhaps not as powerful or universal, it may still be useful in practice. Interestingly, closely related probabilistic classical analogues to variational models can exhibit backpropagation scaling. If the difficulty to achieve an efficient scaling is due to inherently quantum properties, perhaps backpropagation is not the correct method for optimization of quantum models, which seems to be a growing belief for classical models too, albeit for completely different reasons [Hinton, 2022]. We hope that these results spark the development of either alternative quantum models that can train at scale or new methods for efficient optimization.
Scott Aaronson. Shadow tomography of quantum states. SIAM Journal on Computing, 49(5): STOC18-368, 2019.
Scott Aaronson and Guy N Rothblum. Gentle measurement of quantum states and differential privacy. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pages 322-333, 2019.
Scott Aaronson, Adam Bouland, Joseph Fitzsimons, and Mitchell Lee. The space" just above" bqp. In Proceedings of the 2016 ACM Conference on Innovations in Theoretical Computer Science, pages 271-280, 2016.
Scott Aaronson, Xinyi Chen, Elad Hazan, Satyen Kale, and Ashwin Nayak. Online learning of quantum states. Advances in neural information processing systems, 31, 2018.
Ryan Babbush, Jarrod R McClean, Michael Newman, Craig Gidney, Sergio Boixo, and Hartmut Neven. Focus beyond quadratic speedups for error-corrected quantum advantage. PRX Quantum, 2(1):010103, 2021.
Costin Bădescu and Ryan O'Donnell. Improved quantum data analysis. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, pages 1398-1411, 2021.
John C Baez and Jacob Biamonte. Quantum techniques for stochastic mechanics. arXiv preprint arXiv:1209.3632, 2012.
Marcello Benedetti, Erika Lloyd, Stefan Sack, and Mattia Fiorentini. Parameterized quantum circuits as machine learning models. Quantum Science and Technology, 4(4):043001, 2019.
Yoshua Bengio, Eric Laufer, Guillaume Alain, and Jason Yosinski. Deep generative stochastic networks trainable by backprop. In International Conference on Machine Learning, pages 226-234. PMLR, 2014.
Fernando GSL Brandão, Amir Kalev, Tongyang Li, Cedric Yen-Yu Lin, Krysta M Svore, and Xiaodi Wu. Quantum sdp solvers: Large speed-ups, optimality, and applications to quantum learning. arXiv preprint arXiv:1710.02581, 2017.
Matthias C Caro, Hsin-Yuan Huang, Marco Cerezo, Kunal Sharma, Andrew Sornborger, Lukasz Cincio, and Patrick J Coles. Generalization in quantum machine learning from few training data. Nature communications, 13(1):4919, 2022. URL https://www.nature.com/articles/s41467-022-32550-3.
Marco Cerezo, Akira Sone, Tyler Volkoff, Lukasz Cincio, and Patrick J Coles. Cost-function-dependent barren plateaus in shallow quantum neural networks, 2020. URL https://arxiv.org/abs/2001.00550.
Stephen P Jordan. Fast quantum algorithm for numerical gradient estimation. Physical review letters, 95(5):050501, 2005.
Abhinav Kandala, Antonio Mezzacapo, Kristan Temme, Maika Takita, Markus Brink, Jerry M Chow, and Jay M Gambetta. Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. nature, 549(7671):242-246, 2017.
Yann LeCun, Bernhard Boser, John Denker, Donnie Henderson, Richard Howard, Wayne Hubbard, and Lawrence Jackel. Handwritten digit recognition with a back-propagation network. Advances in neural information processing systems, 2, 1989.
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436-444, 2015.
Jarrod R McClean, Sergio Boixo, Vadim N Smelyanskiy, Ryan Babbush, and Hartmut Neven. Barren plateaus in quantum neural network training landscapes. Nature communications, 9(1):1-6, 2018.
Kosuke Mitarai, Makoto Negoro, Masahiro Kitagawa, and Keisuke Fujii. Quantum circuit learning. Physical Review A, 98(3):032309, 2018.
Román Orús. Tensor networks for complex quantum systems. Nature Reviews Physics, 1(9):538-550, 2019. URL https://www.nature.com/articles/s42254-019-0086-7.
David Perez-Garcia, Frank Verstraete, Michael M Wolf, and J Ignacio Cirac. Matrix product state representations. arXiv preprint quant-ph/0608197, 2006. URL https://arxiv.org/abs/quant-ph/0608197.
David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by back-propagating errors. nature, 323(6088):533-536, 1986.
Maria Schuld and Nathan Killoran. Is quantum advantage the right goal for quantum machine learning? *Prx Quantum*, 3(3):030101, 2022.
Maria Schuld, Ville Bergholm, Christian Gogolin, Josh Izaac, and Nathan Killoran. Evaluating analytic gradients on quantum hardware. Physical Review A, 99(3):032331, 2019.
James C Spall. Adaptive stochastic approximation by the simultaneous perturbation method. IEEE transactions on automatic control, 45(10):1839-1853, 2000.
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In Proceedings of the AAAI conference on artificial intelligence, volume 31, 2017.
Joran Van Apeldonorn, András Gilyén, Sander Gribling, and Ronald de Wolf. Quantum sdp-solvers: Better upper and lower bounds. Quantum, 4:230, 2020.
Samson Wang, Enrico Fontana, Marco Cerezo, Kunal Sharma, Akira Sone, Lukasz Cincio, and Patrick J Coles. Noise-induced barren plateaus in variational quantum algorithms. Nature communications, 12(1):1-11, 2021.
Steven R White. Density matrix formulation for quantum renormalization groups. Physical review letters, 69(19):2863, 1992. URL https://journals.acs.org/prl/abstract/10.1103/PhysRevLett.69.2863.
Zifeng Wu, Chunhua Shen, and Anton Van Den Hengel. Wider or deeper: Revisiting the resnet model for visual recognition. Pattern Recognition, 90:119-133, 2019.
A Resource scaling for quantum backpropagation methods