f3c
Fast free fermion compiler - Quantum circuit compression for Hamiltonian simulation
view repo
Unitary evolution under a time dependent Hamiltonian is a key component of simulation on quantum hardware. Synthesizing the corresponding quantum circuit is typically done by breaking the evolution into small time steps, also known as Trotterization, which leads to circuits whose depth scales with the number of steps. When the circuit elements are limited to a subset of SU(4) – or equivalently, when the Hamiltonian may be mapped onto free fermionic models – several identities exist that combine and simplify the circuit. Based on this, we present an algorithm that compresses the Trotter steps into a single block of quantum gates. This results in a fixed depth time evolution for certain classes of Hamiltonians. We explicitly show how this algorithm works for several spin models, and demonstrate its use for adiabatic state preparation of the transverse field Ising model.
READ FULL TEXT VIEW PDFFast free fermion compiler - Quantum circuit compression for Hamiltonian simulation
Quantum computers were initially conceived of as a tool for simulating quantum systems [feynman1982simulating], and indeed, this is seen as one of the most promising applications for near-term quantum processors [preskill2018quantum]
. The main challenge for implementing such simulations on a quantum computer is to generate a circuit—usually comprised of single- and two-qubit gates—that mimics the effect of the time evolution operator
on qubits, which is termed unitary synthesis. Unitary synthesis in the most generic case is exponentially hard due to exponential growth of the Hilbert space dimension, i.e. size of the matrix , with the system size [khaneja2005constructive, drury2008quantum_shannon]. Though there are ways to ameliorate this problem by leveraging the algebra generated by the terms in the Hamiltonian [kokcu2021fixed], generating an exact circuit remains classically NP-hard for interacting fermion models. In practice, an approximate circuit implementation of the unitary is often sufficient and can even be imposed by technological constraints as we discuss next.The challenges are exacerbated by the fact that near-term quantum computers are small and noisy [preskill2018quantum], which greatly limits how deep quantum circuits can be before their results are indistinguishable from random noise. This means that circuit synthesis techniques must also attempt to optimize quantum circuits to be as shallow as possible; such circuit optimization is an NP-hard problem for general quantum circuits [herr17, botea2018].
Generating a circuit is particularly difficult for dynamic simulations which simulate a quantum system evolving in time. This is because a separate circuit must be generated for each time-step, and for a general Hamiltonian, the circuit depth increases with increasing simulation time [berry2007efficient, childs2009limitations, Childs2021].
Here, we present an algorithm for compressing circuits for simulations of time-evolution to a constant depth, independent of increasing simulation time, for a particular class of Hamiltonians. The common feature of these Hamiltonians is that they can be mapped to free fermionic Hamiltonians [chapman2020characterization]; equivalently, they produce a Hamiltonian algebra that scales polynomially in the number of qubits [kokcu2021fixed]. This property allows us to circumvent the no-fast-forwarding theorem [berry2007efficient, atia2017fast, gu2021fast].
Our approach uses a first order Trotter-Suzuki decomposition of the time-evolution operator of a time-dependent Hamiltonian for the unitary synthesis step. The unitary operator for this process obeys
(1) |
with , i.e. the identity operator. This equation can be approximately solved by Trotter decomposition with a time step size :
(2) |
where , and (kept constant while taking the limit). After approximating each small time step , the right hand side of Eq. (2) often has a straightforward circuit implementation that approximates . The accuracy of the Trotter decomposition depends on the size of . This is the trade-off with the Trotter decomposition: the smaller the time step, the longer the circuit. Moreover, regardless of the choice of , the circuit grows with increasing simulation time.
In order to deal with the circuits that grow as a function of simulation time, several approaches exist, each with inherent limitations. We limit the discussion to those methods that can be executed on Noisy Intermediate Scale Quantum (NISQ) hardware, putting aside the others [Berry2015, Low2017, Low2018, Kalev2020, Haah2021, cirstoiu2020variational]. General purpose transpilers can be used to shorten the growing-depth circuits, but these do not typically take advantage of the algebraic structure of the problem, and are limited to how much compression can be achieved, ultimately placing a limit on the largest feasible simulation time. Constant depth circuits can be obtained variationally by optimizing a generic circuit via a hybrid classical-quantum algorithm [commeau2020variational]. However, these approximate circuits are only applicable to time evolution of a particular initial state and their error grows with simulation time. Alternatively, a more general constant depth circuit may be found by using the distance from a specific target unitary as the cost function [bassman2021constant] — this approach does not scale favorably in the number of qubits due to the necessarily large number of parameters in the classical optimization. Finally, constructive approaches to circuit synthesis that rely on the algebraic structure of the unitaries have been proposed [khaneja2005constructive, earp2005constructive, kokcu2021fixed], but these require a similar classical optimization step.
Our proposed method, while not applicable to all problems, is a constructive proof of the circuit ansatz used in Ref. [bassman2021constant]. Because of the constructive nature, it scales to 1,000s of qubits, which is out of the reach of previous methods [bassman2021constant, kokcu2021fixed] that require optimization. This work is accompanied by a dual paper [simax] which focuses on the underlying matrix structures of the circuit elements, and on the efficient and numerically stable implementation of the circuit compression algorithms for each model discussed below. We show that this compression technique scales polynomially in the number of qubits, and is thus applicable for the foreseeable future on quantum hardware. Our codes are made available as part of the fast free fermion compiler (F3C) [f3c, f3cpp] on https://github.com/QuantumComputingLab. F3C is build based on the QCLAB toolbox [qclab, qclabpp] for creating and representing quantum circuits.
We demonstrate the power of our compressed circuits by showing how they enable adiabatic state preparation (ASP), where a system is evolved under a slowly varying Hamiltonian in order to prepare a non-trivial ground state. The system is initialized in the ground state of the initial Hamiltonian, which is presumed to be trivial to prepare, and ends in the (non-trivial) ground state of the final Hamiltonian given slow enough variation of the Hamiltonian. Given the constant depth nature of the circuit for different times, the state preparation for long times, is ultimately accomplished in a single step. We apply this to preparing the ground state of the transverse field Ising model (TFIM) on qubits.
The paper is organized as follows. We define an object called a “block” and prove the existence of a constructive compression method for circuits made only of blocks in Sec. II. In Sec. III, we propose specific mappings between the circuit elements of Trotter-decomposed time evolution operators and blocks for the Kitaev chain, the TFIM, the transverse field XY (TFXY) model, as well as a nearest neighbor free fermion model. We further prove that the three properties of blocks hold for each, thus showing that a compressed circuit exists for these models. We apply our method to ground state construction of the TFIM with open boundary conditions in Sec. IV, where we show that compressed Trotter circuits are superior to traditional Trotter circuits due to their ability to simulate as slow time evolution as desired, which is significant for adiabatic evolution. We finish by discussing the potential implications of our results in a broad sense in Sec. V.
In this section, we will define and prove generic mathematical tools necessary to show that certain models have a Trotter expansion that can be compressed down to a fixed depth circuit. To compress the Trotter expansion, we map certain elements in the Trotter step into a mathematical structure called a “block”. These block structures are model dependent and are required to have certain simplification rules given in Def. 1. We follow with lemmas and theorems that use these simplification rules to compress a Trotter circuit that is fully expressed via blocks into a fixed depth circuit.
Let be functions of , where the index can be any positive integer and are multiple real numbers. Each will be mapped to quantum circuit elements in a model dependent way such that the parameters will be the parameters for the gates, and the index will separate them in terms of which qubits they act on. The number of parameters and index to qubit(s) mapping vary from model to model, as it will be seen in Sec. III. For example, we will have
for odd
and for even as the mapping for an open one-dimensional (1D) Kitaev chain in Sec. III.1, and show that this mapping satisfies the three defining properties listed below.Define a “block” as a structure that satisfies the following three properties:
the fusion property: for any set of parameters and , there exist such that
(3) |
the commutation property: for any set of parameters and
(4) |
the turnover property: for any set of parameters , and there exist , and such that
(5) |
Henceforth, we drop the parameters when referring to a block and simply write for convenience. The reader should assume that each block in an expression may have different parameters unless it is stated otherwise.
Using Def. 1, we now define three important “block” structures, which will be used to obtain and prove the fixed depth circuits. We start with a cascade of blocks.
Using Def. 2, we obtain
Next, applying the turnover property to and using the commutation property, yields
which completes the proof. ∎
Next, we define a triangle of blocks, comprised of multiple cascades, and prove that an extra block can be fully compressed into a triangle.
Using Def. 3, we obtain
Applying Lemma 1 times, yields
where each time we swap a block with a cascade, we perform turnover. Hence, we have done turnover operations in order to move the extra block to . Next, we can merge into the triangle , i.e.,
where we applied the fusion property once. Finally,
via turnover and 1 fusion operation. ∎
Thm. 1 shows that a triangle and any finite set of blocks can be merged into a triangle. Here we define another block structure, called zigzag of blocks, which corresponds to a time step of a Trotter decomposition of the Hamiltonian evolution after mapping to blocks. We use Thm. 1 to explicitly show that a zigzag can efficiently be compressed into a triangle of appropriate size. We also show that a triangle can be merged with another triangle efficiently, using the fact that a triangle is a finite set of blocks.
Define a “zigzag” of blocks as
(10) |
where are blocks as defined in Def. 1 and ; note all even numbered blocks are to the right of odd numbered blocks.
In both cases, we are merging one block from every height , therefore we use the result of Thm. 1 for each of these blocks. Each block will require fusion, therefore we need to apply fusion operations. The number of turnover operations is
which concludes the proof. ∎
Two triangles with height can be merged into a triangle with height , i.e.
(12) |
via turnover and fusion operations.
There are blocks in . As a result of Thm. 1 this merging will require fusion operations. Using the definition of , we see that we are effectively merging the triangle with cascades with heights to . Using the result of Cor. 1, we get the number of turnover operations required for this merger to be
(13) |
which concludes the proof. ∎
Using Cors. 2 and 1 as induction steps, we provide the two following compression techniques for Trotter decompositions involving blocks only:
A product of zigzags with height for will lead to a triangle with height
(14) |
via turnover and fusion operations.
A zigzag can be viewed as a triangle with identity operations in place of the missing blocks. Therefore for , the result should be a triangle. Using Cor. 1, we know that adding another zigzag to the triangle each time will require turnover and fusion operations. Doing this times will require turnover and fusion operations. ∎
Consider identical zigzags with height . Using the fact that they are same, they can be compressed into a triangle with height
(15) |
where we use power instead of the product symbol to emphasize that the parameters are the same, via turnover and fusion operations.
Given that zigzags (with added identity gates) are triangles , the left hand side of (15) can also be written as . We can replace it with and turn it into via fusion and turnover operations using Cor. 2. We need to repeat this many steps in total, leading to this compression being performed via turnover and fusion operations. ∎
Cors. 4 and 3 are the main results used for compression. For a time-independent Hamiltonian, one can choose either of the two compression algorithms. The performance depends on the number of Trotter steps needed, and the number of qubits. Depending on the particular problem at hand, one or the other may be preferable; the scaling of Cor. 3 is a better choice for larger systems, whereas Cor. 4 is a better choice for a large number of Trotter steps. For time-dependent Hamiltonians, each Trotter time step will have different coefficients, meaning the corresponding zigzags will not all be identical. In this case, Cor. 3 is the only choice for compression.
So far we have proved that we can compress any finite expansion given in terms of blocks into a triangle, a block structure with depth where is the height of the triangle. When translated into a quantum circuit, this compression corresponds to a compression of a long circuit into a short, fixed depth circuit. For NISQ devices, it is crucial to have short depth circuits due to the fact that the noise increases for longer circuit depths. In the rest of this section, we will show that the depth of the triangle can be reduced in half, leading to better quantum circuits for NISQ devices.
For ,
(16) |
is formed by blocks with indices that are between and , hence each of them can be passed from left side of to right side by decrementing the index by one. ∎
A triangle with height can be further optimized to a square with height which is defined as
(17) |
for odd and
(18) |
for even , where down arrow indicates that the product is done in the decreasing order for index . has the same number of blocks as , however it has two-thirds the depth of which is important for quantum computers.
First, consider the case for odd . The definition of a triangle is:
(19) |
We will carry all cascades, i.e. , ,…, to the right side of by using Lemma 2 in the given order. In that order, will pass through cascades and become at the end, thereby leaving all the cascades behind. This leads to a square formation for odd as defined in the theorem.
For even , we will carry all cascades, i.e. , ,…,, . In that order, will pass through cascades and become at the end, thereby leaving all the cascades behind. This leads to a square formation for even as defined in the theorem. ∎
In summary, triangles are useful to compress a Trotter expansion if the Trotter steps can be represented with blocks. After the compression, we are left with a triangle circuit. This can then be further simplified to a square (with same number of blocks as the triangle), but with half the total circuit depth. This leads to the following overall compression algorithm:
Find a block mapping, and represent the circuit via blocks.
Compress all blocks one by one into a triangle.
Transform the triangle into a square.
In the next section, we provide block mappings for Trotter decompositions of certain Hamiltonians.
In this section, we show that the operations outlined in Sec. II are applicable to time evolution for several commonly found models in physics and quantum information theory. Each of these models has a Hamiltonian written as a sum of Pauli operators for qubits (or spin-12 particles)
(20) |
where are time- and site-dependent coefficients and are Pauli string operators, i.e., elements of the -site Pauli group . The common feature of the models for which Thm. 1 applies is that they can all can be mapped onto free fermionic models after a Jordan-Wigner transformation [chapman2020characterization] — or, equivalently that the algebra generated by the operators in the Hamiltonian scales polynomially in the system size [kokcu2021fixed]. This suggests that there may be other models that share this property that will be amenable to this approach.
We next consider the Trotter decomposition of the time evolution operator given in Eq. 2 for those models. To generate a circuit for the full , we must convert each exponential into a set of gates. The most straightforward way to map these exponentials into a set of gates is to first decompose the Hamiltonian in each exponential into components that each contain mutually commuting operators. Trotterization can once again be employed to approximate each exponential as a product of exponentials of each component of the Hamiltonian. To the first order in , this approximation is written as
(21) |
where multiplies over the different components of the Hamiltonian. Though higher order approximation schemes exist [suzuki1976generalized], this first order approximation is sufficient for our method. Once the time evolution is Trotter-decomposed into a series of exponentials of single Pauli strings, a quantum circuit can then be constructed from single- and two-qubit operations [pauli_circ1, pauli_circ2]. After finding a block mapping to exponentials of single Pauli strings that occur in Eq. 21 , the operations given in Sec. II can be used to recombine the Trotter steps into a square, which can then be transformed into a fixed depth circuit for the models discussed below.
The Hamiltonian for the 1D Kitaev chain with open boundary conditions is given by
(22) |
The time evolution can be approximated using the Trotter decomposition with a time step ; for a -site chain this can be written explicitly as
(23) |
Note that other choices are also available as multiplication of these exponentials in any order are all identical to each other within error.
Consider the mapping for odd and for even . With this mapping, the Trotter step given in Eq. 23 can be written in terms of matrices
(24) |
Here we show that these operators are blocks and satisfy the properties given in Def. 1. Fusion is easily satisfied
(25) |
and independent blocks that do not share a spin commute due to the fact that they act on different spins. This leaves us with the proof of the turnover property of blocks; we need to demonstrate that
(26) |
where is an odd number, and are functions of . To show this, we note that the exponentiated operators form an algebra. This is easily seen from their commutation relations,
(27) |
With this, we can leverage a standard Euler angle decomposition in . Denoting the three directions in as , , and , any element in can be written as a rotation around followed by a rotation around followed by another rotation around . In Eq. (26), the directions are , on the left hand side, and vice versa on the right. Therefore for any , there exist and vice versa such that Eq. (26) is satisfied.
The coefficients can be calculated by mapping Pauli matrices to the exponents , due to the isomorphism between the algebra generated by the exponents and . Mapping to and to , Eq. 26 becomes
(28) |
which may be solved to obtain the following equations
(29) |
and their inverses
(30) |
and can be solved directly from Eq. 29, and then can be solved from one of the relations given in Eq. 30. Although we provide the analytical expressions here, in the code [f3c, f3cpp] we use another method based on diagonalization of matrices, explained in detail in Ref. [simax]. That method is far more efficient and precise compared to calculating the angles via Eqs. 30 and 29 due to the fact that the analytic expressions rely on repeated use of trigonometric and inverse trigonometric functions.
Having shown that the elements of the Kitaev chain circuit satisfy the properties of a block, Cors. 4, 3 and 1 say that the Trotter circuit for this model can be compressed into a triangle of blocks; and Thm. 2 states that it can be further simplified into a square as given in Fig. 3(c). Considering the spin Kitaev chain, one Trotter step would have 2-qubit and rotations, leading to blocks with the mapping we provided. This would lead to blocks in the final square circuit. Depending on the hardware, this means we either need 2-qubit rotations, or considering the circuit implementation of and rotations via CNOT gates, we need CNOT gates.
The Hamiltonian for the 1D XY Model with open boundary conditions is given by
(31) |
where is the number of spins. It can be shown that this Hamiltonian is the sum of two Kitaev chains
(32) |
where
(33) |
One can check that these chains are independent from each other, i.e. , by observing
(34) |
Therefore the evolution of the XY model can be written as two separate evolutions of Kitaev chains, as given in Fig. 3(d). In fact, Eq. 34 also shows that any two terms in the separate evolution circuits commute with each other, and therefore can be moved freely. Considering the fact that and when individually implemented require CNOTs in total whereas their combination requires only CNOTs, it is advantageous to bring and rotations together for hardware that uses CNOTs. Eq. 34 allows us to transform the circuit in Fig. 3(d) to Fig. 3(e) and reduce number of CNOTs by one half.
The Hamiltonian for the 1D TFIM with open boundary conditions is given by
(35) |
The time evolution is again factored into Trotter steps of length ; for a -site chain this can be implemented as shown in Fig. 4.
Consider the mapping and . With this mapping, a Trotter step for this model can be written as a product of matrices. Here we show that these operators satisfy the block properties from Def. 1. Note that this is an example where not all blocks are 2-qubit operators, which shows that blocks can vary in size. The fusion operation is satisfied by this mapping
(36) |
The commutation of blocks with an odd index is clear since they do not act on a common spin: acts on qubit and acts on qubit . Blocks with even on the other hand should be checked explicitly, because acts on spins and , and acts on spins and , i.e., they both act on spin . However, since , commutation of independent blocks applies for even indexed blocks as well. This leaves us with the turnover property,
(37) |
To show this, we note that similar to the Kitaev chain, the exponents form an algebra
(38) |
Therefore, by the arguments given in the discussion for the Kitaev chain, it can be shown that the turnover property is satisfied for the blocks as defined for the TFIM as well. The relation between the sets of angles are also the same as in Eq. 29 due to the fact that it is the same switch between Euler decompositions of .
Having shown that the elements of the TFIM circuit satisfy the properties of a block (Def. 1), it follows from Thm. 1 that the Trotter circuit for this model can be compressed into a triangle of blocks.
Considering the spin TFIM, one Trotter step would have 2-qubit and 1-qubit rotations, leading to blocks with the mapping we provided. This would lead to blocks or Trotter steps in the final square circuit. Depending on the hardware, this means we either need rotations, or considering the circuit implementation of rotations via CNOT gates, we need CNOT gates.
The Hamiltonian for the 1D transverse field XY (TFXY) model with open boundary conditions is given by
(39) |
Here, the verification of the block properties is somewhat more complex. First, we define the operator as
(40) |
which can be shown diagrammatically as in Fig. 5(a). A Trotter step for this model can be written in terms of the matrices, since the exponents in Eq. 40 involve all the terms in the Hamiltonian. We proceed to prove that the mapping (40) satisfies all block properties.
Commutation. First, we prove that the operators satisfy the commutation relation given in Def. 1. This property follows from the observation that if two blocks are not on top of each other nor nearest neighbors to each other, they do not act on a shared spin. For example, acts on qubits and , and acts on qubits and . Therefore they act on different spaces, and commute.
Fusion. To prove the fusion property, it suffices to show that the expression given in Eq. (40) represents a generic element of a Lie group. The algebra formed by the exponents in Eq. (40) and their commutators is the Hamiltonian algebra for the 2 site TFXY model [kokcu2021fixed] (here we suppress for convenience):
(41) |
We can use an involution to form a Cartan decomposition [raczka1986theory, *gilmore2008lie, *hall2015lie]. Specifically, the involution (which counts the number of matrices), where , yields
(42) |
We can choose a maximal Abelian subalgebra as
(43) |
The “KHK theorem” [raczka1986theory, *gilmore2008lie, *hall2015lie] states that any element in the group for can be written as
(44) |
which is precisely Eq. (40). Thus, two blocks can be fused because the right hand side of Eq. (40) is a generic element in the Lie group .
Turnover. To show that the blocks satisfy the turnover property, we consider the Hamiltonian algebra of the 3 spin TFXY model,
(45) |
Using the involution , where , we partition into
(46) |
We note that is simply
(47) |
where is the identity operator for the 3rd spin. The relation between and together with Eq. (44) allows us to represent any element in the group as in Fig. 5(b). Therefore by choosing the following Cartan subalgebra
(48) |
the KHK theorem implies that any element in the group can be written as where and . This may be represented by the circuit given in Fig. 5(c), which is a V shaped 3 block structure, with each block representing the operator in Eq. (40).
The Cartan decomposition is not unique — we could have alternatively used the involution . This results in a swap of the 1st and 3rd spins. Thus, any element in the group can be equally well represented by an inverted circuit as shown in Fig. 5(d). This means that we have found two equivalent block structures that both represent a generic element in the group ; these can then be transformed into one another, which proves the turnover property for the block mapping of Eq. (40).
The above proofs for both fusion and turnover properties for the block structure Eq. 40 are based on the algebraic properties of and , and do not show how to calculate the coefficients after the fusion or turnover. Here we provide another Lie algebra based method to calculate the coefficients after the fusion and turnover operations.
Comments
There are no comments yet.