The present application relates to methods and systems for compressing quantum circuits.
Quantum technologies and quantum computing in particular are advancing in an unprecedented pace. As a result, the capabilities of quantum computers are constantly increasing wherein the first signs of “quantum supremacy” or “quantum advantage” hint that it might not take as long as originally thought to adopt them in a large scale. However, the current generation of quantum computers, often termed the Noisy Intermediate-Scale Quantum (NISQ) computers, suffer from various limitations which make them quite hard to exploit for useful applications across various domains such as finance, logistics, chemistry or material science. A key limitation is known as the (effective) depth of a quantum circuit. In the quantum circuit model, one applies a sequence of unitary transformations U on quantum states. The number of subsequent non-parallel applications of unitary transformations on (up to) two qubits at a time, is known as the depth of the circuit. The depth of the circuit is limited by the ratio of coherence time and gate time, as well as the fidelity of the two-qubit gates. The limit on the depth of a quantum circuit limits what algorithms can be implemented, and the quality of the output, despite the flourishing of various error mitigation techniques. While Fault Tolerant Error Corrected (FTEC) quantum computers will be more resilient to these limitations, one may envision that even there, it will be preferable to reduce the number of gates. Circuit transpiling techniques, which can reduce circuit depth, will be essential in both the NISQ and FTEC eras of quantum computing. The transpiling of quantum circuits starting from a potentially large gate set to a particular hardware-specific “native” gate set, can be quite challenging, especially in architectures with limited connectivity. Limited connectivity is another key limitation of the current quantum computers and several challenges must be overcome to fully exploit these powerful machines. Notice that, due to the limited connectivity, two-qubit gates often cannot be readily applied and the states of the corresponding qubits must be swapped with those of their neighbors until the states reside on qubits where a two qubit gate is supported. SWAP gates are, however, often expensive. For instance in CNOT-based native gate sets, they are often implemented using three CNOT gates. As a result, reducing the number of SWAP gates is desirable, but computing the minimum number of SWAP gates required in a given circuit is an NP-Hard problem. Most techniques for transpiling quantum circuits are multi-pass heuristics, rather than exact. First, an initial set of transformations is used to translate the quantum circuit to a “native” gate set. Second, a heuristic mapping of logical qubits to physical qubits is suggested. Third, standard “circuit compression” transformations are applied in a Knuth-Bendix fashion, as discussed e.g. in K. Iwama et al. “Transformation rules for designing cnot-based quantum circuits”, Proceedings 2002 Design Automation Conference (IEEE Cat. No.02CH37324) (2002) pp. 419-424. An alternative approach to circuit compression based on the Yang-Baxter equation is described in B. Peng et al. “Quantum time dynamics employing the Yang-Baxter equation for circuit compression”, Phys. Rev. A 106, 012412 (2022).
Embodiments of the invention aim to provide alternative approaches to circuit compression.
Aspects of the invention are set out in the independent claims. Certain preferred features are set out in the dependent claims.
Disclosed herein is a method of compressing a quantum circuit, comprising:
The non-local interaction preferably comprises a gate operating on non-adjacent qubits of the quantum circuit. The non-local interaction may be implemented (or implementable, e.g. would require implementation on the target quantum computer) using at least one SWAP gate. Thus, the input circuit may specify a non-local interaction that would ordinarily be implemented using one or more SWAP gates, or may specify the SWAP gates explicitly. For example, the circuit section may comprise at least one SWAP gate for implementing the non-local interaction, wherein the second arrangement does not include the at least one SWAP gate.
The described approach can enable circuit complexity to be reduced by eliminating expensive SWAP gates. Note that the term “SWAP gate” may refer to any gate serving to exchange the quantum states of two qubits.
Preferably, the first arrangement comprises one or more gates of a given gate type (e.g. in addition to any SWAP gates used to implement the non-local interaction). Determining whether the circuit section meets the compression criterion comprises determining whether the one or more gates meet a gate criterion, the gate criterion determining an equivalence between the first arrangement of quantum gates and the second arrangement of quantum gates. The equivalence is preferably defined by an equivalence equation, and determining whether the one or more gates meet the gate criterion comprises determining whether the one or more gates correspond to a solution of the equivalence equation. In particular, determining whether the one or more gates meet the gate criterion may comprise determining whether the one or more gates are fusion operators.
Preferably, determining whether the circuit section meets a compression criterion comprises determining whether the circuit section or the one or more gates correspond to a valid solution of a polygon equation, preferably the pentagon equation.
The compression criterion may comprise a predetermined set of evaluation criteria which may be associated with a set of gates in the first arrangement (and/or associated with a given gate type of the gates) and/or may be defined on parameters of the gates, the method comprising determining whether the parameters of the gates in the received circuit definition (that match the first arrangement) satisfy the evaluation criteria. The method may comprise identifying the gate type of one or more gates in the circuit section matching the first gate arrangement and selecting the evaluation criteria to be evaluated in dependence on the gate type. Preferably, the set of evaluation criteria comprises a set of equations, the equations preferably derived from the pentagon equation.
The second arrangement preferably comprises fewer gates than the first arrangement and/or has a shorter circuit depth.
Preferably, the method further comprising processing the received circuit definition to identify the section of the quantum circuit matching the first arrangement. This preferably includes identifying an arrangement of gates in the circuit that matches a circuit template specifying the first arrangement of gates. The method may comprise repeating the processing, determining and modifying steps one or more times, optionally until no further circuit sections matching the first arrangement are found.
The first arrangement may comprise two gates implementing local interactions between respective adjacent pairs of qubits in a quantum system of at least three qubits and a third gate implementing the non-local interaction between a non-adjacent pair of the qubits.
Optionally, the quantum circuit comprises at least three qubits, the first arrangement of gates comprising first and second SWAP gates arranged, respectively, before and after a further gate to implement an interaction between two non-adjacent ones of the three qubits. The first arrangement of gates then preferably comprises a further gate prior to the first SWAP gate providing an input to the first SWAP gate and/or a further gate subsequent to the second SWAP gate utilising an output of the second SWAP gate.
Preferably, the gates used in the first gate arrangement (other than SWAP gates), e.g. the further gate, the prior gate and the subsequent gate in the above example, are of a common gate type T, which may be one of: the A gate, and the evolution operator of the 1D Heisenberg model. In the above example, the second gate arrangement preferably eliminates both SWAP gates included in the first arrangement.
The second arrangement of gates is preferably functionally equivalent to the first arrangement of gates. The second arrangement preferably comprises two gates of the gate type T operating on respective adjacent pairs of the qubits.
Preferably, the first arrangement of quantum gates defined by the template is a gate arrangement as shown in arrangement 220 of
The method may further comprise outputting the modified circuit definition to a quantum transpiler for transpilation to a target quantum computer, wherein the transpiler outputs the compressed, transpiled circuit to a quantum controller for implementation on a quantum processing unit, or outputting the modified circuit definition to the quantum controller, and optionally executing the circuit defined by the modified circuit definition by the quantum controller using the quantum processing unit.
In a variant, which may include any of the optional or preferable features set out above, the method may be defined as a method of compressing a quantum circuit, comprising: receiving data defining a quantum circuit; identifying a section of the quantum circuit that matches a predetermined circuit template, wherein the circuit template specifies a first arrangement of quantum gates including at least one SWAP gate for implementing a non-local interaction and is associated with a predetermined second arrangement of quantum gates that does not include the SWAP gate; determining whether the circuit section meets a compression criterion; in response to determining that the circuit section meets the compression criterion; modifying the circuit definition to replace the first arrangement of quantum gates with the second arrangement of quantum gates; and outputting the modified circuit definition.
Also disclosed is a system having means, optionally comprising at least one computer device having a processor with associated memory, for performing any method as set out herein. The system may further comprise a quantum computer coupled to the computer device.
The disclosure also encompasses a computer program or tangible, non-transitory computer readable medium comprising software code adapted, when executed by a data processing system, to perform any method as set out herein.
Features of one aspect or example may be applied to other aspects or examples, in any combination. For example, method features may be applied to system or computer program aspects or examples (and vice versa).
Certain embodiments of the invention will now be described by way of example only, in relation to the Figures, wherein:
Embodiments of the invention provide a system for compressing quantum circuits. The system identifies sections of a quantum circuit that match a predetermined compression template. The compression template defines a compressible arrangement of quantum gates which maps to a functionally equivalent compressed gate arrangement with fewer gates and reduced circuit depth. as long as a compression criterion is fulfilled. The system evaluates sections of the circuit matching the template to determine whether they fulfil the compression criterion, and if so, replaces those sections with the equivalent compressed gate arrangement.
A system for implementing the described techniques is illustrated in
The system includes a transpiler 100 used to prepare quantum circuits for execution on a quantum system 110. Quantum circuits define quantum computations to be carried out by a quantum computer by specifying sequences of quantum computing operations, defined as an arrangement of quantum gates, to be applied to one or more qubits in a quantum processing unit to alter the state of those qubits. Examples of quantum gates include the Hadamard gate, the phase shift gate, the SWAP gate and the CNOT (controlled-NOT) gate.
Quantum circuits may be stored, for example, in a circuit database 106. Quantum circuits may be defined using the QASM (Quantum Assembler) language or a variant of that language.
Transpilation refers to adapting and/or optimizing a particular quantum circuit to the topology of a quantum computing device that will be used to “run” the circuit. The transpiler 100 reads a circuit (e.g. in the form of a QASM file) and processes it to make it suitable for execution on the target quantum computing system 110. For example, this may involve re-expressing operations defined using certain types of gates using a different set of gates that can be implemented on the target hardware. For example, a SWAP gate may be implemented on a particular quantum computer as a set of CNOT gates.
In an embodiment, the transpiler includes a standard transpiler module 102 and a circuit compressor 104.
Circuit compressor 104 identifies circuits (or parts of circuits) that can be compressed by replacing certain non-local gate operations with equivalent expressions using local interactions. Eliminating non-local operations can remove the need for expensive SWAP operations.
The standard transpiler module 102 performs conventional processes for transpiling to the chosen quantum hardware, as known in the art. If no adaptation to the target hardware is required (e.g. because the input circuit is already suitable for execution on the target hardware) then the standard transpiler module may be omitted or bypassed.
After circuit compression and any other required transpilation steps, the transpiler 100 provides the compressed and transpiled circuit to a quantum computing system 110 for execution. The quantum computing system includes a quantum controller 112 which controls execution of the quantum circuits on a quantum processing unit 114. Any suitable gate-based quantum computing hardware may be used to implement quantum computing system 110. In certain embodiments, the quantum computing system comprises an IBM® quantum computer (e.g. Osprey®) or a Rigetti Aspen M-2® quantum computer.
While circuit compressor 104 is shown in
Embodiments of the invention provide a circuit compressor that can for some circuits convert a given circuit into an equivalent circuit that eliminates a non-local interaction. An example is shown in
Non-local operations are commonly implemented using SWAP gates. A SWAP gate exchanges quantum states between two qubits. Addition of such a swap operation can thus allow a non-local operation to be carried out as a local operation.
The swap operation exchanges the quantum state between qubits i+1 (232) and i+2 (234). A local interaction can then be performed involving qubits i (230) and i+1 (232).
In step 400, a specification of a quantum circuit is received. For example, this may be retrieved from database 106 and may be expressed in the QASM language or another suitable form. The circuit specification is parsed to generate a data representation of the circuit.
In step 404, a section of the circuit is identified that includes an arrangement of quantum gates matching the compression template (as shown in
In step 406, the process evaluates the identified circuit section to determine whether it meets certain criteria for compression. In particular, this involves determining whether the particular gates used in the circuit in place of the gate placeholders T of the template meet a predetermined gate criterion. The criterion is based on evaluation of the gate parameters against a set of equations as described in more detail below.
If the evaluation determines that the compression criterion is met (test 408) and therefore compression is possible, then in step 410, the circuit is modified to replace the arrangement of gates that was matched to the template (
The process then determines in step 412 whether there are further parts of the circuit to process. If so, the process continues to step 404 to continue evaluating the circuit to search for further matches to the template.
If in step 408, it is determined that the part of the circuit being evaluated does not meet the compression criterion, then step 410 is bypassed and the process continues directly to step 412 to consider other parts of the circuit, without rewriting this part of the circuit.
In step 413, once all potentially compressible parts of the circuit have been processed (test 412, NO branch), the resulting modified (compressed) quantum circuit is transpiled to the target hardware as required, using standard transpiler module 102.
The transpiled circuit is then sent in step 414 to the quantum controller 112 of quantum computing system 110, which executes the circuit on the quantum processing unit 114 in step 416. To execute the circuit, the quantum controller compiles the gate operations of the quantum circuit using a quantum compiler into control signals for the quantum processing unit (alternatively, the quantum compiler may be implemented as a separate component). The processing operations defined by the quantum circuit are then carried out by application of the control signals to the system of qubits of the quantum processing unit.
Instead of immediate execution, the compressed and/or transpiled circuit could alternatively be stored (e.g. in circuit database 106) for later execution.
Compression is based on the pentagon equation. The pentagon equation belongs to an infinite family of equations called polygon equations, and is similar to the Yang-Baxter equation. It appears in various branches of mathematics, such as representation theory, topological field theory and conformal field theory.
In the present system, the pentagon equation is used to define an equivalence between certain circuits, specifically between circuits matching the circuit arrangements 220 and 222 of
The pentagon equation is defined as follows. Note that in these equations, V is used to denote a finite dimensional vector space over the complex numbers with the usual tensor product of vector spaces ⊗. The identity map from V to V is denoted idV and the twist map τV,V: V⊗V→V⊗V reads x⊗yy⊗x. A linear map f: U→V, between two vector spaces U and V, has an associated matrix with respect a basis of U and V. For convenience, the linear map and its associated matrix are associated by the same letter.
Thus, with V defining a finite dimensional vector space and T: V⊗V→V⊗V defining a linear map, the following maps are defined:
by the formulae:
The pentagon equation is then defined by:
A solution of the pentagon equation is a linear operator T which satisfies this equation. Solutions of the pentagon equations are commonly referred to as fusion operators.
By way of background, one way to produce fusion operators, i.e. solutions of the pentagon equation, is from a bialgebra. A bialgebra B is a vector space with an algebra structure and a compatible coalgebra structure. Denote by m the product of the algebra and by θx+θy the coproduct of the coalgebra. Then, the composite map T:=(id⊗m)∘(δ⊗id) is a fusion operator (for more details, see R. Street, “Fusion operators and cocycloids in monoidal categories”, Appl. Categ. Structures 6, 177, 1998).
Fusion operators can be identified as follows. For a linear map T: V⊗V→V⊗V, Tis a fusion operator if and only if T′:=τV,V∘T satisfies the 3-cocycle condition
The circuit description of the 3-cocycle is shown in
The pentagon equation makes it possible to transpile a certain quantum circuit with five gates (matching the compression template of
In step 500, the process matches an arrangement of circuit gates of the input circuit to the compression template. The compression template has the form depicted in
Note that this example assumes that the input explicitly defines the SWAP gates. Alternatively, the input circuit may merely specify the non-local interaction as an interaction between non-adjacent qubits (without explicitly defining the SWAP gates that would be needed to implement the non-local interaction). In that case, the process may instead try to match an arrangement of gates of the input circuit to a template comprising the arrangement 220 of
When a section of the circuit has been matched to the template, the process then determines whether the circuit section corresponds to a valid solution of the pentagon equation.
As noted above, for a unitary gate T and a quantum circuit which contains a sub-circuit matching the compression template shown in
Application of this test will be described in relation to specific gate examples further below. In overview, each particular type of gate is characterised by a set of equations, derived from the pentagon equation. As noted above, the gates T are parameterized and the equations for that gate type are evaluated based on the gate parameters specified in the circuit. The gates of the circuit satisfy the pentagon equation if and only if the associated set of equations are satisfied.
Thus, in order to evaluate a particular circuit that matches the
If the equations are satisfied and the circuit therefore corresponds to a valid solution (test 504), then the process modifies the circuit to rewrite the circuit section being compressed in step 506. This involves replacing the circuit section that matches the template (as depicted in
If the gates (and hence the matched circuit section) do not correspond to a valid solution of the pentagon equation, then the process terminates and no substitution is performed (step 508), i.e. the circuit is not modified.
Note that, where compression is possible, the substitution with the equivalent compressed circuit is performed in accordance with the pentagon equation, T23T12=T12T13T23 (as introduced above). The right-hand side of the equation, T12T13T23, defines the circuit prior to compression, where non-local interaction T13 is implemented (or would be implemented) in the actual circuit as per the
The compression can serve to reduce the complexity of the overall circuit by reducing the number of gates, resulting in shorter circuit depth, and also eliminating non-local interactions by using gates operating on adjacent qubits.
Returning to
The following section considers the pentagon equation in the context of the A gate and the evolution operator of the 1D Heisenberg model. The A gate and the evolution operator of the 1D Heisenberg model for N=2 are both solutions of the pentagon equation subject to a number of constraining equations and details are set out below. However, first, some background is provided.
The Pauli matrices σa, a∈{x, y, z} which are the generators of the Lie algebra (2) of the Lie group SU(2) read
where i is the imaginary unit. It is worth mentioning here that σx2=σy2=z2=. Based on this fact, one computes
for a=x, y, z and θ∈. Precisely, the matrix exponentials of σx, σy and σz give rise to the rotation operator matrices Rx(θ), Ry(θ) and Rz(θ) respectively which read
A quantum circuit is a series of unitary transformations, called gates, which act on qubits. Gates referenced in this document include the Hadamard gate H and the phase shift gate S which are applied to single qubits and read respectively
The controlled NOT gate, denoted by CNOT, and the SWAP gate are applied to 2-qubits and read respectively
While there are many standard gates, it would be convenient to reason about all nonlocal two-qubit operations at the same time, while considering as few parameters as possible. To do so, Zhang et al. in “Minimum construction of two-qubit quantum operations”, Phys. Rev. Lett. 93, 020502 (2004), introduced the three-parameter model, where each choice of the three parameters corresponds to a local equivalence class of two-qubit gates up to Weyl reflection symmetries. In particular, the model is defined as the product of the unitary matrices
where
An analytic form of the A gate, where c1, c2, c3 are integer coefficients is shown below:
Associated with the model, but not as important for our considerations, is the B gate which reads
The B gate is related to the A gate as A ˜BUB, for some U∈U(2)×U(2) (see J. Zhang et al. “Geometric theory of nonlocal two-qubit operations”, Phys. Rev. A 67, 042313 (2003)).
The Heisenberg model is a spin model of ferromagnetism on a lattice where the coupling energy/between nearest neighbor lattice sites is positive and parallel alignment of local spins is favorable. The variables in the Heisenberg model are subject to a continuous internal symmetry which once broken to it yields the Ising model which is quite commonly used in the context of Variational Quantum Algorithms (VQAs). Both the Heisenberg and the Ising models are of particular interest in the theory of quantum integrability precisely due to their integrable nature; they satisfy certain equations for which one can find analytic solutions at any value of the coupling energy/and the thermodynamic limit N→∞, where N is the number of lattice sites or spins.
In this context, we are interested especially in the 1D Heisenberg model with N=2. This is a case of particular interest since it is the only scenario where the components of the model's Hamiltonian commute. The Heisenberg Hamiltonian is defined as
where a∈{x, y, z}, σa is the Pauli matrix at the direction of a, Ja is the coupling constant or interaction strength. The evolution operator of the Shrödinger equation is eiĤt/ℏ. An analytic form of the evolution operator of the Shrödinger equation is shown below:
Notice that γ=θx−θy and θx+θy=θx+θy is based on a calculation of the individual components:
The matrix eiĤt/ℏ is obtained from the A gate by setting c1=2(θx−θy), c2=2(θx+θy) and c3=2θz in matrix A.
The evolution operator of the 1D Heisenberg model as a quantum circuit is shown in
As discussed above, the circuit mapping between circuits as depicted in
The system of equations is obtained by substituting the gate A into the pentagon equation and equating both sides. Solving the equations one obtains c1=c2=0 and c3=−2πk where k∈.
Based on the relation of the matrix A and the evolution operator of the 1D Heisenberg model, the following can be stated: The evolution operator of the 1D Heisenberg model for N=2 (as defined above) is a solution of the pentagon equation if and only if the equations in
The system of equations of
The described techniques can thus allow a quantum circuit composed of 2-qubit interactions that include nonlocal interactions to be compressed to a local interactions only quantum circuit if the corresponding gates are fusion operators, that is, for a particular set of parameters that satisfy the constraining equations. This compression can have a substantial impact by reducing the corresponding number of SWAP gates when direct non-nearest neighbor interactions are not possible.
The processing device 1100 may be based on conventional workstation or server hardware and as such includes one or more processors 1104 together with volatile/random access memory 1102 for storing temporary data and software code being executed.
A network interface 1106 is provided for communication with other system components. For example, the processing device may communicate via the network interface with the external quantum circuit database 106 and with the quantum computing system 110 (to run quantum circuits on the quantum processing unit 114 via the quantum controller 112). Communication may occur over one or more networks (e.g. Local and/or Wide Area Networks, including private networks and/or public networks such as the Internet).
In an embodiment, the quantum computing system may be provided as a remote system, accessible via a cloud-based quantum computing service.
Persistent storage 1108 (e.g. in the form of hard disk storage, optical storage and the like) persistently stores software and data for performing various described functions. In an example, this includes a transpiler module 102 implementing conventional transpiler functions and a circuit compressor module 104 for implementing the described circuit compression techniques. The circuit database 106 may also be stored within the persistent storage, to store input circuits to be compressed and compressed output circuits.
The persistent storage further includes a computer operating system 1110 and any other software and data needed for operating the processing device. The device will include other conventional hardware components as known to those skilled in the art, and the components are interconnected by one or more data buses (e.g. a memory bus and I/O bus).
While a specific architecture is shown and described by way of example, any appropriate hardware/software architecture may be employed to implement the transpiler system.
Furthermore, functional components indicated as separate may be combined and vice versa. For example, the various functions may be performed by a single device 1100 or may be distributed across multiple devices. As a concrete example, the circuit database 106 could be stored at a separate data repository e.g. a database server.
It will be understood that the present invention has been described above purely by way of example, and modification of detail can be made within the scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2303962.1 | Mar 2023 | GB | national |