Quantum Machine Intelligence (2023) 5:43 https://doi.org/10.1007/s42484-023-00132-1 RESEARCH A semi-agnostic ansatz with variable structure for variational quantum algorithms M. Bilkis1,2 · M. Cerezo2,3 · Guillaume Verdon4,5 · Patrick J. Coles2 · Lukasz Cincio2 Received: 30 January 2023 / Accepted: 4 October 2023 © The Author(s) 2023 Abstract Quantum machine learning—and specifically Variational Quantum Algorithms (VQAs)—offers a powerful, flexible paradigm for programming near-term quantum computers, with applications in chemistry, metrology, materials science, data science, and mathematics. Here, one trains an ansatz, in the form of a parameterized quantum circuit, to accomplish a task of interest. However, challenges have recently emerged suggesting that deep ansatzes are difficult to train, due to flat training landscapes caused by randomness or by hardware noise. This motivates our work, where we present a variable structure approach to build ansatzes for VQAs. Our approach, called VAns (Variable Ansatz), applies a set of rules to both grow and (crucially) remove quantum gates in an informed manner during the optimization. Consequently, VAns is ideally suited to mitigate trainability and noise-related issues by keeping the ansatz shallow. We employ VAns in the variational quantum eigensolver for condensed matter and quantum chemistry applications, in the quantum autoencoder for data compression and in unitary compilation problems showing successful results in all cases. Keywords Quantum machine learning · Variational quantum algorithms · Quantum circuit discovery 1 Introduction quantum algorithms (VQAs) (Bharti et al. 2022; Cerezo et al. 2021a; Peruzzo et al. 2014) train such circuits to Quantum computing holds the promise of providing solu- minimize a cost function and consequently accomplish a tions to many classically intractable problems. The availabil- task of interest. Examples of such tasks are finding ground- ity of Noisy Intermediate-Scale Quantum (NISQ) devices states (Peruzzo et al. 2014), solving linear systems of equa- (Preskill 2018) has raised the question of whether these tions (Bravo-Prieto et al. 2019; Huang et al. 2019; Xu et al. devices will themselves deliver on such a promise, or whether 2021), simulating dynamics (Cirstoiu et al. 2020; Commeau they will simply be a stepping stone to fault-tolerant archi- et al. 2020; Gibbs et al. 2021; Yuan et al. 2019), factor- tectures. ing (Anschuetz et al. 2019), compiling (Khatri et al. 2019; Parameterized quantum circuits have emerged as one of Sharma et al. 2020), enhancing quantum metrology (Beckey the best hopes to make use of NISQ devices. Variational et al. 2022; Koczor et al. 2020), and analyzing principle components (Cerezo et al. 2022; LaRose et al. 2019). More B M. Bilkis generally, one may employ multiple input states to train the matias.bilkis@uab.cat; matiasbilkis@gmail.com parameterized quantum circuit, and many data science appli- cations have been envisioned for VQAs (Abbas et al. 2021; 1 Fisica Teorica: Informacio i Fenomens Quantics, Biamonte et al. 2017; Schuld et al. 2014; Verdon et al. 2019b). Departament de Fisica, Universitat Autonoma de Barcelona, ES-08193 Bellaterra (Barcelona), Spain Despite recent relatively large-scale implementations of 2 VQAs (Arute et al. 2020; Harrigan et al. 2021; Ollitrault et al. Theoretical Division, Los Alamos National Laboratory, Los Alamos, NM 87545, USA 2020), there are still several issues that need to be addressed to 3 ensure that VQAs can provide a quantum advantage on NISQ Center for Nonlinear Studies, Los Alamos National Laboratory, Los Alamos, NM, USA devices. One issue is trainability. For instance, it has been 4 shown that several VQA architectures become untrainable Sandbox@Alphabet, Mountain View, CA, USA for large problem sizes due to the existence of the so-called 5 Institute for Quantum Computing, University of Waterloo, barren plateau phenomenon (Cerezo et al. 2021b; Holmes Waterloo, ON, Canada 0123456789().: V,-vol 123 43 Page 2 of 22 Quantum Machine Intelligence (2023) 5:43 et al. 2021; McClean et al. 2018; Pesah et al. 2021; Thanasilp concentrates around its mean value. Similar to other barren et al. 2021; Zhao and Gao 2021), which can be linked to plateaus, this phenomenon leads to an exponentially large circuits having large expressibility (Holmes et al. 2022) or precision being required to train the parameters. Currently, generating large quantities of entanglement (Marrero et al. no strategies have been proposed to deal with noise-induced 2021; Patti et al. 2021; Sharma et al. 2022). The exponen- barren plateaus. Hence, developing such strategies is a cru- tial scaling caused by such barren plateaus cannot simply be cial research direction. escaped by changing the optimizer (Arrasmith et al. 2021; Circuit depth is clearly a key parameter for both of these Cerezo and Coles 2021). However, some promising strate- issues. It is, therefore, essential to construct ansatzes that gies have been proposed to mitigate barren plateaus, such as maintain a shallow depth to mitigate noise and trainability correlating parameters (Volkoff and Coles 2021), layerwise issues, but also that have enough expressibility to contain the training (Skolik et al. 2021), and clever parameter initializa- problem solution. Two different strategies for ansatzes can tion (Grant et al. 2019; Verdon et al. 2019a). be distinguished: either using a fixed (Bartlett and Musiał The other major issue is quantum hardware noise, which 2007; Cao et al. 2019; Farhi et al. 2014; Hadfield et al. 2019; accumulates with the circuit depth (Stilck França and Garcia- Kandala et al. 2017) or a variable structure (Chivilikhin et al. Patron 2021; Wang et al. 2021). This of course reduces the 2020; Cincio et al. 2018, 2021; Du et al. 2020; Grimsley et al. accuracy of observable estimation, e.g., when trying to esti- 2019; Rattew et al. 2019; Tang et al. 2021; Zhang et al. 2021, mate a ground state energy. However, it also leads to a more 2020b). While the former is the traditional approach, the subtle and detrimental issue known as noise-induced barren latter has recently gained considerable attention due to its ver- plateaus (Wang et al. 2021). Here, the noise corrupts the states satility to address the aforementioned challenges. In variable in the quantum circuit and the cost function exponentially structure ansatzes, the overall strategy consists of employing Fig. 1 Schematic diagram of the VAns algorithm. a VAns explores the finding the shortest circuit (step II to III). The ovals represent sub- hyperspace of architectures of parametrized quantum circuits to create spaces of the architecture hyperspace connected through VAns. While short depth ansatzes for VQA applications. VAns takes a (potentially some regions may be smoothly connected by placing identity resolu- non-trivial) initial circuit (step I) and optimizes its parameters until tions, VAns can also explore regions that are not smoothly connected convergence. At each step, VAns inserts blocks of gates into the circuit via a gate-simplification process. VAns can either reject (step IV) or which are initialized to the identity (indicated in a box in the figure), accept (step V) modifications in the circuit structure. Here Z (X ) indi- so that the ansatzes at contiguous steps belong to an equivalence class cates a rotation about the z (x) axis. b Schematic representation of the of circuits leading to the same cost value (step II). VAns then employs cost function value versus the number of iterations for a typical VAns a classical algorithm to simplify the circuit by eliminating gates and implementation which follows the steps in a) 123 Quantum Machine Intelligence (2023) 5:43 Page 3 of 22 43 a machine learning protocol to iteratively grow the quantum mization task at hand. For instance, when employing the circuit by placing gates that empirically lower the cost func- Variational Quantum Eigensolver (VQE) algorithm, we have tion. While these approaches address the expressibility issue f i (x) = x and the cost function reduces to C(k, θ ) = by exploring specific regions of the ansatz architecture hyper- Tr[HU (k, θ )ρU † (k, θ )], where ρ is the input state (and the space, their depth can still grow and lead to noise-induced only state in the training set) and H is the Hamiltonian whose issues, and they can still have trainability issues from accu- ground state one seeks to prepare. Alternatively, in a binary mulating a large number of trainable parameters. classification problem where the training set is of the form In this work, we combine several features of recently {ρi , yi }, with yi ∈ {0, 1} being the true label, the choice proposed methods to introduce the Variable Ansatz (VAns) f i (x) = (x − yi )2 leads to the least square error cost. algorithm to generate variable structure ansatzes for generic Given the cost function, a quantum computer is employed VQA applications. As shown in Fig. 1, VAns iteratively to estimate each term in Eq. 1, while the power of classical grows the parameterized quantum circuit by adding blocks optimization algorithms is leveraged to solve the optimiza- of gates initialized to the identity, but also prevents the cir- tion task cuit from over-growing by removing gates and compressing the circuit at each iteration. In this sense, VAns produces argmin C(k, θ ) . (2) shallow circuits that are more resilient to noise, and that k,θ have less trainable parameters to avoid trainability issues. Our approach provides a simple yet effective way to address The success of a VQA algorithm in solving Eq. 2 hinges on the ansatz design problem, without resorting to resource- several factors. First, the classical optimizer must be able to expensive computations. efficiently train the parameters, and in the past few years, This article is fix-structured as follows. In Sec. 2, we pro- there has been a tremendous effort in developing quantum- vide background on VQA and barren plateaus, and we present aware optimizers (Arrasmith et al. 2020; Fontana et al. 2020; a comprehensive literature review of recent variable ansatz Koczor and Benjamin 2019; Kübler et al. 2020; Nakanishi design. We then turn to Sec. 3, where we present the VAns et al. 2020; Stokes et al. 2020; Verdon et al. 2018). Moreover, algorithm. In Sec. 4, we present numerical results where we while several choices of observables {Oi } and functions { f i } employ VAns to obtain the ground state of condensed matter can lead to different faithful cost functions (i.e., cost func- and quantum chemistry systems. Here, we also show how tions whose global optima correspond to the solution of the VAns can be used to build ansatzes for quantum autoencod- problem), it has been shown that global cost functions can ing applications, a paradigmatic VQA implementation, and lead to barren plateaus and trainability issues for large prob- demonstrate how VAns can be applied to compile quantum lem sizes (Cerezo et al. 2021b; Sharma et al. 2022). Here, circuits. Moreover, we study the noise resilience of VAns we recall that global cost functions are defined as ones where by benchmarking ground-state preparation tasks in the pres- Oi acts non-trivially on all n qubits. Finally, as discussed in ence of noise. Finally, in Sec. 5, we discuss our results and the next section, the choice of ansatz for U (k, θ ) also plays a present potential future research directions employing the crucial role in determining the success of the VQA scheme. VAns algorithm. 2.2 Barren plateaus 2 Background The barren plateau phenomenon has recently received con- 2.1 Theoretical framework siderable attention as one of the main challenges to overcome for VQA architectures to outperform their classical counter- In this work, we consider generic Variational Quantum Algo- parts. Barren plateaus were first identified in McClean et al. rithm (VQA) tasks where the goal is to solve an optimization (2018), where it was shown that deep random parametrized problem encoded into a cost function of the form quantum circuits that approximate 2-designs have gradients   that are (in average) exponentially vanishing with the system  C(k, θ ) = f i Tr[Oi U (k, θ )ρi U † (k, θ )] . (1) size. That is, one finds that i     ∂C(k, θ ) 1 Here, {ρi } are n-qubit states forming a training set, and Var  F(n) , with F(n) ∈ O n , (3) ∂θ 2 U (k, θ ) is a quantum circuit parametrized by continu- ous parameters θ (e.g., rotation angles) and by discrete parameters k (e.g., gate placements). Moreover, Oi are where θ ∈ θ . From Chebyshev’s inequality, we have that observables and f i are functions that encode the opti- Var ∂C(k,θ ∂θ ) bounds the probability that the cost-function 123 43 Page 4 of 22 Quantum Machine Intelligence (2023) 5:43 partial derivative deviates from its mean value (of zero) as ing a noise-induced barren plateau, since here reducing the circuit noise (improving the quantum hardware) and employ-   ∂C(k, θ ) Var[ ∂C(k,θ ∂θ ] ) ing shallow circuits seem to be the only viable and promising Pr c  , (4) strategies to prevent these barren plateaus. ∂θ c2 for any c > 0. Hence, when the cost exhibits a barren plateau, 2.3 Ansatz for parametrized quantum circuits an exponentially large precision is needed to determine a cost minimizing direction and navigate the flat landscape (Arra- Here, we analyze different ansatzes strategies for parametrized smith et al. 2021; Cerezo and Coles 2021). quantum circuits and how they can be affected by barren This phenomenon was generalized in Cerezo et al. (2021b) plateaus. Without loss of generality, a parametrized quantum to shallow circuits, and it was shown that the locality of circuit U (k, θ ) can always be expressed as the operators Oi in Eq. 1 play a key role in leading to barren plateaus. Barren plateaus were later analyzed and U (k, θ ) = Uk j (θ j )Wk j , (6) extended to the context of dissipative (Sharma et al. 2022) j and convolutional quantum neural networks (Pesah et al. 2021; Zhao and Gao 2021), and to the problem of learn- −iθ G ing scramblers (Holmes et al. 2021). A key aspect here is where Wk j are fixed gates, and where Uk j (θ j ) = e j k j that circuits with large expressibility (Holmes et al. 2022; are unitaries generated by a Hermitian operator G k j and Larocca et al. 2022) (i.e., which sample large regions of the parametrized by a continuous parameter θ j ∈ θ . In a fixed unitary group (Sim et al. 2019)) and which generate large structure ansatz, the discrete parameters k j ∈ k usually deter- amounts of entanglement (Marrero et al. 2021; Patti et al. mine the type of gate, while in a variable structure ansatz they 2021; Sharma et al. 2022) will generally suffer from barren can also control the gate placement in the circuit. plateaus. While several strategies have been developed to mitigate the randomness or entanglement in ansatzes prone 2.3.1 Fixed structure ansatz to barren plateaus (Bharti and Haug 2021; Cerezo et al. 2022; Grant et al. 2019; Pesah et al. 2021; Skolik et al. 2021; Verdon Let us first discuss fixed structure ansatzes. A common archi- et al. 2019a; Volkoff and Coles 2021; Zhang et al. 2020a), it tecture with fixed structure is the layered Hardware Efficient is widely accepted that designing smart ansatzes which pre- Ansatz (HEA) (Kandala et al. 2017), where the gates are vent altogether barren plateaus is one of the most promising arranged in a brick-like fashion and act on alternating pairs applications. of qubits. One of the main advantages of this ansatz is that Here, we remark that there exists a second method leading it employs gates native to the specific device used, hence to barren plateaus which can even affect smart ansatzes with avoiding unnecessary depth overhead arising from compil- no randomness or entanglement-induced barren plateaus. As ing non-native unitaries into native gates. This type of ansatz shown in Wang et al. (2021), the presence of certain noise is problem-agnostic, in the sense that it is expressible enough models acting throughout the circuit maps the input state so that it can be generically employed for any task. However, toward the fixed point of the noise model (i.e., the maximally its high expressibility (Holmes et al. 2022) can lead to train- mixed state) (Stilck França and Garcia-Patron 2021; Wang ability and barren plateau issues. et al. 2021), which effectively implies that the cost function As previously mentioned, designing smart ansatzes can value concentrates exponentially around its average as the help in preventing barren plateaus. One such strategy are circuit depth increases. Explicitly, in a noise-induced barren the so-called problem inspired ansatzes. Here the goal is to plateau one now finds that encode information of the problem into the architecture of the ansatz so that the optimal solution of Eq. 2 exists within the   ∂C(k, θ ) 1 parameter space without requiring high expressibility. Exam-  g(n) , with g(l) ∈ O , (5) ∂θ ql ples of these fixed structure ansatzes are the Unitary Coupled Cluster (UCC) Ansatz (Bartlett and Musiał 2007; Cao et al. where q > 1 is a noise parameter and l the number of layers. 2019) for quantum chemistry and the Quantum Alternat- From Eq. 5, we see that noise-induced barren plateaus will be ing Operator Ansatz (QAOA) for optimization (Farhi et al. critical for circuits whose depth scales (at least linearly) with 2014; Hadfield et al. 2019). However, while these ansatzes the number of qubits. It is worth remarking that Eq. 5 is no might not exhibit expressibility-induced barren plateaus, longer probabilistic as the whole landscape flattens. Finally, they usually require deep circuits to be implemented, and we note that strategies aimed at reducing the randomness hence are very prone to be affected by noise-induced barren of the circuit cannot generally prevent the cost from hav- plateaus (Wang et al. 2021). 123 Quantum Machine Intelligence (2023) 5:43 Page 5 of 22 43 2.3.2 Variable structure ansatzes features between circuits during the evolution, as simply merging two promising circuits does not necessarily lead To avoid some of the limitations of these fixed struc- to low cost function values. Thus, only random mutations ture ansatzes, there has recently been great effort put have been considered so far. An example of this method is forward towards developing variable ansatz strategies for found in the Evolutionary VQE (EVQE) (Rattew et al. 2019), parametrized quantum circuits (Chivilikhin et al. 2020; Cin- where one smoothly explores the Hilbert space by growing cio et al. 2018, 2021; Du et al. 2020; Grimsley et al. 2019; the circuit with identity-initialized blocks of gates and ran- Rattew et al. 2019; Tang et al. 2021; Zhang et al. 2021, domly removing sequences of gates. As suggested by the 2020b). Here, the overall strategy consists of iteratively authors, this might avoid entering regions leading to bar- changing the quantum circuit by placing (or removing) gates ren plateaus. Another example of an evolutionary algorithm that empirically lower the cost function. In what follows, we is the Multi-objective Genetic VQE (MoG-VQE) (Chivi- briefly review some of these variable ansatz proposals. likhin et al. 2020), where one uses block-structured ansatz The first proposal for variable ansatzes for quantum chem- and simultaneously optimizes both the energy and num- istry was introduced in Grimsley et al. (2019) under the name ber of entangling gates. Evolutionary algorithms constitute of ADAPT-VQE. Here, the authors follow a circuit structure a promising approach to ansatzes design, they nevertheless similar to that used in the UCC ansatz and propose to iter- come at the cost of high quantum-computational resources atively grow the circuit by appending gates that implement to evolve populations of quantum circuits. fermionic operators chosen from a pool of single and double A different machine learning approach to discover ansatz excitation operators. At each iteration, one decides which structures has been considered in Cincio et al. (2018, 2021) operator in the pool is to be appended, which can lead to where the goal is to obtain a short depth version of a given uni- a considerable overhead if the number of operators in the tary. Given specific quantum hardware constraints (such as pool is large. Similarly, to fix structure UCC ansatzes, the connectivity, noise-model as represented by quantum chan- mapping from fermions to qubits can lead to prohibitively nels or available gates), an algorithm grows and modifies the deep circuits. This issue can be overcome using the qubit- structure of a parametrized quantum circuit to best match the ADAPT-VQE (Tang et al. 2021) algorithm, where the pool action of the trained circuit with that of the target unitary. At of operators is modified in such a way that only easily imple- each iteration, a parallelization and compression procedure mentable gates are considered. However, the size of the pool is applied. This method was able to discover a short-depth still grows with the number of qubits. In this context, train- version of the swap test to compute state overlaps (Cincio ability issues have been tackled in Sim et al. (2021), where et al. 2018), and in Cincio et al. (2021) it was shown to the parameter optimization is turned into a series of optimiza- drastically improve the discovered circuit performance in the tions each performed on a subset of the whole parameter set; presence of noise. Moreover, this technique has recently been an heuristic method is proposed in order to remove gates tested in large-scale numerics for combinatorial optimiza- and add new ones, which in turn allowed the authors to tion problems (Liu et al. 2021). In addition, in Ostaszewski optimize circuits naively containing more than a thousand et al. (2021) the authors present a different iterative algorithm parameters. In addition, Ref. (Zhang et al. 2021) studies how where single-qubit rotations are used for growing the circuit, the pool of operators can be further reduced by comput- hence leading to a scheme with limited expressibility power. ing the mutual information between the qubits in classically Finally, in the recent works of Refs. (Du et al. 2020; approximated ground state. We remark that estimations of Pirhooshyaran and Terlaky 2020; Zhang et al. 2020b) the the mutual information have also been recently employed authors employ tools from auto-machine learning to build to reduce the depth of fixed structured ansatzes (Tkachenko variable ansatzes. Specifically, in Du et al. (2020) the authors et al. 2021). We refer the reader to Claudino et al. (2020) make use of the supernet and weight sharing strategies from for a detailed comparison between ADAPT-VQE and UCC neural network architecture search (Elsken et al. 2019), while ansatzes. Despite constituting a promising approach, it is in Zhang et al. (2020b) the proposal is based on a generaliza- unclear whether ADAPT-VQE and its variants will be able tion of the differentiable neural architecture search (Liu et al. to overcome typical noise-induced trainability problems as 2018) for quantum circuits. In Pirhooshyaran and Terlaky the systems under study are increased in size. Moreover, due (2020) the authors study the design of quantum circuits for to its specific quantum chemistry scope, the application of multi-label classification: policy gradient methods are used to these schemes is limited. train a neural network, so to decide which gates will compose A different approach to variable ansatzes that has gained candidate quantum circuits. We remark that while promising, considerable attention are machine-learning-aided evolution- the latter methods require quantum-computational resources ary algorithms that upgrade individuals (quantum circuits) which considerably grow with the problem sizes. from a population. Noticeably, the presence of quantum cor- In the next section, we present a task-oriented NISQ- relations makes it so that it is not straightforward to combine friendly approach to the problem of ansatzes design. In the 123 43 Page 6 of 22 Quantum Machine Intelligence (2023) 5:43 context of the literature, the approach presented here gener- • Circuit Simplification rules to eliminate unneces- alizes the work in Cincio et al. (2018, 2021) as a method sary gates, redundant gates, or gates that do not have to build potentially trainable short-depth ansatz for Varia- a large effect on the cost. The simplification is a map tion Quantum Algorithm tasks. Unlike previous methods, S : Cl → Cl  with l   l. the algorithm introduced here not only grows the circuit but • An optimization algorithm for the continuous parameters more importantly employs classical routines to remove quan- θ , and an optimization algorithm for the discrete param- tum gates in an informed manner during the optimization. In eters k. addition, our method can be used in a wide class of prob- lems within the realm of variational quantum algorithms Given these inputs, VAns outputs a circuit architecture and (where the cost function is usually defined as the expecta- set of parameters that approximately minimize Eq. 2. In what tion of a Hamiltonian), but also within more general contexts follows, we describe the overall structure of VAns (presented (where the loss function can take more general forms such in Algorithm 1), and in the next sections, we provide addi- as mean-squared error and log likelihoods). Finally, below, tional details for the Insertion and Simplification we showcase the performance of VAns in the presence of modules. In all cases, the steps presented here are aimed at hardware noise, a benchmark notably absent in many other giving a general overview of the method and are intended variable ansatzes proposals. to be used as building blocks for more advanced versions of VAns. The first ingredient of VAns (besides the cost function, 3 The variable ansatz (VAns) algorithm which is defined by the problem at hand) is a dictionary D of parametrized gates that can compile to identity and which 3.1 Overview VAns will employ to build the ansatz. A key aspect here is that D can be composed of any set of gates, so that one can build The goal of the VAns algorithm is to adaptively construct a dictionary specifically tailored for a given application. For shallow and trainable ansatzes for generic quantum machine instance, for problems with a given symmetry, D can con- learning applications using parametrized quantum circuits. tain gates preserving said symmetry (Gard et al. 2020). In Let us define as Cl the architecture hyperspace of quantum addition, it is usually convenient to have the unitaries in D circuits of depth l, where a single layer is defined as gates expressed in terms of gates native to the specific quantum acting in parallel. VAns takes as input: hardware employed, as this avoids compilation depth over- heads. • A cost function C(k, θ ) to minimize. Once the gate dictionary is set, the ansatz is initialized to • A dictionary D of parametrized gates that compile to a given configuration U (0) (k, θ ). As shown in Algorithm 1, the identity. That is, for V (γ ) ∈ D there exists a set of one then employs an optimizer to train the continuous param- parameters γ ∗ such that V (γ ∗ )= 1. eters θ in the initial ansatz until the optimization algorithm • An initial circuit configuration U (0) (k, θ ) ∈ Cl0 of depth converges. In Fig. 2, we show two non-trivial initializa- l0 . tion strategies employed in our numerical simulations (see • Circuit Insertion rules which stochastically take an Sect. 4). In Fig. 2a, the circuit is initialized to a separable element V (γ ∗ ) ∈ D and append it to the circuit. The product ansatz which generates no entanglement, while in insertion is a map I : Cl → Cl  with l   l. Fig. 2b, one initializes to a shallow alternating Hardware a) Fig. 2 Examples of initial circuit configurations for VAns. VAns take low alternating Hardware Efficient Ansatz where neighboring qubits as input an initial structure for the parametrized quantum circuit. In a, are initially entangled. Here, Z (X ) indicates a rotation about the z (x) we depict a separable product ansatz which generates no entanglement axis between the qubits. On the other hand, b shows two layers of a shal- 123 Quantum Machine Intelligence (2023) 5:43 Page 7 of 22 43 Efficient Ansatz such that neighboring qubits are entangled. Algorithm 1 Pseudo-code for VAns. While the choice of an appropriate initial ansatz can lead to Input: Cost function C(k, θ); initial circuit U (0) (k, θ ); faster convergence, VAns can in principle transform a simple dictionary of gates D; Insertion rules which take initial ansatz into a more complex one as part of its architec- gates from D and appends them to a circuit; ture search. Simplification rules; optimization algorithm OptC for continuous parameters θ; optimization From this point, VAns enters a nested optimization loop. algorithm Opt D for discrete parameters which accepts In the outer loop, VAns explores the architecture hyperspace or rejects an ansatz update given changes in the cost to optimize the ansatz’s discrete parameters k that character- function value; termination condition function ize the circuit structure. Then, in the inner loop, the ansatz f Term (n, C(k, θ ), U (k, θ )), n ∈ N Output: Optimized ansatz U ( f ) . structure is fixed and the continuous parameters θ are opti- Init: Randomly initialize the parameters θ; initialize the ansatz mized. U ( f ) ← U (0) (k, θ ); C ( f ) ← 0; k( f ) ← k; θ ( f ) ← θ; At the start of the outer loop, VAns employs its Insertion U (k, θ) ← 1; Term ← f alse; n ← 0. rules to stochastically grow the circuit. The fact that these 1 Optimize θ with OptC and store result in θ ( f ) ; rules are stochastic guarantees that different runs of VAns C ( f ) ← C(k, θ). 2 while Term is false do explore distinct regions of the architecture hyperspace. As 3 n ←n+1 previously mentioned, the gates added to the circuit compile 4 Accept ← false to the identity so that circuits that differ by gate insertions 5 while Accept is false do belong to an equivalence class of circuits leading to the same 6 Use Insertion in U ( f ) and store new sets of discrete parameters, continuous parameters and ansatz cost function value. As discussed below, the Insertion in θ, k, and U (k, θ), respectively. rules can be such that they depend on the current circuit they 7 Use Simplification rules 1-5 on U (k, θ) and act upon. For instance, VAns can potentially add entangling store new sets of discrete parameters, continuous gates to qubits that were are not previously connected via parameters and ansatz in θ, k, and U (k, θ ), respectively. two-qubit gates. 8 Optimize continuous parameters in U (k, θ) with To prevent the circuit from constantly growing each time OptC and store result in θ; C ( f ) ← C(k, θ). gates are inserted, VAns follows the Insertion step by a 9 Use Simplification rule 6 Simplification step. Here, the goal is to determine if 10 Given C(k, θ ) and C ( f ) , optimize discrete parameters the circuit depth can be reduced without significantly modi- in U (k, θ ) with Opt D and store result in Accept. fying the cost function value in a systematic way, as proposed 11 k( f ) ← k. in Maslov et al. (2008). This is a fundamental step of VAns as 12 θ( f ) ← θ. it allows the algorithm to explore and jump between different 13 U ( f ) ← U (k, θ ). 14 C ( f ) ← C(k, θ ). regions of the architecture hyperspace which might not be 15 Term ← f Term (n, C ( f ) , U ( f ) ) trivially connected. Moreover, unlike other variable ansatz strategies which continuously increase the circuit depth or which randomly remove gates, the Simplification step allows VAns to find short depth ansatzes by deleting gates in lower bound is available), maximum VAns iteration number, an informed manner. or an user-specified function that might depend on variables Taken together, Insertion and Simplification such as circuit structure and cost value reached. provide a set of discrete parameters k. However, to determine if this new circuit structure can improve the cost function 3.2 Insertion method value it is necessary to enter the inner optimization loop and train the continuous parameters θ. When convergence in the As previously mentioned, the Insertion step stochas- optimization is reached, the final cost function value is com- tically grows the circuit by inserting into the circuit a pared to the cost in the previous iteration. Updates that lead parametrized block of gates from the dictionary D which to equi-cost values or to smaller costs are accepted, while compiles to the identity. It is worth noting that in practice updates leading to higher cost functions are accepted with one can allow some deviation from the identity to reach a exponentially decaying probability in a manner similar to a larger gate dictionary D. In turn, this permits VAns to explore Metropolis-Hastings step (Hastings 1970). Here one accepts regions of the architecture hyperspace that could otherwise an update which increases the cost value with a probabil- take several iterations to be reached. In Fig. 3, we show exam- ity given by exp (−β C0C ), with C0C being increment in the ples of two parametrized quantum circuits that can compile cost function with respect to the initial value, and β > 0 a to the identity. “temperature” factor. The previous optimizations in inner and There are many choices for how VAns determines which outer loops are repeated until a termination condition f Term gates are chosen from D at each iteration, and where they is reached, e.g., distance to a target cost function value (if a should be placed. When selecting gates, we have here taken 123 43 Page 8 of 22 Quantum Machine Intelligence (2023) 5:43 3.3 Simplification method The Simplification steps in VAns are aimed at elim- inating unnecessary gates, redundant gates, or gates that do not have a large effect on the cost. For this purpose, Simplification moves gates in the circuit using the commutation rules shown in Fig. 4a to group single qubits rotations and CNOTs together. Once there are no further com- mutations possible, the circuit is scanned and a sequence of simplification rules are consequently applied. For instance, Fig. 3 Circuits from the dictionary D used during the Insertion assuming that the input state is initialized to |0⊗n , we can steps. Here, we show two types of the parametrized gate sequences define the following set of simplification rules. composed of CNOTs and rotations about the z and x axis. Specifically, one obtains the identity if the rotation angles are set to zero. Using the circuit in a, one inserts a general unitary acting on a given qubit, while 1. CNOT gates acting at the beginning of the circuit are the circuit in b entangles the two qubits it acts upon removed. 2. Rotations around the z-axis acting at the beginning of the circuit are removed. 3. Consecutive CNOT sharing the same control and target a uniform sampling approach, where every sequence of gates qubits are removed. in D has an equal probability to be selected. While one 4. Two or more consecutive rotations around the same axis could follow a similar approach for determining where said and acting on the same qubit are compiled into a single gates should be inserted, this can lead to deeper circuits rotation (whose value is the sum of the previous values). with regions containing an uneven number of CNOTs. In our 5. If three or more single-qubit rotations are sequentially heuristics, VAns has a higher probability to place two-qubit acting on the same qubit, they are simplified into a general gates acting on qubits that were otherwise not previously single-qubit rotation of the form Rz (θ1 )Rx (θ2 )Rz (θ3 ) or connected or shared a small number of entangling gates. Rx (θ1 )Rz (θ2 )Rx (θ3 ) which has the same action as the Fig. 4 Rules for the Simplification steps. a Commutation rules used by VAns to move gates in the circuit. As shown, one can commute a CNOT with a rotation Z (X ) about the z (x) axis acting on the control (target) qubit. b Example of simplification rules used by VAns to reduce the circuit depth. Here, we assume that the circuit is initialized to |0⊗n 123 Quantum Machine Intelligence (2023) 5:43 Page 9 of 22 43 previous product of rotations—note that in the figures, using VAns versus that of using a standard fix architecture we denote such rotations by X or Z —. scheme. In the following discussion, we will not include 6. Gates whose presence in the circuit does not considerably any computational cost or complexity of the optimizer as reduce the cost are removed. we assume that the same tools could be used for fixed or variable ansatzes. Rules (1)−(5) are schematically shown in Fig. 4b. We remark Firstly, we note that any additional computational that a crucial feature of these Simplification rules is cost comes due to circuit manipulations, meaning that that they can be performed using a classical computer that we should study the scaling of the Insertion and analyzes the circuit structure and hence do not lead to addi- Simplification methods. On the one hand, adding tional quantum-computation resources. gates via Insertion is stochastic, and independent of As indicated by step (6), the Simplification steps the number of qubits or the current circuit depth, that is: can also delete gates whose presence in the circuit does not its complexity is always in O(1). Then, removing gates via considerably reduce the cost. Here, given a parametrized Simplification has a cost which increases with the gate, one can remove it from the circuit and compute the number of gates in the circuit. If we have M gates, then ensuing cost function value. If the resulting cost is increased running the Simplification scheme has a cost O(M). We by more than some threshold value, the gate under considera- note that such computational complexity is similar to that tion is removed and the simplification rules (1)−(5) are again of using gradient-free versus gradient-based methods, as the implemented. Here, one can use information from the inner computational cost of the latter also scale as O(M). Notably, optimization loop to find candidate gates for removal. For since the goal of VAns is to produce short-depth circuits, the instance, when employing a gradient descent optimizer, one algorithm itself tries to reduce its own computational cost may attempt to remove gates whose parameters lead to small during training. As we sill see below in our numerical exam- gradients. Note that, unlike the simplification steps (1) − (5) ples, VAns is always able to find short-depth circuits whose in Fig. 4b, when using the deletion process in (6) one needs solutions are better than those arising from fixed structure to call a quantum computer to estimate the cost function, and ansatzes, meaning that the extra complexity of VAns can be hence these come at an additional quantum-resource over- justified in terms of its performance. head which scales linearly with the number of gates one is attempting to remove. 3.5 Mitigating the effect of barren plateaus An interesting aspect of the Simplification method is that it allows VAns to obtain circuit structures that are not 3.5.1 General considerations contained in the initial circuit U (0) (k, θ ) or in the gate dictio- nary D, and hence to explore new regions of the architecture Let us now discuss why VAns is expected to mitigate the hyperspace. For instance, using the gate dictionary in Fig. 3, impact of barren plateaus. VAns can obtain a gate structure as the one shown in Fig. 5. First, consider the type of barren plateaus that are caused by the circuit approaching an approximate 2-design 3.4 Scaling of VAns (McClean et al. 2018). Approximating a 2-design requires a circuit that both has a significant number of parameters and With the previous overview of the VAns method in mind, let also has a significant depth (Brandao et al. 2016; Dankert us now discuss the computational complexity arising from et al. 2009; Haferkamp 2022; Harrow and Low 2009; Har- row and Mehraban 2018). Hence, reducing either the number of parameters or the circuit depth can combat these barren plateaus. Fortunately, VAns attempts to reduce both the num- ber of parameters and the depth. Consequently, VAns actively attempts to avoid approximating a 2-design. Second, consider the barren plateaus that are caused by hardware noise (Wang et al. 2021). For such barren plateaus, it was shown that the circuit depth is the key parameter, as the gradient vanishes exponentially with the depth. As VAns actively attempts to reduce the number of CNOTs, it also reduces the circuit depth. Hence, VAns will mitigate the effect of noise-induced barren plateaus by keeping the depth shal- low during the optimization. Evidence of such a mechanism Fig. 5 Circuit obtained from VAns. Shown is a non-trivial circuit structure that can be obtained by VAns using the Insertion and can be found in the next section, where we consider sim- Simplification steps and the gate dictionary in Fig. 3 ulations under the presence of noise. In such a case, VAns 123 43 Page 10 of 22 Quantum Machine Intelligence (2023) 5:43 automatically adjusts the circuit layout in such a way that the (VQE) algorithm (Peruzzo et al. 2014) to obtain the ground cost function reaches a minima, which translates to short- state of the Transverse Field Ising model (TFIM), the XXZ depth circuits in noisy scenarios. Heisenberg spin model, and the H2 and H4 molecules. We then apply VAns to a quantum autoencoder (Romero et al. 3.5.2 Specific applications 2017) task for data compression. We then move to use VAns to compile a Quantum Fourier Transform unitary in systems While in the previous subsection, we have presented gen- up to 10 qubits. Finally, we benchmark the performance eral arguments as to why VAns can improve trainability, of VAns under the presence of noisy channels, which are here, we instead present a practical method that combines unavoidable in quantum hardware, and demonstrate that it VAns with the recent techniques of Ref. Sack et al. (2022) successfully finds cost-minimizing circuits on a wide range for mitigating barren plateaus using classical shadows. For of noise-strength levels. completeness, we briefly review the results in Sack et al. The simulations presented here were performed using (2022). Firstly, as noted in Sect. 2.2 it is known that the Tensorflow quantum (Broughton et al. 2020). Adam (Kingma presence of barren plateaus is intrinsically related to the and Ba 2015) and qFactor (Younis and Cincio 2020) were entanglement generated in the circuit (Marrero et al. 2021; employed to optimize the continuous parameters θ . While Patti et al. 2021; Sharma et al. 2022). That is, circuits gen- the results shown in noiseless scenarios were obtained from erating large amounts of entanglement are prone to barren a single instance of the algorithm for each problem, noisy plateaus. With this remark in mind, the authors in Sack simulations required several instances of the algorithm to et al. (2022) propose to detect the onset of a barren plateau reach a minima (here, we present results obtained after 50 by monitoring the entanglement in the state at the out- iterations), due to the fact that the optimization landscape is put of the circuit. This can be achieved by computing, via considerably more challenging in the latter case. The dictio- classical shadows (Huang et al. 2020), the second Rényi nary of gates used consisted on single-qubit rotation around entanglement entropy S2 (ρ R ) = − log(Tr[ρ R ]2 ), where x and z axis, and CNOTs gates between all qubits in the ρ R = Tr R [U (k, θ )ρi U † (k, θ )] denotes a reduced state on circuit. Moreover, we have assumed no connectivity con- a subset of R qubits. As such, if S2 (ρ R ) approaches the straints under the quantum circuits under consideration. In maximal possible entanglement of the S qubits, given by the the following examples, VAns was initialized to either a sep- so-called Page value S page ∼ k log(2) − 2n−2k+11 , one knows arable ansatz or an -layer HEA, with  < 3 (see Fig. 2 for that the optimization is leading to a region of high entangle- a depiction of separable and 2-layer HEA circuits); in our ment, and thus of barren plateaus. The key proposal in Sack heuristics, we observed that, as expected, varying the initial et al. (2022) is to tune the optimizer (e.g., by controlling the circuit helps to attain a quicker convergence towards optimal gradient step) so that regions of large entropies are avoided. cost-values. Nevertheless, the optimal choice of initial circuit This technique is shown to work well with an identity block is subtle: highly expressible initial circuits are not always the initialization (Grant et al. 2019), whereby the parameters in best choice, since they might bias the search and even dimin- the trainable unitary are chosen such that U (k, θ ) = 1 at ish the convergence rate due to the appearance of multiple the start of the algorithm. Note that, in principle, this is still local minima in the optimization landscape. Moreover, under a fixed ansatz method, as some circuit structure has to be the presence of noise, long-depth initial circuits such as HEA fixed beforehand, and as no gates are ever removed. Hence, potentially increase the cost-value function instead of dimin- the methods in Sack et al. (2022) can be readily combined ishing it, due to noise accumulation. In such a case, it takes with VAns to variationally explore the architecture hyper- VAns a higher amount of iterations to shorten circuit’s depth. space while keeping track of the reduced state entropy. In For the noisy simulations, we have considered a one-layered practice, this means that one can modify the VAns update HEA as initial circuit for VAns. rule to allow for steps that do not significantly increase entropy, while favoring steps that keep the entropy constant, 4.1 Transverse field ising model or even that reduce it (e.g., by removing gates during the Simplification modules). Let us now consider a cyclic TFIM chain. The Hamiltonian of the system reads 4 Numerical results  n  n H = −J σ jx σ j+1 x −g σ jz , (7) In this section, we present heuristic results obtained from sim- j=1 j=1 ulating VAns to solve paradigmatic problems in condensed x(z) matter, quantum chemistry, and quantum machine learning. where σ j is the Pauli x (z) operator acting on qubit j, We first use VAns in the Variational Quantum Eigensolver and where n + 1 ≡ 1 to indicate periodic boundary con- 123 Quantum Machine Intelligence (2023) 5:43 Page 11 of 22 43 Fig. 6 Results of using VAns to obtain the ground state of a Transverse Field Ising model. Here, we use VAns in the VQE algorithm for the Hamiltonian in Eq. 7 with a n = 4 qubits and b n = 8 qubits, field g = 1, for different values of the interaction J . Top panels: solid lines indicate the exact ground state energy, and the markers are the energies obtained using VAns. Bottom panels: Relative error in the energy for the same interaction values ditions. Here, J indicates the interaction strength, while g ered by VAns as different modifications of the ansatz are is the magnitude of the transverse magnetic field. As men- accepted to minimize the cost in an n = 8 TFIM VQE imple- tioned in Sect. 2, when using the VQE algorithm the goal mentation. Specifically, in Fig. 7(top), we see that as VAns is to optimize a parametrized quantum circuit U (k, θ ) to explores the architecture hyperspace, the cost function value prepare the ground state of H so that the cost function continually decreases until one can determine the ground becomes E(k, θ ) = Tr[HU (k, θ )ρU † (k, θ )], where one state of the TFIM. Figure 7(bottom) shows that initially VAns usually employs ρ = |0 0| with |0 = |0⊗n . Note that, increases the number of trainable parameters and CNOTs in we here employ E as the cost function label to keep with the circuit via the Insertion step. However, as the circuit usual notation convention. size increases, the action of the Simplification module In Fig. 6, we show results obtained from employing VAns becomes more relevant as we see that the number of trainable to find the ground state of a TFIM model of Eq. 7 with n = 4 parameters and CNOTs can decrease throughout the com- qubits (a) and with n = 8 qubits (b), field g = 1, and putation. Moreover, here, we additionally see that reducing different interactions values. To quantify the performance the number of CNOTs and trainable parameters can lead to of the algorithm, we additionally show the relative error improvements in the cost function value. The latter indicates |E/E 0 |, where E 0 is the exact ground state energy E 0 , that VAns can indeed lead to short depth ansatzes which can E = E VAns − E 0 , and E VAns the best energy obtained efficiently solve the task at hand, even without the presence through VAns. For 4 qubits, we see from Fig. 6 that the rel- of noise. ative error is always smaller than 6 × 10−5 , showing the In Fig. 7, we also compare the performance of VAns with that ground state was obtained for all cost values. Then, for that of the layered Hardware Efficient Ansatz of Fig. 2b with n = 8 qubits, VAns obtains the ground state of the TFIM 2 and 5 layers. We specifically compare against those two fixed with relative error smaller than 8 × 10−4 . structure ansatzes as the first (latter) has a number of trainable To gain some insight into the learning process, in Fig. 7, parameters (CNOTs) comparable to those obtained in the VAns we show the cost function value, number of CNOTs, and circuit. In all cases, we see that VAnscan produce better results the number of trainable parameters in the circuit discov- than those obtained with the Hardware Efficient Ansatz. 123 43 Page 12 of 22 Quantum Machine Intelligence (2023) 5:43 Fig. 7 VAns learning process. a Here, we show an instance of running the algorithm for the Hamiltonian in Eq. 7 with n = 8 qubits, field g = 1, and interaction J = 1.5. The top panel shows the cost function value and the bottom panel depicts the number of CNOTs, and the number of trainable parameters versus the number of modifications of the ansatz accepted in the VAns algorithm. Top: As the number of iterations increases, VAns minimizes the energy until one finds the ground state of the TFIM. Here, we also show the best results obtained by training a fixed structure layered Hardware Efficient Ansatz (HEA) with 2 and 5 layers, and in both cases, VAns outperforms the HEA. Bottom: While initially the number of CNOTs and number of trainable parameters increases, the Simplification method in VAns prevents the circuit from constantly growing, and can even lead to shorter depth circuits that achieve better solutions. Here, we also show the number of CNOTs (solid line) and parameters (dashed line) in the HEA ansatzes considered, and we see that VAns can obtain circuits with less entangling and trainable gates. b We show a low-depth, ground-state preparing circuits found by VAns during the learning process; here Z (X ) indicates a rotation about the z (x) axis, about the corresponding value appearing below 4.2 XXZ Heisenberg model conditions, and where  is the anisotropy. We recall that z H commutes with the total spin component Sz = j σi , Here, we use VAns in a VQE implementation to obtain the meaning that its eigenvectors have definite magnetization M Z ground state of a periodic X X Z Heisenberg spin chain in a along z (Cerezo et al. 2017). transverse field. The Hamiltonian of the system is In Fig. 8, we show numerical results for finding the ground state of Eq. 8 with n = 4 and n = 8 qubits, field g = 1,  n y y  n and for different anisotropy values. For 4 qubits, we see that H= σ jx σ j+1 x + σ j σ j+1 + σ jz σ j+1 z +g σ jz , (8) VAns can obtain the ground state with relative errors which j=1 j=1 are always smaller than 9 × 10−7 . In the n = 8 qubits case, the relative error is of the order 10−3 , with error increasing in μ where again σ j are the Pauli operator (with μ = x, y, z) the region 0 <  < 1. We remark that a similar phenomenon acting on qubit j, n + 1 ≡ 1 to indicate periodic boundary is observed in Cervera-Lierta et al. (2020), where errors in 123 Quantum Machine Intelligence (2023) 5:43 Page 13 of 22 43 Fig. 8 Results of using VAns to obtain the ground state of a Heisenberg X X Z model. Here, we use VAns in the VQE algorithm for the Hamiltonian in Eq. 8 with a n = 4 and b n = 8 qubits, field g = 1, and indicated anisotropies . Top panels: The solid line indicates the exact ground state energy, and the markers are the energies obtained using VAns. Bottom panels: Relative error in the energy for the same anisotropy values preparing the ground state of the X X Z chain increase in the electronic Hamiltonians for quantum chemistry are usually same region. The reason behind this phenomenon is that the obtained in the second quantization formalism in the form optimizer can get stuck in a local minimum where it prepares excited states instead of the ground state. Moreover, it can be  1  H= † h mn am an + an a p aq , † † h mnpq am (9) verified that while the ground state and the three first exited 2 mnpq mn states all belong to the same magnetization sub-space of state with magnetization M Z = 0, they have in fact different local † symmetries and structure. Several of the low-lying excited where {am } and {an } are the fermionic creation and anni- states have a Néel-type structure of spins with non-zero local hilation operators, respectively, and where the coefficients magnetization along z of the form | ↑↓↑↓ · · · . On the other h mn and h mnpq are one- and two-electron overlap inte- hand, the state that becomes the ground-state for  > 1 is a grals, usually computed through classical simulation meth- state where all spins have zero local magnetization along z, ods (Aspuru-Guzik et al. 2005). To implement Eq. 9 in a meaning that the local states are in the x y plane of the Bloch quantum computer one needs to map the fermionic opera- sphere. Since there is a larger number of excited states with tors into qubits operators (usually through a Jordan Wigner a Néel-type structure (and with different translation symme- or Bravyi-Kitaev transformation). Here, we employed the try) variational algorithms tend to prepare such states when OpenFermion package (McClean et al. 2019) to map Eq. 9 minimizing the energy. Moreover, since mapping a state with into a Hamiltonian expressed as a linear combination of n- non-zero local magnetization along z to a state with zero local qubit Pauli operators of the form magnetization requires a transformation acting on all qubits,  any algorithm performing local updates will have a difficult H= cz σ z , (10) time finding such mapping. z with σ z ∈ {1, σ x , σ y , σ z }⊗n , c z real coefficients, and z ∈ 4.3 Molecular hamiltonians {0, x, y, z}⊗n . In all cases, the basis set used to approximate atomic Here, we show results for using VAns to obtain the ground orbitals was STO-3 g and a neutral molecule was considered. state of the Hydrogen molecule and the H4 chain. Molecular The Jordan-Wigner transformation was used in all cases. 123 43 Page 14 of 22 Quantum Machine Intelligence (2023) 5:43 While for the H2 the number of qubits required is four (n = 4), this number is doubled for the H4 chain (n = 8). 4.3.1 H2 Molecule Figure 9 shows the results obtained for finding the ground state of the Hydrogen molecule at different bond lengths. As shown, VAns is always able to accurately prepare the ground state within chemical accuracy. Moreover, as seen in Fig. 9(bottom), VAns usually requires less than 15 itera- tions until achieving convergence, showing that the algorithm quickly finds a way through the architecture hyperspace towards a solution. 4.3.2 H4 Molecule Figure 10 shows the results obtained for finding the ground state of the H4 chain, where equal bond distances are taken. Noticeably, the dictionary of gates D chosen here is not a chemical-inspired one (e.g., it does not contain single and Fig. 10 Results of using VAns to obtain the ground state of a H4 chain double excitation operators nor its hardware-efficient imple- with a linear geometry, at different bond lengths. Here, we use VAns in the VQE algorithm for the molecular Hamiltonian obtained after a mentations), yet VAns is able to find ground-state preparing Jordan-Wigner transformation, leading to an 8-qubit circuit. Top: solid circuits within chemical accuracy (McArdle et al. 2020). lines correspond to ground state energy as computed by the Full Config- uration Interaction (FCI) method, whereas points correspond to energies obtained using VAns. Middle: differences between exact and VAns ground state energies are shown. Dashed line corresponds to chemical accuracy. Bottom: number of iterations required by VAns until conver- gence are shown 4.4 Quantum autoencoder Here, we discuss how to employ VAns and the results from the previous section for the Hydrogen molecule to train the quantum autoencoder introduced in Romero et al. (2017). For the sake of completeness, we now describe the quantum autoencoder algorithm for compression of quantum data. Consider a bipartite quantum system AB of n A and n B qubits, respectively. Then, let { pi , |ψi } be a training set of pure states on AB. The goal of the quantum autoencoder is to train an encoding parametrized quantum circuit V (k, θ ) to Fig. 9 Results of using VAns to obtain the ground state of a Hydro- compress the states in the training set onto subsystem A, so gen molecule, at different bond lengths. Here, we use VAns in the VQE that one can discard the qubits in subsystem B without losing algorithm for the molecular Hamiltonian obtained after a Jordan-Wigner information. Then, using the decoding circuit (simply given transformation, leading to a 4-qubit circuit. Top: solid lines correspond to ground state energy as computed by the Full Configuration Interaction by V † (k, θ )) one can recover each state |ψi  in the training (FCI) method, whereas points correspond to energies obtained using set (or in a testing set) from the information in subsystem A. VAns. Middle: differences between exact and VAns ground state ener- Here, V (k, θ ) is essentially decoupling subsystem A from gies are shown. Dashed line corresponds to chemical accuracy, which subsystem B, so that the state is completely compressed into stands for the ultimate accuracy experimentally reachable in such sys- tems. Bottom: number of iterations required by VAns until convergence subsystem A if the qubits in B are found in a fixed target are shown state (which we here set as |0 B = |0⊗n B ). 123 Quantum Machine Intelligence (2023) 5:43 Page 15 of 22 43 As shown in Romero et al. (2017), the degree of compres- Table 1 Fidelities for VAns Set − log10 (1 − F ) sion can be quantified by the cost function applied to the quantum autoencoder task Training 6.49 (5.05−6.95)  Testing 6.17 (3.61−6.95) C G (k, θ ) = 1 − pi Tr (|0 0| B ⊗ 1 A ) V |ψi  ψi |V † , i The fidelities (F ) are reported as Mean value (Min-Max) across where 1 B is the identity on subsystem A, and where we both training and testing sets have omitted the k and θ dependence in V for simplicity of notation. Here, we see that if the reduced state in B is |0 B cations, VAns can decrease the training cost function down for all the states in the training set, then the cost is zero. Note to 10−7 , by departing from a separable product ansatz (see that, as proved in Cerezo et al. (2021b), this is a global cost Fig. 2). We here additionally show results obtained by train- function (as one measures all the qubits in B simultaneously) ing the Hardware Efficient Ansatz of Fig. 2b with 4 and 15 and hence can have barren plateaus for large problem sizes. layers (as they have a comparable number of trainable param- This issue can be avoided by considering the following local eters and CNOTs, respectively, compared to those obtained cost function where one instead measures individually each with VAns). In all cases, VAns achieves the best performance. qubit in B (Cerezo et al. 2021b) In particular, it is worth noting that VAns has much fewer  nB  pi   parameters (∼ 45 versus 180) than the 15-layer HEA, while C L (k, θ) = 1 − Tr |0 0|k ⊗ 1 A,k V |ψi  ψi |V † . (11) k=1 i nB also achieving a cost value that is lower by two orders of mag- nitude. Hence, VAns obtains better performance with fewer Here, 1 A,k is the identity on all qubits in A and all qubits quantum resources. in B except for qubit k. We remark that this cost function is Moreover, the fidelities obtained after the decoding pro- faithful to C G (k, θ ), meaning that both cost functions vanish cess at the training set are reported in Table 1. Here, F is under the same conditions (Cerezo et al. 2021b). used to denote the fidelity between the input state and the As shown in Fig. 11, we employ the ground states |ψi  state obtained after the encoding/decoding circuit. As one of the H2 molecule (for different bond lengths) to create a can see, VAns obtains very high fidelities for this task. training set of six states and a test set of ten states. Here, the circuits obtained through VAns in the previous section serve 4.5 Unitary compilation as (fixed) state preparation circuits for the ground states of the H2 molecule. We then use VAns to learn an encoding circuit Unitary compilation is a task in which a target unitary is V (k, θ ) which can compress the states |ψi  into a subsystem decomposed into a sequence of quantum gates that can be of two qubits. implemented on a given quantum computer. Current quan- Figure 12 presents results obtained by minimizing the tum computers are limited by the depth of quantum circuits local cost function of Eq. 11 for a single run of the VAns that can be executed on them, which makes the compilation algorithm. As seen, within 15 accepted architecture modifi- Fig. 11 Schematic diagram of the quantum autoencoder implementa- |ψi  into a subsystem of two qubits so that one can recover |ψi  from tion. We first employ VAns to learn the circuits that prepare the ground the reduced states. The performance of the autoencoder can be quanti- states {|ψi } of the H2 molecule for different bond lengths. These ground fied by computing the compression and decompression fidelities, i.e., states are then used to create a training set and test set for the quantum the fidelity between the input state and the output state to the encod- autoencoder implementation. The goal of the autoencoder is to train ing/decoding circuit an encoding parametrized quantum circuit V (k, θ ) to compress each 123 43 Page 16 of 22 Quantum Machine Intelligence (2023) 5:43 function takes the form  N (n) C(k, θ ) = ||UQFT |ψ j  − V (k, θ )|ψ j ||2 . (13) j=1 Note that the cost function introduced in Eq. 13 becomes (n) equivalent to a more standard one, C  (k, θ ) = ||UQFT − V (k, θ )||2 , when N = 2n . While C(k, θ ) measures the dis- tance between the exact output of QFT and the one returned by V (k, θ ) only on selected input states, C  (k, θ ) measures (n) the discrepancy between full unitaries UQFT and V (k, θ ). It has recently been shown (Caro et al. 2022) that N  2n (n) is sufficient to accurately decompose UQFT . More precisely, a constant number of training states N (independent of n) can be used to ensure small value of C  (k, θ ), while minimiz- ing the cost function in Eq. 13. This observation provides an exponential speedup in evaluating the cost function for Fig. 12 Results of using VAns to train a quantum autoencoder. Here, unitary compilation. Indeed, the cost of evaluating C(k, θ ) we use VAns to train an encoding parametrized quantum circuit by min- in Eq. 13 is N · 2n (assuming the circuit V (k, θ ) consists of (n) imizing Eq. 11 on a training set comprised of six ground states of the few body gates and the states UQFT |ψ j  are given in compu- hydrogen molecule. We here also show the lowest cost function obtained tational basis), while the cost of computing C  (k, θ ) is 4n . for a HEA of 4 and 15 layers. Top panel: the cost function evaluated at both versus accepted VAns circuit modifications. In addition, we also The number of training states N which lead to small value show results of evaluating the cost on the testing set. Bottom panel: num- of C  (k, θ ) depends on the number of independent variational ber of CNOTs, and number of trainable parameters versus the number parameters in V (k, θ ). Suboptimal decompositions V (k, θ ) of modifications of the ansatz accepted in the VAns algorithm. Here, (in terms of number of parametrized gates) will require larger we additionally show the number of CNOTs (solid line) and parame- ters (dashed line) in the HEA ansatzes considered. We remark that for N to achieve good compilation accuracy. We have used N = L = 15, the HEA has 180 parameters, and hence the curve is not shown 15 for n = 10 qubit compilation with VAns, and a much as it would be off the scale larger training set in an approach that uses HEA; the increase in N is necessary since the latter approach needed a much deeper circuit, as discussed below. task very important in the near term. Indeed, one wants to We have used most general two-qubit gates as the building decompose a given unitary using as few gates as possible to block in VAns and to construct HEA. This is a slight gener- maximally reduce the effect of noise. In this section, we show alization to the Insertion and Simplification steps that VAns is capable of finding very short decompositions as in the VAns algorithm discussed above. General two-qubit compared with other techniques. gates can be decomposed down to CNOTs and one-qubit We will illustrate our approach by compiling Quantum rotations using standard methods. Fourier Transform (QFT) on systems up to n = 10 qubits. The method based on HEA requires very deep circuits Apart from VAns, we also compile the QFT unitary using (at n = 10). They consists of so many gates that the regular standard HEA and compare the performance of both meth- optimization has very small success probability. We therefore ods. modify the method based on HEA and utilize the recursive (n) The cost function for unitary compilation is defined as structure of UQFT . In the modified approach, we use HEA to follows. First, a training set is selected (n−1) (n) compile UQFT and then use it to create an ansatz for UQFT . The ansatz for larger system size additionally consists of  (n)  { |ψ j , UQFT |ψ j  } Nj=1 , (12) several layers of HEA. We apply the above growth technique starting from n = 3 to eventually build the ansatz for n = 10. We stress that VAns does not require such simplification and (n) where UQFT is a target QFT unitary on n qubits and |ψ j  are is capable of finding the decomposition with high success N , randomly selected input states. We assume that the states probability directly at n = 10 while initialized randomly. |ψ j  are pairwise orthogonal to avoid potential optimization Figure 13 shows VAns results for n = 10 qubit QFT problems caused by similarities in the training set. The cost compilation. Panel (a) depicts how the value of the cost func- 123 Quantum Machine Intelligence (2023) 5:43 Page 17 of 22 43 Fig. 13 Results of using VAns for unitary compilation. Here, we use VAns to find a decomposition of QFT unitary defined on n = 10 qubits, by minimizing a cost function C(k, θ) (red line in panel a) defined in Eq. (13). The cost evaluates a difference between exact output of QFT and the one returned by a current circuit, on a small number of input states only (N = 15). The blue line shows corresponding difference between full unitaries, (n) C  (k, θ) = ||UQFT − V (k, θ)||2 . We observe a high correlation between those two cost functions. Panel b shows how VAns modifies the number of two-qubit gates as it approaches the minimum of C(k, θ). The minimum is found with 48 gates, which is ∼ 4.5 times less than the decomposition found with HEA (not shown) tion C(k, θ ) is minimized over the iterations. We also show 4.6 Noisy simulations (n) the corresponding value of C  (k, θ ) = ||UQFT − V (k, θ )||2 . We observe strong correlation between both cost functions. The results previously shown were obtained without consid- C  (k, θ ) is eventually minimized below 10−9 at the end of the ering hardware noise. We observed that VAns was able to optimization. Panel (b) shows how the number of two-qubit better exploit the quantum resources at hand (i.e., attain a gates evolves as VAns optimization is performed. Excluding lower cost-function value) as compared to its fix-structure the initial “warm-up” period, during which the cost function counterpart (e.g., HEA). has very large (close to maximal possible) value, the number We now consider the case where noisy channels are of two-qubit gates is steadily grown reaching 48 at the end present in the quantum circuit, an unavoidable situation of the optimization. in current experimental setups, with noise essentially for- The approach based on HEA requires 219 general two- bidding large-depth quantum circuits to preserve quantum qubit gates to decompose n = 10 QFT, which is over 4 coherence. In the context of VQAs, the overall effect of times more than the best circuit found by VAns. The HEA noise is that of degrading the cost-function value and, if its approach uses recursive structure of QFT to find accurate strength is sufficiently high, then short-depth circuits turn to decomposition, while VAns does not rely on that property be favored even at the cost of expressibility. For instance, and finds a solution in fewer number of iterations. Finally, increasing the number of layers in HEA ansatz might not VAns takes advantage of the generalization bound (Caro et al. reduce the cost function and even increase it, since noise 2022), finding solution with near optimal number of varia- accumulates due to the presence of gates. tional parameters in V (k, θ ); the training set size N required There are several sources of noise in quantum comput- for small generalization error is small resulting in fast cost ers. For instance, experimental implementation of a quantum function evaluations. gate takes a finite amount of time, which in turn depends on 123 43 Page 18 of 22 Quantum Machine Intelligence (2023) 5:43 the physical qubit at hand, the latter subjected to thermal matically balance the trade-offs at hand, i.e., minimize the relaxation errors. Relaxation and dephasing errors depend, number of gates acting on such noisier qubits. in general, on each particular qubit (i.e., the qubit label). The With this model at hand, we have explored the region overall effect of the gate implementation is often modeled by of λ in which the action of the noise becomes interesting. a depolarizing quantum channel, followed by phase flips and The results of running VAns under the λ-model for ground amplitude damping channels, whose strength depends on the state preparation (VQE) of TFIM 8-qubit system are shown aforementioned parameters (gate implementation time, qubit in Fig. 14. Here, the noise strength is sufficiently high so label), gate type and environment temperature. For instance, to affect the ground-state energy (which can otherwise be an entangling gate such as a CNOT injects considerably more attained by either VAns or a 3-layered HEA). We thus sweep noise to the circuit than a single-qubit rotation. Moreover, the value of λ by two orders of magnitude, and compare the state preparation and readout errors should be taken into results that VAns reaches with those of HEA (varying the account. We refer the reader to find further details on noise number of layers of the latter). We see that for a sufficiently modeling in Ref. Georgopoulos et al. (2021). We also note high noise strength, increasing the number of gates (e.g., that additional sources of noise should ultimately be consid- the number of layers in HEA) eventually degrades the cost- ered, such as idle noise and cross-talk effects (LaRose et al. function value, as opposed to the noise-less scenario. On 2022; Murali et al. 2020). Because the complexity of noise the contrary, we observe that even if the noise-strenght is modelling in NISQ devices is particularly high, we here pro- sufficiently high, VAns considerably outperforms HEA by pose a sufficiently simple model that yet captures the essential automatically adjusting the depth of the circuit to the noise- noise sources. strength at hand. Thus, if the noise is large, shallow circuits The λ-model While a noise-model is ultimately linked to the specific quantum hardware at hand and depends on sev- eral factors, we propose a unifying and simplified one that depends on a single parameter. The main motivation behind this is that of benchmarking the performance of different ansatzes in the presence of noise. In more complex scenar- ios, one should consider specific process matrices obtained from, e.g., process tomography (O’Brien et al. 2004; Yuen- Zhou et al. 2014), which would here obscure the benchmark and also bias it towards specific quantum hardware. In par- ticular, our model is inspired by Refs Blank et al. (2020); Georgopoulos et al. (2021), which in turn are implemented in the aer noise simulator of IBM, and consists of the fol- lowing models. State preparation and measurement errors are modeled via bit flip channels acting on each qubit, with strength λ 10−2 , happening before the circuit U (k, θ ) and measurements respectively. Noise due to gate implementa- tion is modeled as a depolarizing channel, followed by a phase flip and amplitude damping channels acting on the tar- get qubit right after the gate. In principle, the strength of the channel should depend on the specific qubit, and gate type, but in order to keep the model simple enough we have Fig. 14 Results of using VAns for VQE under the λ-model. Here, we consider the TFIM for 8 qubits, with g = J = 1. The results are assumed no noise dependence on the qubit label. Moreover, obtained after repeating 50 iterations of optimizations with VAns and a two-qubit gate is considerably more noisy than a single- HEA respectively. We observe that VAns discovers much more efficient qubit one, which in the λ-model is reflected by the fact that quantum circuits as compared to HEA. As shown in the upper inset, noise strengths are an order of magnitude higher, in the depo- VAns automatically adjusts the circuit layout according to the noise strength at hand, a feature that fix-structure ansatzes lack. In the lower larizing channel, than in single-qubit gates, the latter being inset, we show the relative errors (e.g., standard deviation over optimal λ 10−5 . Finally, the strengths of the phase flip and amplitude cost found) for both ansatzes, across the 50 iterations; we observe that damping channels are set to λ 10−3 . We note that, while not VAns is more precise in reaching a minimum as compared to HEA. We considered here, different situations can easily be incorpo- note that in this experiment, we have initialized VAns to a 1-layered HEA, which is in turn inconvenient for a sufficiently high value of λ. rated such as qubit connectivity constraints, or differences in Yet, VAns learns how to adapt the ansatz (in this case, finding a separable qubits’ quality (some qubits might be noisier than others). one) so to reach the lowest cost value. In all cases VAns termination In such cases, we expect VAns to find circuits which auto- criteria was set to a maximum number of 30 iterations 123 Quantum Machine Intelligence (2023) 5:43 Page 19 of 22 43 are found, whereas if the noise-strength is low, deeper circuits VAns notably outperforms HEA under ground-state prepa- are allowed to be explored, since the penalty of adding new ration tasks. gates is smaller. In general, we observe that VAns is capable While we provided the basic elements and structure of of finding the best possible circuit under given conditions, VAns (i.e., the gate Insertion and gate Simplifi- which is something that HEA simply can not accomplish. cation rules), these should be considered as blueprints for variable ansatzes that can be adapted and tailored to more specific applications. For instance, the gates that VAns inserts can preserve a specific symmetry in the problem. 5 Discussion Moreover, one can cast the VAns architecture optimiza- tion (e.g., removing unimportant gates) in more advanced In this work, we have introduced the VAns algorithm, a semi- learning frameworks. Examples of such frameworks include agnostic method for building variable structure parametrized supervised learning or reinforced learning schemes, which quantum circuits. We expect VAns to be especially useful for could potentially be employed to detect which gates are the abstract applications, such as linear systems (Bravo-Prieto best candidates for being removed. et al. 2019; Huang et al. 2019; Xu et al. 2021), factor- Acknowledgements Some of the simulations presented in this paper ing (Anschuetz et al. 2019), compiling (Khatri et al. 2019; were done using Sandbox@Alphabet’s TPU-based Floq simulator. Sharma et al. 2020), metrology (Beckey et al. 2022; Koczor MB is thankful to Josep Flix, John Calsamiglia Costa and Carles et al. 2020), and data science (Abbas et al. 2021; Biamonte Acosta for their kindness in facilitating computational resources at Port et al. 2017; Cerezo et al. 2022; LaRose et al. 2019; Schuld d’Informació Científica, Barcelona. MB acknowledges support from the U.S. Department of Energy (DOE) through a quantum computing et al. 2014; Verdon et al. 2019b), where physically moti- program sponsored by the Los Alamos National Laboratory (LANL) vated ansatzes are not readily available. In addition, VAns Information Science & Technology Institute, and support from the will likely find use even for physical applications such as Spanish Agencia Estatal de Investigación, project PID2019-107609GB- finding grounds states of molecular and condensed matter I00, Generalitat de Catalunya CIRIT 2017-SGR-1127. MC was initially supported by the Laboratory Directed Research and Development systems, as it provides a shorter depth alternative to physi- (LDRD) program of LANL under project number 20180628ECR, and cally motivated ansatzes for mitigating the impact of noise, also supported by the Center for Nonlinear Studies at LANL. PJC as shown in our noisy simulations. acknowledges initial support from the LANL ASC Beyond Moore’s At each iteration of the optimization, VAns stochasti- Law project. LC was initially supported by the LDRD program of LANL under project number 20200056DR. PJC and LC were also supported cally grows the circuit to explore the architecture hyperspace. by the U.S. Department of Energy (DOE), Office of Science, Office More crucially, VAns also compresses and simplifies the cir- of Advanced Scientific Computing Research, under the Accelerated cuit by removing redundant gates and unimportant gates. This Research in Quantum Computing (ARQC) program. is a key aspect of our method, as it differentiates VAns from Author contribution All authors contributed equally to this work. other variable ansatz alternatives and allows us to produce short-depth circuits, which can mitigate the effect of noise- Funding Open Access Funding provided by Universitat Autonoma de induced barren plateaus (NIBPs). We will further investigate Barcelona. this mitigation of NIBPs in future work. Data availability Data supporting the claims made in this work is avail- To showcase the performance of VAns, we simulated able upon reasonable request. our algorithm for several paradigmatic problems in VQAs. Namely, we implemented VAns to find ground states of con- Declarations densed matter systems and molecular Hamiltonians, for a quantum autoencoder problem and for 10-qubit QFT com- pilation. In all cases, VAns was able to satisfactory create Conflict of interest The authors declare no competing interests. circuits that optimize the cost. Moreover, as expected, these Open Access This article is licensed under a Creative Commons optimal circuits contain a small number of trainable parame- Attribution 4.0 International License, which permits use, sharing, adap- ters and entangling gates. Here, we also compared the results tation, distribution and reproduction in any medium or format, as of VAns with results obtained using a Hardware Efficient long as you give appropriate credit to the original author(s) and the Ansatz with either the same number of entangling gates, or source, provide a link to the Creative Commons licence, and indi- cate if changes were made. The images or other third party material the same number of parameters, and in all cases, we found in this article are included in the article’s Creative Commons licence, that VAns could achieve the best performance. This point unless indicated otherwise in a credit line to the material. If material is crucial for the success of VAns in the presence of noisy is not included in the article’s Creative Commons licence and your channels, as it automatically adapts the circuit layout to the intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copy- situation at hand (e.g., noise strength). For instance, under the right holder. To view a copy of this licence, visit http://creativecomm λ-model (which is the noise model we have implemented), ons.org/licenses/by/4.0/. 123 43 Page 20 of 22 Quantum Machine Intelligence (2023) 5:43 References Cerezo M, Arrasmith A, Babbush R et al (2021) Variational quan- tum algorithms. Nat Rev Phys 3(1):625–644. https://doi.org/ Abbas A, Sutter D, Zoufal C et al (2021) The power of quantum neural 10.1038/s42254-021-00348-9. https://www.nature.com/articles/ networks. Nat Comput Sci 1(6):403–409. https://doi.org/10.1038/ s42254-021-00348-9 s43588-021-00084-1 Cerezo M, Coles PJ (2021) Higher order derivatives of quantum Anschuetz E, Olson J, Aspuru-Guzik A et al (2019) Variational quantum neural networks with barren plateaus. Quantum Sci Technol factoring. In: International workshop on quantum technology and 6(2):035006. https://doi.org/10.1088/2058-9565/abf51a. https:// optimization problems. Springer, pp 74–85.https://link.springer. iopscience.iop.org/article/10.1088/2058-9565/abf51a com/chapter/10.1007/978-3-030-14082-3_7 Cerezo M, Rossignoli R, Canosa N et al (2017) Factorization and Arrasmith A, Cerezo M, Czarnik P et al (2021) Effect of barren plateaus criticality in finite x x z systems of arbitrary spin. Phys Rev on gradient-free optimization. Quantum 5:558. https://doi.org/10. Lett 119(22):220605. https://doi.org/10.1103/PhysRevLett. 22331/q-2021-10-05-558. https://quantum-journal.org/papers/q- 119.220605. https://journals.aps.org/prl/abstract/10.1103/ 2021-10-05-558/ PhysRevLett.119.220605 Arrasmith A, Cincio L, Somma RD et al (2020) Operator sam- Cerezo M, Sone A, Volkoff T et al (2021) Cost function depen- pling for shot-frugal optimization in variational algorithms. dent barren plateaus in shallow parametrized quantum circuits. arXiv:2004.06252 Nat Commun 12(1):1–12. https://doi.org/10.1038/s41467-021- Arute F, Arya K, Babbush R et al (2020) Hartree-fock on a super- 21728-w. https://www.nature.com/articles/s41467-021-21728-w conducting qubit quantum computer. Science 369(6507):1084– Cervera-Lierta A, Kottmann JS, Aspuru-Guzik A (2020) The meta- 1089. https://doi.org/10.1126/science.abb9811. https://science. variational quantum eigensolver (meta-vqe): learning energy sciencemag.org/content/369/6507/1084 profiles of parameterized hamiltonians for quantum simulation. Aspuru-Guzik A, Dutoi AD, Love PJ et al (2005) Simulated quantum arXiv:2009.13545 computation of molecular energies. Science 309(5741):1704– Chivilikhin D, Samarin A, Ulyantsev V et al (2020) Mog-vqe: multiob- 1707. https://doi.org/10.1126/science.1113479. https://science. jective genetic variational quantum eigensolver. arXiv:2007.04424 sciencemag.org/content/309/5741/1704 Cincio L, Subaşı Y, Sornborger AT et al (2018) Learning the quantum Bartlett RJ, Musiał M (2007) Coupled-cluster theory in quantum algorithm for state overlap. New J Phys 20(11):113022. https:// chemistry. Rev Mod Phys 79(1):291. https://journals.aps.org/rmp/ doi.org/10.1088/1367-2630/aae94a abstract/10.1103/RevModPhys.79.291 Cincio L, Rudinger K, Sarovar M et al (2021) Machine learning of noise- Beckey JL, Cerezo M, Sone A et al (2022) Variational quan- resilient quantum circuits. PRX Quantum 2:010324. https://doi. tum algorithm for estimating the quantum Fisher infor- org/10.1103/PRXQuantum.2.010324. https://link.aps.org/doi/10. mation. Phys Rev Res 4(1):013083. https://doi.org/10.1103/ 1103/PRXQuantum.2.010324 PhysRevResearch.4.013083. https://journals.aps.org/prresearch/ Cirstoiu C, Holmes Z, Iosue J et al (2020) Variational fast forwarding for abstract/10.1103/PhysRevResearch.4.013083 quantum simulation beyond the coherence time. npj Quantum Inf Bharti K, Cervera-Lierta A, Kyaw TH et al (2022) Noisy intermediate- 6(1):1–10. https://doi.org/10.1038/s41534-020-00302-0. https:// scale quantum algorithms. Rev Mod Phys 94(1):015004. https:// www.nature.com/articles/s41534-020-00302-0 doi.org/10.1103/RevModPhys.94.015004. https://journals.aps. Claudino D, Wright J, McCaskey AJ et al (2020) Benchmark- org/rmp/abstract/10.1103/RevModPhys.94.015004 ing adaptive variational quantum eigensolvers. Front Chem Bharti K, Haug T (2021) Quantum-assisted simulator. Phys 8:1152. https://doi.org/10.3389/fchem.2020.606863. https:// Rev A 104(4):042418. https://doi.org/10.1103/PhysRevA.104. www.frontiersin.org/articles/10.3389/fchem.2020.606863/full 042418. https://journals.aps.org/pra/abstract/10.1103/PhysRevA. Commeau B, Cerezo M, Holmes Z et al (2020) Variational 104.042418 hamiltonian diagonalization for dynamical quantum simulation. Biamonte J, Wittek P, Pancotti N et al (2017) Quantum machine arXiv:2009.02559 learning. Nature 549(7671):195–202. https://doi.org/10.1038/ Dankert C, Cleve R, Emerson J et al (2009) Exact and approxi- nature23474. https://www.nature.com/articles/nature23474 mate unitary 2-designs and their application to fidelity estimation. Blank C, Park DK, Rhee JKK et al (2020) Quantum classifier with Phys Rev A 80(1):012304. https://journals.aps.org/pra/abstract/ tailored quantum kernel. npj Quantum Inf 6(1):41. https://doi.org/ 10.1103/PhysRevA.80.012304 10.1038/s41534-020-0272-6 Du Y, Huang T, You S et al (2020) Quantum circuit architecture search: Brandao FG, Harrow AW, Horodecki M (2016) Local random quan- error mitigation and trainability enhancement for variational quan- tum circuits are approximate polynomial-designs. Commun Math tum solvers. arXiv:2010.10217 Phys 346(2):397–434. https://doi.org/10.1007/s00220-016-2706- Elsken T, Metzen JH, Hutter F et al (2019) Neural architecture search: a 8. https://link.springer.com/article/10.1007s00220-016-2706-8 survey. J Mach Learn Res 20(55):1–21. https://lilianweng.github. Bravo-Prieto C, LaRose R, Cerezo M et al (2019) Variational quantum io/lil-log/2020/08/06/neural-architecture-search.html linear solver. arXiv:1909.05820 Farhi E, Goldstone J, Gutmann S (2014) A quantum approximate opti- Broughton M, Verdon G, McCourt T et al (2020) Tensorflow quan- mization algorithm. arXiv:1411.4028 tum: a software framework for quantum machine learning. Fontana E, Cerezo M, Arrasmith A et al (2020) Optimizing parametrized arXiv:2003.02989 quantum circuits via noise-induced breaking of symmetries. Cao Y, Romero J, Olson JP et al (2019) Quantum chemistry in the age arXiv:2011.08763 of quantum computing. Chem Rev 119(19):10856–10915. https:// Gard BT, Zhu L, Barron GS et al (2020) Efficient symmetry-preserving pubs.acs.org/doi/10.1021/acs.chemrev.8b00803 state preparation circuits for the variational quantum eigensolver Caro MC, Huang HY, Cerezo M et al (2022) Generalization in quantum algorithm. npj Quantum Inf 6(1):1–9. https://doi.org/10.1038/ machine learning from few training data. Nat Commun 13:4919. s41534-019-0240-1. https://www.nature.com/articles/s41534- https://doi.org/10.1038/s41467-022-32550-3 019-0240-1 Cerezo M, Sharma K, Arrasmith A et al (2022) Variational quantum Georgopoulos K, Emary C, Zuliani P (2021) Modeling and sim- state eigensolver. npj Quantum Inf 8(1):1–11. https://doi.org/10. ulating the noisy behavior of near-term quantum computers. 1038/s41534-022-00611-6 Phys Rev A 104:062432. https://doi.org/10.1103/PhysRevA.104. 062432. https://link.aps.org/doi/10.1103/PhysRevA.104.062432 123 Quantum Machine Intelligence (2023) 5:43 Page 21 of 22 43 Gibbs J, Gili K, Holmes Z et al (2021) Long-time simulations with high tum 4:263. https://doi.org/10.22331/q-2020-05-11-263. https:// fidelity on quantum hardware. arXiv:2102.04313 quantum-journal.org/papers/q-2020-05-11-263/ Grant E, Wossnig L, Ostaszewski M et al (2019) An initialization Larocca M, Czarnik P, Sharma K et al. (2022) Diagnosing barren strategy for addressing barren plateaus in parametrized quantum plateaus with tools from quantum optimal control. Quantum 6:824. circuits. Quantum 3:214. https://doi.org/10.22331/q-2019-12-09- https://doi.org/10.22331/q-2022-09-29-824 214. https://quantum-journal.org/papers/q-2019-12-09-214/ LaRose R, Mari A, Russo V et al (2022) Error mitigation Grimsley HR, Economou SE, Barnes E et al (2019) An adap- increases the effective quantum volume of quantum computers. tive variational algorithm for exact molecular simulations on arXiv:2203.05489 a quantum computer. Nat Commun 10(1):1–9. https://doi.org/ LaRose R, Tikku A, O’Neel-Judy É et al (2019) Variational 10.1038/s41467-019-10988-2. https://www.nature.com/articles/ quantum state diagonalization. npj Quantum Inf 5(1):1–10. s41467-019-10988-2 https://doi.org/10.1038/s41534-019-0167-6. https://www.nature. Hadfield S, Wang Z, O’Gorman B et al (2019) From the quantum com/articles/s41534-019-0167-6 approximate optimization algorithm to a quantum alternating Liu X, Angone A, Shaydulin R et al (2021) Layer vqe: a variational operator ansatz. Algorithms 12(2):34. https://doi.org/10.3390/ approach for combinatorial optimization on noisy quantum com- a12020034. https://www.mdpi.com/1999-4893/12/2/34 puters. arXiv:2102.05566 Haferkamp J (2022) Random  quantum circuits are approximate unitary Liu H, Simonyan K, Yang Y (2018) Darts: differentiable architecture t-designs in depth O nt 5+o(1) . Quantum 6:795. https://doi.org/ search. arXiv:1806.09055 10.22331/q-2022-09-08-795 Marrero CO, Kieferová M, Wiebe N (2021) Entanglement-induced Harrigan MP, Sung KJ, Neeley M et al (2021) Quantum approx- barren plateaus. PRX. Quantum 2(4):040316. https://doi.org/ imate optimization of non-planar graph problems on a pla- 10.1103/PRXQuantum.2.040316. https://journals.aps.org/ nar superconducting processor. Nat Phys 1–5. https://doi.org/ prxquantum/abstract/10.1103/PRXQuantum.2.040316 10.1038/s41567-020-01105-y. https://www.nature.com/articles/ Maslov D, Dueck GW, Miller DM et al (2008) Quantum circuit s41567-020-01105-y simplification and level compaction. IEEE Trans Comput-Aided Harrow AW, Low RA (2009) Random quantum circuits are Des Integ Circuits Syst 27(3):436–444. https://doi.org/10.1109/ approximate 2-designs. Commun Math Phys 291(1):257–302. TCAD.2007.911334 https://doi.org/10.1007/s00220-009-0873-6. https://link.springer. McArdle S, Endo S, Aspuru-Guzik A et al (2020) Quantum compu- com/article/10.1007s00220-009-0873-6 tational chemistry. Rev Mod Phys 92(1):015003. https://doi.org/ Harrow A, Mehraban S (2018) Approximate unitary t-designs by short 10.1103/RevModPhys.92.015003. https://journals.aps.org/rmp/ random quantum circuits using nearest-neighbor and long-range abstract/10.1103/RevModPhys.92.015003 gates. arXiv:1809.06957 McClean JR, Boixo S, Smelyanskiy VN et al (2018) Barren plateaus Hastings WK (1970) Monte Carlo sampling methods using Markov in quantum neural network training landscapes. Nat Com- chains and their applications. Biometrika 57(1):97–109. https:// mun 1:1–6. https://doi.org/10.1038/s41467-018-07090-4. https:// doi.org/10.2307/2334940. http://www.jstor.org/stable/2334940 www.nature.com/articles/s41467-018-07090-4 Holmes Z, Arrasmith A, Yan B et al (2021) Barren plateaus preclude McClean JR, Sung KJ, Kivlichan ID et al (2019) Openfermion: learning scramblers. Phys Rev Lett 126(19):190501. https://doi. the electronic structure package for quantum computers. org/10.1103/PhysRevLett.126.190501. https://journals.aps.org/ arXiv:1710.07629 prl/abstract/10.1103/PhysRevLett.126.190501 Murali P, Mckay DC, Martonosi M et al (2020) Software mitiga- Holmes Z, Sharma K, Cerezo M et al (2022) Connecting ansatz express- tion of crosstalk on noisy intermediate-scale quantum computers. ibility to gradient magnitudes and barren plateaus. PRX Quan- In: Proceedings of the twenty-fifth international conference on tum 3:010313. https://doi.org/10.1103/PRXQuantum.3.010313. architectural support for programming languages and operat- https://link.aps.org/doi/10.1103/PRXQuantum.3.010313 ing systems. Association for Computing Machinery, New York, Huang HY, Bharti K, Rebentrost P (2019) Near-term quantum algo- NY, USA, ASPLOS ’20, pp 1001-1016. https://doi.org/10.1145/ rithms for linear systems of equations. arXiv:1909.07344 3373376.3378477 Huang HY, Kueng R, Preskill J (2020) Predicting many properties Nakanishi KM, Fujii K, Todo S (2020) Sequential minimal opti- of a quantum system from very few measurements. Nat Phys mization for quantum-classical hybrid algorithms. Phys Rev 16(10):1050–1057. https://doi.org/10.1038/s41567-020-0932-7. Res 2(4):043158. https://doi.org/10.1103/PhysRevResearch.2. https://www.nature.com/articles/s41567-020-0932-7 043158. https://journals.aps.org/prresearch/abstract/10.1103/ Kandala A, Mezzacapo A, Temme K et al (2017) Hardware-efficient PhysRevResearch.2.043158 variational quantum eigensolver for small molecules and quantum O’Brien JL, Pryde GJ, Gilchrist A et al (2004) Quantum process magnets. Nature 549(7671):242–246. https://doi.org/10.1038/ tomography of a controlled-not gate. Phys Rev Lett 93:080502. nature23879 https://doi.org/10.1103/PhysRevLett.93.080502. https://link.aps. Khatri S, LaRose R, Poremba A et al. (2019) Quantum-assisted quantum org/doi/10.1103/PhysRevLett.93.080502 compiling. Quantum 3:140. https://doi.org/10.22331/q-2019-05- Ollitrault PJ, Kandala A, Chen CF et al (2020) Quantum equation of 13-140 https://quantum-journal.org/papers/q-2019-05-13-140/ motion for computing molecular excitation energies on a noisy Kingma DP, Ba J (2015) Adam: a method for stochastic optimization. quantum processor. Phys Rev Res 2(4):043140. https://doi.org/ In: Proceedings of the 3rd international conference on learning 10.1103/PhysRevResearch.2.043140. https://journals.aps.org/ representations (ICLR). arXiv:1412.6980 prresearch/abstract/10.1103/PhysRevResearch.2.043140 Koczor B, Benjamin SC (2019) Quantum natural gradient generalised Ostaszewski M, Grant E, Benedetti M (2021) Structure optimization to non-unitary circuits. arXiv:1912.08660 for parameterized quantum circuits. Quantum 5:391. https://doi. Koczor B, Endo S, Jones T et al (2020) Variational-state quantum org/10.22331/q-2021-01-28-391. https://quantum-journal.org/ metrology. New J Phys. https://doi.org/10.1088/1367-2630/ papers/q-2021-01-28-391/ ab965e. https://iopscience.iop.org/article/10.1088/1367-2630/ Patti TL, Najafi K, Gao X et al (2021) Entanglement devised barren ab965e plateau mitigation. Phys Rev Res 3(3):033090. https://doi.org/ Kübler JM, Arrasmith A, Cincio L et al (2020) An adaptive 10.1103/PhysRevResearch.3.033090. https://par.nsf.gov/servlets/ optimizer for measurement-frugal variational algorithms. Quan- purl/10328786 123 43 Page 22 of 22 Quantum Machine Intelligence (2023) 5:43 Peruzzo A, McClean J, Shadbolt P et al (2014) A variational Thanasilp S, Wang S, Nghiem NA et al (2021) Subtleties in the train- eigenvalue solver on a photonic quantum processor. Nat ability of quantum machine learning models. arXiv:2110.14753 Commun 5(1):1–7. https://doi.org/10.1038/ncomms5213. https:// Tkachenko NV, Sud J, Zhang Y et al (2021) Correlation-informed www.nature.com/articles/ncomms5213#citeas permutation of qubits for reducing ansatz depth in vqe. PRX Pesah A, Cerezo M, Wang S et al (2021) Absence of bar- Quantum 2(2):020337. https://doi.org/10.1103/PRXQuantum. ren plateaus in quantum convolutional neural networks. 2.020337. https://journals.aps.org/prxquantum/abstract/10.1103/ Phys Rev X 11(4):041011. https://doi.org/10.1103/PhysRevX.11. PRXQuantum.2.020337 041011. https://journals.aps.org/prx/abstract/10.1103/PhysRevX. Verdon G, Broughton M, McClean JR et al (2019a) Learning to 11.041011 learn with quantum neural networks via classical neural networks. Pirhooshyaran M, Terlaky T (2020) Quantum circuit design search. arXiv:1907.05415 arXiv:2012.04046 Verdon G, Marks J, Nanda S et al (2019b) Quantum Hamiltonian-based Preskill J (2018) Quantum computing in the nisq era and beyond. Quan- models and the variational quantum thermalizer algorithm. arXiv tum 2:79. https://doi.org/10.22331/q-2018-08-06-79. https:// preprint arXiv:1910.02071 quantum-journal.org/papers/q-2018-08-06-79/ Verdon G, Pye J, Broughton M (2018) A universal training algorithm Rattew AG, Hu S, Pistoia M et al (2019) A domain-agnostic, noise- for quantum deep learning. arXiv:1806.09729 resistant, hardware-efficient evolutionary variational quantum Volkoff T, Coles PJ (2021) Large gradients via correlation in ran- eigensolver. arXiv:1910.09694 dom parameterized quantum circuits. Quantum Sci Technol Romero J, Olson JP, Aspuru-Guzik A (2017) Quantum autoencoders 6(2):025008. https://doi.org/10.1088/2058-9565/abd89. https:// for efficient compression of quantum data. Quantum Sci Technol iopscience.iop.org/article/10.1088/2058-9565/abd891 2(4):045001. https://doi.org/10.1088/2058-9565/aa8072.https:// Wang S, Fontana E, Cerezo M et al (2021) Noise-induced barren iopscience.iop.org/article/10.1088/2058-9565/aa8072 plateaus in variational quantum algorithms. Nat Commun 12(1):1– Sack SH, Medina RA, Michailidis AA et al (2022) Avoiding barren 11. https://doi.org/10.1038/s41467-021-27045-6. https://www. plateaus using classical shadows. PRX Quantum 3(2):020365. nature.com/articles/s41467-021-27045-6 https://doi.org/10.1103/PRXQuantum.3.020365. https://journals. Xu X, Sun J, Endo S et al (2021) Variational algorithms for lin- aps.org/prxquantum/abstract/10.1103/PRXQuantum.3.020365 ear algebra. Sci Bull 66(21):2181–2188. https://doi.org/10.1016/j. Schuld M, Sinayskiy I, Petruccione F (2014) The quest for a quantum scib.2021.06.023. https://www.sciencedirect.com/science/article/ neural network. Quantum Inf Process 13(11):2567–2586. https:// pii/S2095927321004631 doi.org/10.1007/s11128-014-0809-8 Younis E, Cincio L (2020) Quantum fast circuit optimizer (qFactor). Sharma K, Cerezo M, Cincio L et al (2022) Trainability of dis- https://github.com/BQSKit/qfactor sipative perceptron-based quantum neural networks. Phys Rev Yuan X, Endo S, Zhao Q et al (2019) Theory of variational quantum Lett 128(18):180505. https://doi.org/10.1103/PhysRevLett.128. simulation. Quantum 3:191. https://doi.org/10.22331/q-2019-10- 180505 07-191. https://quantum-journal.org/papers/q-2019-10-07-191/ Sharma K, Khatri S, Cerezo M et al (2020) Noise resilience of vari- Yuen-Zhou J, Krich JJ, Kassal I et al (2014) The process matrix and ational quantum compiling. New J Phys 22(4):043006. https:// how to determine it: quantum process tomography. In: Ultrafast doi.org/10.1088/1367-2630/ab784c. https://iopscience.iop.org/ spectroscopy. 2053-2563, IOP Publishing, pp 1–1 to 1–9. https:// article/10.1088/1367-2630/ab784c doi.org/10.1088/978-0-750-31062-8ch1 Sim S, Romero J, Gonthier JF et al (2021) Adaptive pruning-based opti- Zhang SX, Hsieh CY, Zhang S et al (2020b) Differentiable quantum mization of parameterized quantum circuits. Quantum Sci Technol architecture search. arXiv:2010.08561 6(2):025019. https://doi.org/10.1088/2058-9565/abe107 Zhang ZJ, Kyaw TH, Kottmann J et al (2021) Mutual information- Sim S, Johnson PD, Aspuru-Guzik A (2019) Expressibility and assisted adaptive variational quantum eigensolver. Quantum entangling capability of parameterized quantum circuits for Sci Technol. https://doi.org/10.1088/2058-9565/abdca4. https:// hybrid quantum-classical algorithms. Adv Quantum Technol iopscience.iop.org/article/10.1088/2058-9565/abdca4 2(12):1900070. https://doi.org/10.1002/qute.201900070. https:// Zhang K, Hsieh MH, Liu L et al (2020a) Toward trainability of quantum onlinelibrary.wiley.com/doi/abs/10.1002/qute.201900070 neural networks. arXiv:2011.06258 Skolik A, McClean JR, Mohseni M et al (2021) Layerwise learning for Zhao C, Gao XS (2021) Analyzing the barren plateau phenomenon in quantum neural networks. Quantum Mach Intell 3(1):1–11. https:// training quantum neural networks with the ZX-calculus. Quantum doi.org/10.1007/s42484-020-00036-4 5:466. https://doi.org/10.22331/q-2021-06-04-466 Stilck França D, Garcia-Patron R (2021) Limitations of optimization algorithms on noisy quantum devices. Nat Phys 17(11):1221– 1227. https://doi.org/10.1038/s41567-021-01356-3 Publisher’s Note Springer Nature remains neutral with regard to juris- Stokes J, Izaac J, Killoran N et al (2020) Quantum natural gradi- dictional claims in published maps and institutional affiliations. ent. Quantum 4:269. https://doi.org/10.22331/q-2020-05-25-269. https://quantum-journal.org/papers/q-2020-05-25-269/ Tang HL, Shkolnikov V, Barron GS et al (2021) qubit-adapt-vqe: an adaptive algorithm for constructing hardware-efficient ansätze on a quantum processor. PRX Quantum 2(2):020310. https://doi.org/ 10.1103/PRXQuantum.2.020310 123