Download

Download this file as Jupyter notebook: irb_example.ipynb.

Example: Running IRB

This example page demonstrates how to use make_irb() method to estimate the infidelity of a specific gate. This protocol differs from Cycle Benchmarking (CB) in several ways:

  • It estimates the infidelity of a specific gate (not cycle) composed with gates from the twirling group, see Interleaved Randomized Benchmarking (IRB) for more details. Gate infidelity can then be estimated by taking into account the results of an SRB experiment.

  • IRB uses a different twirling group than CB, Cliffords instead of Paulis by default. Paulis being a reference group with no entangling operations and therefore usually higher fidelity, leading to less systematic uncertainty in estimates.

  • Typically uses fewer circuits than CB.

  • IRB only gives information about specific gates (possibly in the context of being simultaneously applied), and not about entire cycles like CB.

We begin by defining some cycles that contain the gates we want to characterize using IRB. Next we generate IRB circuits for these cycles. Note that we could perform simultaneous two qubit IRB with a cycle such as:

{(1, 2): tq.Gate.cz, (3, 4): tq.Gate.cz}

See make_irb() for more details.

[2]:
import trueq as tq

cycle1 = {1: tq.Gate.h}
cycle2 = {2: tq.Gate.h}
cycle12 = {(1, 2): tq.Gate.cz}

# Generate a circuit collection to run IRB on the above cycles with 30 random circuits
# for each circuit length in [4, 32, 64]:
n_random_cycles = [4, 32, 64]
circuits = tq.make_irb(cycle1, n_random_cycles)
circuits += tq.make_irb(cycle2, n_random_cycles)
circuits += tq.make_irb(cycle12, n_random_cycles)
len(circuits)
[2]:
270

We are interested in the gate fidelity of the individual gates in the cycles defined above, e.g. \(CZ\) alone, so we also need a reference SRB experiment to translate from the average fidelity of cycles dressed with gates in the twirling group to fidelity of the undressed gates. Optionally, to tighten the bound on the infidelity estimate, we also do an XRB experiment. The double nesting [[1, 2]] is necessary to characterize the \(CZ\) gate because just [1, 2] refers to simultaneous single-qubit gates.

[3]:
circuits += tq.make_srb([1], n_random_cycles)
circuits += tq.make_srb([2], n_random_cycles)
circuits += tq.make_srb([[1, 2]], n_random_cycles)
circuits += tq.make_xrb([1], n_random_cycles)
circuits += tq.make_xrb([2], n_random_cycles)
circuits += tq.make_xrb([[1, 2]], n_random_cycles)

Create a noisy simulator in lieu of a physical device and populate all circuits with results.

[4]:
sim = tq.Simulator().add_depolarizing(0.01).add_overrotation(0.04)
sim.run(circuits)

Print a summary of the results for the CZ gate:

[5]:
circuits.fit()
[5]:
True-Q formatting will not be loaded without trusting this notebook or rerunning the affected cells. Notebooks can be marked as trusted by clicking "File -> Trust Notebook".
SRB
Streamlined Randomized Benchmarking
Cliffords
(1,)
Key:
  • labels: (1,)
  • protocol: SRB
  • twirl: Cliffords on [1]
Cliffords
(2,)
Key:
  • labels: (2,)
  • protocol: SRB
  • twirl: Cliffords on [2]
Cliffords
(1, 2)
Key:
  • labels: (1, 2)
  • protocol: SRB
  • twirl: Cliffords on [(1, 2)]
${e}_{F}$
The probability of an error acting on the targeted systems during a random gate.
1.2e-02 (9.7e-04)
0.011758959553869436, 0.0009748331506536303
9.5e-03 (9.2e-04)
0.009490997026708747, 0.00091512495259078
1.4e-02 (9.2e-04)
0.013730523546048243, 0.0009215949238271655
${p}$
Decay parameter of the exponential decay $Ap^m$.
9.8e-01 (1.3e-03)
0.9843213872615074, 0.0012997775342048405
9.9e-01 (1.2e-03)
0.9873453372977217, 0.0012201666034543735
9.9e-01 (9.8e-04)
0.9853541082175485, 0.000983034585415643
${A}$
SPAM parameter of the exponential decay $Ap^m$.
1.0e+00 (2.6e-02)
1.0157962898615727, 0.025964067457114378
9.6e-01 (2.4e-02)
0.9578220531615383, 0.024292789226163475
9.6e-01 (2.0e-02)
0.9635427923701171, 0.019538393391573775
XRB
Extended Randomized Benchmarking
Cliffords
(1,)
Key:
  • labels: (1,)
  • protocol: XRB
  • twirl: Cliffords on [1]
