Introduction

A key step to realising a large-scale universal quantum computer is demonstrating that decoherence and other realistic imperfections are small enough to be overcome by fault-tolerant quantum computing protocols.1,2 Randomised benchmarking (RB)36 has become a standard experimental technique for characterising the average error of quantum gates partly because of its insensitivity to state preparation and measurement errors. Benchmarking provides robust estimates of average gate fidelity6,7 and it can characterise specific interleaved gate errors,8,9 addressability errors10 and leakage errors.1113

RB techniques that efficiently scale to many qubits have been limited to subgroups of gates in the Clifford group, as computations with this group are tractable.6 However, the Clifford group is not enough for general quantum computations.14 Previous work generalises RB to groups that include non-Clifford gates,15,16 but only on single qubits, a significant limitation. Methods for bounding the average fidelity of specific types of non-Clifford gates have also been considered.17

We present a scalable RB procedure that includes important non-Clifford circuits, such as circuits composed from T= Z 4 and controlled-NOT (CNOT) gates that naturally occur in fault-tolerant quantum computations. The n-qubit matrix groups we study are a generalisation of the standard dihedral group and coincide in some cases with protected gates in stabiliser codes, such as k-dimensional colour codes.18 Circuits built from these gates cannot be universal but do constitute significant portions of magic state distillation protocols,19,20 repeat-until-success circuits21 and the vital quantum Fourier transform.22 We show that there are efficient methods for representing and composing group elements, sampling them uniformly and synthesising corresponding circuits whose size grows polynomially with the number of qubits n. The benchmarking procedure provides experimental access to two independent noise parameters through exponential decays of average sequence fidelities.

Results

The quantum circuits we consider are products of CNOT gates Λ 12 ( X ) | u , v := | u , u v , bit-flip gates X | u := | u 1 and single-qubit m-phase gates Z m | u := ω m u | u , where ω m = e i 2 π / m . More concisely, the circuits of interest are given by the group

(1) G m : = Λ i j ( X ) , X ( j ) , Z m ( j ) / ω m .

We call this group a CNOT-dihedral group, as it is generated by CNOTs and a single-qubit dihedral group. Although we prove certain results for general m, we focus mainly on the case of m=2k. This case affords efficient benchmarking and contains non-Clifford gates of interest, such as T= Z 4 , controlled- Z (defined as Λ 12 ( Z ) | u , v := i u v | u , v ) and controlled–controlled–Z (defined as Λ 123 ( Z ) | u , v , w := ( 1 ) u v w | u , v , w ), which is locally equivalent to a Toffoli gate.

Our interest in the dihedral group was motivated by symmetries of stabiliser codes. However, another group that may have similar properties is G p , m := Λ ( p ) ( X ) , X ( j ) , Z m ( j ) / ω m where Λ(p)(X) is a p-controlled-NOT gate. Not all entangling gates are suitable for randomised benchmarking though. Our arguments imply that the group Λ i j ( Z ) , X ( j ) , Z m ( j ) does not yield an efficient benchmarking procedure, as twirling over this group produces a map with exponentially many parameters.

The benchmarking procedure we present here both generalises16 and extends naturally to interleaving gates to estimate individual gate fidelities.8,9 The procedure closely follows10 but we describe it in some detail for completeness. Choose a sequence of +1 unitary gates in which the first gates are uniformly random elements g j 1 , g j 2 , …, g j of G 2 k and the (+1)st gate is g j 1 := g j 1 g j where j denotes the -tuple (j1, … j) labelling the sequence. We show later that elements of G 2 k can be efficiently sampled and g j 1 can be efficiently computed. For each sequence, we prepare an input state ρ, apply S j := g j 1 g j g j 1 and measure an operator E.

Assuming each gate gi has an associated error E i ( ρ ) , the sequence S j is implemented as

(2) S ˜ j : = E j 1 g j 1 ( i = 1 [ E j i g j i ] )
(3) = E j 1 ( i = 1 [ g ˜ j i E j i g ˜ j i ] )

where each g ˜ j i G 2 k . The overlap with E is Tr [ E S ˜ j ( ρ ) ] . Averaging this overlap over K independent sequences of length gives an estimate of the average sequence fidelity F s e q ( , E , ρ ) :=Tr [ E S ˜ ( ρ ) ] where S ˜ ( ρ ) := 1 K j S ˜ j ( ρ ) is the average quantum channel.

Defining E to be the average of errors E i and assuming for all i that δ E i := E i E is small, the average quantum channel is

(4) S ˜ ( ρ ) = E [ E G 2 k ] + O ( δ E )

where E ¯ G 2 k is the G 2 k -twirl of (see Materials and Methods). The error operator E is attributed to measurement error and perturbs E to a new operator E′. We decompose the input state and this final measurement operator in the Pauli basis to give ρ= P x P P / 2 n and E= P e P P . Neglecting the O ( δ E ) term, the average sequence fidelity is

(5) F s e q ( , E , ρ ) = Tr [ E ( E ¯ G 2 k ) ( ρ ) ] = A Z α Z + A R α R + e I

where A Z = P Z / { I } e P x P and A R = P P / Z e P x P .

To see this, it is convenient to express E ¯ G 2 k in a corresponding Liouville representation R E ¯ (see Methods). In this representation, R E ¯ is diagonal with three distinct diagonal elements corresponding to sets of Pauli operators: the identity I has value 1, the Z-type Pauli operators Z/ { I } have value αZ and the remaining Pauli operators P/Z have value αR. The Pauli operator P then contributes ePxPα to Fseq(, E, ρ), where α is one of 1, αZ or αR depending on P.

In a spirit similar to simultaneous RB,10 each of the two exponential decays α Z and α R can be observed by choosing appropriate input states. For example, if we choose the input state | 0 0 , then F seq = e I + A 0 α Z where A 0 = P Z / { I } e P . On the other hand, if we choose | + + := b { 0 , 1 } n | b , then F s e q = e I + A + α R where A + = P X / { I } e P . State preparation errors may lead to deviation from a single exponential decay, but this is detectable. The channel parameters αZ and αR can be extracted by fitting the average sequence fidelity. The corresponding depolarising channel parameter is a weighted average α= ( α Z + 2 n α R ) / ( 2 n + 1 ) , and the average gate error is given by r= ( 2 n 1 ) ( 1 α ) / 2 n (see ref. 6).

The Materials and Methods section is devoted to proving the technical results that enable the benchmarking procedure such as a canonical decomposition of Gm, efficient computation within G 2 k and twirling over G 2 k to obtain the averaged quantum channel.

Discussion

Our results enable scalable benchmarking of a natural family of non-Clifford circuits related to quantum error-correcting codes. In principle, our procedure allows efficient benchmarking of isolated non-Clifford gates, as well as large sub-circuits for state distillation19,20 or repeat-until-success protocols.21 These sub-circuits can be characterised with our procedure using physical gates or logical gates on protected qubits. Altogether with standard Clifford benchmarking, our procedures enable characterisation of the full range of gates used in the leading fault-tolerant quantum computing protocols. As multi-qubit benchmarking is well within experimental reach,9,23,24 we expect an optimised implementation of our procedure to be quite practical.

Several natural questions arise from this work. First, one might address the asymptotically optimal cost of circuit synthesis for elements of the CNOT-dihedral groups, as well as the practical question of finding optimal circuit decompositions for elements of the smallest groups. We expect optimal circuits are computationally hard to find as n grows, but experimentally it is important to minimise the number of gates. Second, unlike the Clifford group, the CNOT-dihedral group is not a 2-design.5 It would be interesting to find a group (or set) containing a non-Clifford gate and that is a 2-design, and in which benchmarking can be done efficiently. Third, our results show that we can efficiently perform RB. However, we have not addressed the precise sense in which quantum computations over the CNOT-dihedral group can be efficiently simulated. This may be a subtle problem.25,26 Last, there are generalised stabiliser formalisms, such as,27 and it is natural to ask whether one of these describes how this group acts on some set of states.

Materials and methods

This section is devoted to proving the various results used in the benchmarking procedure: canonical decomposition of Gm, efficient computation in Gm and twirling over Gm, each of which is interesting in its own right. Let m be general and let us briefly set some notation. The matrix representation of Gm is set by identifying gGm to the matrix that maps | 0 n := | 00 0 to | b := | b 1 b 2 b n with unit phase. We define the phase-flip gates Z | u := ( 1 ) u | u and controlled-Z gates Λ 12 ( Z ) | u , v := ( 1 ) u v | u , v . The support of a bit string v{0, 1}n is supp ( v ) = { j | v j = 1 } [ n ] := { 1 , 2 , , n } . We refer to v and its support interchangeably, treating v as a set and vice versa. Let U be a single-qubit gate and U(v) denote the gate acting as U only on qubits in the support of v. Given J[n] or elements i, j, … [n], we also use the shorthand U(J) and U(i, j, …). P:= X ( j ) , Z ( j ) / i denotes the n-qubit Pauli group and we define X:= X ( j ) | j [ n ] , Z:= Z ( j ) | j [ n ] , cX:= Λ i j ( X ) | i , j [ n ] , i j and cZ:= Λ i j ( Z ) | i , j [ n ] , i < j .