Cliffords
(2,)
Key:
  • labels: (2,)
  • protocol: XRB
  • twirl: Cliffords on [2]
Cliffords
(1, 2)
Key:
  • labels: (1, 2)
  • protocol: XRB
  • twirl: Cliffords on [(1, 2)]
${e}_{U}$
The process infidelity of the coherent error acting on the specifed systems during a random gate.
4.6e-03 (1.2e-03)
0.004585192828846313, 0.001154578188852732
2.7e-03 (1.0e-03)
0.002710855565812853, 0.001006583753699151
2.0e-03 (1.0e-03)
0.001972653422998724, 0.0010022121147781227
${e}_{S}$
The probability of a stochastic error acting on the specified systems during a random gate.
7.2e-03 (6.2e-04)
0.007173766725023123, 0.0006186688310891145
6.8e-03 (4.2e-04)
0.006780141460895894, 0.0004192340329181252
1.2e-02 (3.9e-04)
0.011757870123049519, 0.00039381711413299177
${u}$
The unitarity of the noise, that is, the average decrease in the purity of an initial state.
9.8e-01 (1.6e-03)
0.9809385726386386, 0.0016379483872395692
9.8e-01 (1.1e-03)
0.9819809165285841, 0.0011103775116525823
9.8e-01 (8.3e-04)
0.9750640077479803, 0.0008302648824592679
${A}$
SPAM parameter of the exponential decay $Au^m$.
1.1e+00 (3.6e-02)
1.0701774273919358, 0.03565750069183963
1.0e+00 (3.3e-02)
1.0360121307566095, 0.033447786234339916
1.0e+00 (2.1e-02)
1.0344082684243896, 0.02088853299865692
IRB
Interleaved Randomized Benchmarking
Cliffords

(1,) : Gate.h

Key:
  • cycles: (Cycle((1,): Gate.h),)
  • labels: (1,)
  • protocol: IRB
  • twirl: Cliffords on [1]
Cliffords

(2,) : Gate.h

Key:
  • cycles: (Cycle((2,): Gate.h),)
  • labels: (2,)
  • protocol: IRB
  • twirl: Cliffords on [2]
Cliffords

(1, 2) : Gate.cz

Key:
  • cycles: (Cycle((1, 2): Gate.cz),)
  • labels: (1, 2)
  • protocol: IRB
  • twirl: Cliffords on [(1, 2)]
${e}_{F}$
The probability of an error acting on the targeted systems during a dressed gate of interest.
2.1e-02 (2.9e-03)
0.021093664013554086, 0.0029141219916910357
2.0e-02 (2.9e-03)
0.01990418720407644, 0.0028520173860329305
3.5e-02 (4.2e-03)
0.03496536920037756, 0.004219184065525094
${e}_{IU}$
An upper bound on the inferred value of $e_F$ that accounts for systematic errors in the interleaved estimate.
3.5e-02 (5.9e-03)
0.03459206148845681, 0.005926140665563726
2.8e-02 (5.4e-03)
0.027869344355720943, 0.005440723344269535
3.9e-02 (7.2e-03)
0.03903401069615238, 0.007199612175120021
${e}_{IL}$
A lower bound on the inferred value of $e_F$ that accounts for systematic errors in the interleaved estimate.
2.6e-03 (1.5e-03)
0.0025679282712938456, 0.0014745467824726062
4.0e-03 (2.0e-03)
0.003962212833889006, 0.001952274427456648
1.2e-02 (3.9e-03)
0.011847368986824744, 0.0038589643779205632
${p}$
Decay parameter of the exponential decay $Ap^m$.
9.7e-01 (3.9e-03)
0.9718751146485946, 0.0038854959889213806
9.7e-01 (3.8e-03)
0.9734610837278981, 0.0038026898480439074
9.6e-01 (4.5e-03)
0.9627036061862639, 0.004500463003226767
${A}$
SPAM parameter of the exponential decay $Ap^m$.
9.9e-01 (6.2e-02)
0.9854916458889367, 0.06241916469896712
9.7e-01 (5.9e-02)
0.9707933791929099, 0.058704789302290186
1.1e+00 (7.7e-02)
1.054062281287234, 0.07658038604755033

Plot a summary of information:

[6]:
circuits.plot.irb_summary()
../../_images/guides_error_diagnostics_irb_example_10_0.png

For a refresher on the parameters plotted above, see Interleaved Randomized Benchmarking (IRB).


Download

Download this file as Jupyter notebook: irb_example.ipynb.