Canonical form of Gm

Our first goal will be to put Gm in a canonical form (the main result is contained in Theorem 1). The rewriting identities shown in Figure 1 allow us to commute diagonal elements of Gm through Λij(X) and X(j) gates. The rules for bit-flip gates are a special case of the CNOT rules. The following Lemma follows directly from definitions and formalises the role of the rewriting identities in understanding the group’s structure.

Figure 1
figure 1

Rewriting identities. Controlled-phase gate notation carrying the label a denotes a controlled-(Zm)a gate. (a) This is the only identity that increases the number of controls. (b) This identity preserves the number of controls.

Lemma 1: Let Wm denote the subgroup of diagonal matrices of Gm and let Π= Λ i j ( X ) , X ( j ) denote the subgroup of permutation matrices. Then, Gm is isomorphic to a semi-direct product of groups GmWmΠ.

The proof of Lemma 1 is given in the Supplementary Material. Note that by definition Π=XcX. As X 2 n and cX GL n ( 2 ) , each element πΠ can be associated with an n-bit string c 2 n and an n by n invertible 0–1 linear transformation B GL n ( 2 ) such that π | b = | B b c . Here F 2 denotes the field with two elements. Furthermore, | Π | = 2 n = 0 n 1 ( 2 n 2 ) .

It remains to better understand Wm (see Lemma 3 for the main result). Let Dm denote the group of 2n by 2n diagonal unitary matrices D with elements b | D | b = ω m f ( b ) . Here f: 2 n Z m is a function that assigns mth roots of unity to the diagonal and m is the ring of integers modulo m. Since Gm is generated by permutation matrices and products of m-phase gates, WmDm.

Let Z m [ x 1 , , x n ] denote the polynomial ring whose elements are p ( x ) :=p ( x 1 , , x n ) = α { 0 , 1 } n p α x α where α=α1αn is a multi-index, p α m and x α = x 1 α 1 x n α n is a monomial. The multi-index takes values in {0, 1}n as a convenient notation, as we will evaluate p(x) on binary strings, so x j 2 = x j . The degree of a monomial is denoted |α|. We mainly consider as an additive group. The next Lemma follows from the definition of group isomorphism and the fact that each function f(b) can be expressed as a polynomial in .

Lemma 2: Let p(b) denote evaluation of p on the n-bit binary string b=b1 … bn with operations in m . The function Φ: D m given by b | Φ ( p ) | b = ω m p ( b ) is a group isomorphism.

The proof of Lemma 2 is given in the Supplementary Material. The rewriting identities give the action of Π on Wm by conjugation. Let W ¯ m := Z m ( j ) . On the basis of a similar application of the rewriting identities as in Lemma 1, W m = π W ¯ m π | π Π . As W m D m , Φ−1 associates a polynomial in to each element of Wm. By our chosen convention, matrices representing elements wWm are given modulo a global phase factor ω m such that w | 0 n = | 0 n . Therefore, the preimages Φ−1(w) have zero constant term—i.e., pα=0 when | α | =0. Through Φ, the rewriting identities define an action of Π on that, respectively, takes x1x2xpxj to

(6) 2 x 1 x 2 x p x i x j + x 1 x 2 x p x i + x 1 x 2 x p x j

and x1x2xpxixj to

(7) x 1 x 2 x p x i x j + x 1 x 2 x p x i .

Equation (6) increments the degree of a monomial and multiplies its coefficient by −2, whereas Equation (7) does not change the degree. Another way to understand iterated applications of Equation (6) is to observe that

(8) x 1 x 2 x N = α Z 2 N , | α | 0 ( 2 ) | α | 1 x α .

This fact relates how single qubit Zm gates acting on mod 2 linear combinations of input bits are equivalent to products of certain controlled-phase gates.

There is an element of Wm corresponding to each monomial term of non-zero degree, and the coefficient of this term has the form p α ( 2 ) | α | 1 Z m , as we will now see (see Supplementary Materials for further details.). We choose a subset of qubits J, fix any jJ and define a permutation gate and corresponding polynomial

(9) π J , j : = k J k j Λ k j ( X ) ; p J ( x ) : = α J | α | 0 ( 2 ) | α | 1 x α .

By Equation (8), Φ ( p J ) = π J , j Z m ( j ) π J , j W m ; i.e., this circuit has a polynomial with one term of degree |J|. As Φ(Zm(j))=xj, scaled monomials of successive degrees |α| and with coefficients in ( 2 ) | α | 1 m can be generated inductively by composing these circuits. Take all linear combinations of these over m to find

Lemma 3: Wm is isomorphic to the subgroup W< given by

(10) { p | p = 0 and α , p α ( 2 ) | α | 1 Z m } .

We can now directly compute | G m |.

Corollary 1

(11) | G m | = 2 n = 0 n 1 ( 2 n 2 ) t = 1 n ( L C M ( 2 t 1 , m ) 2 t 1 ) ( n t ) .

Proof: Let om(a)=LCM(a, m)/a denote the order of a in m . Observe that ( 2 ) | α | 1 m o m ( 2 | α | 1 ) as additive groups. Therefore, Wm is isomorphic to a direct product of additive cyclic groups A m := t = 1 n o m ( 2 t 1 ) ( n t ) . This shows that | G m | = | A m | | Π | .

Putting everything together, we have

Theorem 1: Any element of Gm can be written in canonical form as the composition of a sequence of phase gates (comprising an element of Wm whose form is given in Lemma 3), a sequence of CNOT gates and a sequence of bit-flip gates.

Efficient computation in G 2 k

Our next goal is to present efficient methods for computing with Gm. Suppose we fix value of m so that it is not a function of n. Any labelling of group elements will have length proportional to s = log 2 | G m | . If m is odd, then log 2 | G m | = ( 2 n 1 ) log 2 m + log 2 | Π | , whereas if m=2k then log 2 | G 2 k | = t = 1 k ( k t + 1 ) ( n t ) + log 2 | Π | . Therefore, s=Ω(2n) whenever m is odd (see Supplementary Materials for further details.), and in general we cannot efficiently represent elements of Gm as the number of qubits grows. However, s=O(nk) for the special case m=2k, and the story is different. We focus on this special case for the remainder of this article.

An element gGm can be written as a product g=uvw where wWm is a diagonal matrix, vcX is a CNOT circuit and uX is a tensor product of bit-flips. This transforms n-qubit quantum states as g | b = ω m p ( b ) | B b c where pW, B GL n ( 2 ) and c 2 n . Group elements are in bijective correspondence with the triples (p, B, c). The polynomial p has maximum degree k and at most t = 0 k ( n t ) = O ( n k ) nonzero coefficients, each contained in 2 k .

The product of group elements g1, g2Gm,

(12) g 2 g 1 | b = ω m p 1 ( b ) + p 2 ( B 1 b c 1 ) | B 2 B 1 b B 2 c 1 c 2 ,

is given by the triple

(13) ( p 1 ( x ) + p 2 ( B 1 x c 1 ) , B 2 B 1 , B 2 c 1 c 2 ) .

The products B2B1 and B2c1c2 can be computed in O(n3) time, and polynomials in W can be added in O(nk) ring operations. We need to show that p2(B1xc1) can also be computed efficiently.

Consider a triple (p, B, c) and let Bj denote the jth row of B and Jj=supp(Bj). Define x′=Bxc. Then, for any j[n], using Equations (8) and (9),

(14) x j ( x ) = ( J j x ) c j = { p J j ( x ) if c j = 0 1 p J j ( x ) if c j = 1

has maximum degree k. When we substitute x= x 1 x n into the degree k polynomial p(x), computations occur with coefficients in Z 2 k . We compute each monomial (x′)α with O(k) multivariate polynomial multiplications, each of which can be done term-by-term in O(n2k+1) ring operations. We compute the term ( 2 ) | α | 1 pα(x′)α with an additional O(nk) ring operations to multiply each term of (x′)α by a ( 2 ) | α | 1 p α and accumulate the result. There are O(nk) terms in p(x), so the total number of ring operations to compute p(x′) is O(n3k+1). If c ≠ 0n, then it is possible that p(x′) has a non-zero constant term. With additional O(nk) ring operations, p(x′) can be mapped to an equivalent polynomial in W.

Uniformly sampling from G2k is equivalent to uniformly and independently sampling from W, G L n ( 2 ) and 2 n . This can be done efficiently, as elements of W have maximum degree k; see also ref. 28 (see Supplementary Materials for further details.).

Given a triple (p, B, c), we synthesise a corresponding circuit from products of CNOT gates, bit-flip gates and single-qubit m-phase gates. Our goal is to efficiently synthesise a circuit whose size (number of gates) is polynomial in n but not to optimise this circuit. We independently synthesise circuits coinciding with p, B and c. As c corresponds to X(c), and a CNOT circuit for B can be found by Gaussian elimination,14 the new part of the algorithm synthesises a circuit for p.

We describe the circuit synthesis for p informally. The algorithm proceeds in k rounds. Begin by initialising a working polynomial q(x)←p(x), set a round counter tk and set a quantum circuit UI. Here ‘←’ denotes assignment. In round t, we synthesise a circuit corresponding to a polynomial p(t)(x) that coincides with q(x) on its degree t terms. For each of the O(nt) degree-t terms ( 2 ) | α | 1 p α x α of q(x), we apply the constant-sized circuit g α := π J , j ( Z 2 k ( j ) ) p α π J , j setting UgαU, where J=supp(α) as in the proof of Lemma 3. The product of the gα corresponds to p ( t ) ( x ) := α [ n ] , | α | = t p α p J ( x ) . Therefore, we update q(x)←q(x)−p(t)(x), which now has maximum degree t−1, decrement the round counter and proceed to the next round. The algorithm terminates when q(x)=0 and t=0. The total algorithm run-time and circuit size of the output U is O(nk).

Twirling over G 2 k

A quantum channel is a completely positive trace-preserving map whose operator sum decomposition is E ( ρ ) = k A k ρ A k where k A k A k = I . The twirl of E over a finite group G (G-twirl) is given by

(15) E ¯ G ( ρ ) : = 1 | G | U G U E ( U ρ U ) U .

In what follows, we use several facts about group twirls. If G=AB is a direct product of groups, then E ¯ G ( ρ ) = ( E ¯ A ) ¯ B ( ρ ) , and if A is a normal subgroup of G (denoted AG), then E ¯ G ( ρ ) = ( E ¯ A ) ¯ G / A ( ρ ) , where the twirl over the factor group G/A is over a set of coset representatives. Twirling any map over the Pauli group produces a Pauli channel.5 Consider a Pauli channel E ( ρ ) = Q P η Q Q ρ Q . Twirl this channel over any finite group G that has a permutation action on the set P. The orbit of PP is O P := { V P V | V G } and the stabiliser is S P := { V G | V P V = P } . The orbits define an equivalence relation P~Q if and only if OP=OQ. This relation partitions P into a disjoint union of orbits. By the orbit-stabiliser theorem and Lagrange’s theorem,29 | O P | = | G / S P | = | G | / | S P | . Therefore, the twirl, Equation (15), can be written

(16) E ¯ G ( ρ ) = C C\ P O C ( Q O C η Q | O C | ) P ρ P ,

where C is a set of representative elements, one from each orbit.

These facts allow us to compute the twirl over G 2 k when k>1 by expressing it as a sequence of twirls. We begin by decomposing the group. Let W ˜ 2 k := W 2 k / ( W ¯ 2 k \ { I } ) and recall that W ¯ 2 k := Z 2 k ( j ) , then W 2 k = W ˜ 2 k W ¯ 2 k . As cZ W ˜ 2 k and Z W ¯ 2 k , we form the corresponding factor groups. Therefore, an element w W 2 k can be written as w= w ˜ w ¯ = w ˜ 1 w ˜ 2 w ¯ 1 w ¯ 2 where w ˜ 1 labels cosets w ˜ 1 cZ, w ˜ 2 cZ, w ¯ 1 labels cosets w ¯ 1 Z and w ¯ 2 Z. Finally, by Lemma 1, any element g G 2 k factors as g=uvw where uX, vcX and w W 2 k . Therefore, we have g=u w ¯ 2 v w ˜ 2 w ¯ 1 w ˜ 1 where w ¯ 2 =v w ¯ 2 v Z.

Our strategy is to use the decomposition to express the G 2 k -twirl as a sequential P-twirl, cX-twirl, cZ-twirl, W ¯ 2 k /Z-twirl and W ˜ 2 k /cZ-twirl. Each twirl can be computed in a straightforward manner using the facts we have described, and it reduces the number of independent parameters describing the channel until we have twirled over the whole of G 2 k (see Supplementary Materials for further details.). The final twirled map is

(17) E ¯ ( ρ ) = β I ρ + β Z P Z / { I } P ρ P + β R P P / Z P ρ P .

In the Liouville representation in the Pauli basis, which has matrix elements R P Q ( E ¯ ) =Tr ( P E ¯ ( Q ) ) / 4 n where P and Q are n-qubit Pauli operators, this map has three diagonal blocks corresponding to I, Z/ { I } and P/Z with elements 1, αZ:=1−4nβR and αR:=1−2nβZ−(4n−2n)βR, respectively.