# Interleaved randomized benchmarking (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), not an 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.

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)

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.

circuits += tq.make_srb(, n_random_cycles)
circuits += tq.make_srb(, n_random_cycles)
circuits += tq.make_srb([[1, 2]], n_random_cycles)
circuits += tq.make_xrb(, n_random_cycles)
circuits += tq.make_xrb(, 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.

sim = tq.Simulator().add_depolarizing(0.01).add_overrotation(0.04)
sim.run(circuits)


Print a summary of the results for the CZ gate:

circuits.fit()

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  Cliffords (2,) Key: labels: (2,) protocol: SRB twirl: Cliffords on  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.0e-02 (1.1e-03) 0.010378678286661946, 0.0010921091855105132 1.0e-02 (8.9e-04) 0.010020969924889683, 0.0008924906526627293 1.5e-02 (9.4e-04) 0.014614824459989982, 0.0009376303065799506 ${p}$ Decay parameter of the exponential decay $Ap^m$. 9.9e-01 (1.5e-03) 0.9861617622844507, 0.0014561455806806844 9.9e-01 (1.2e-03) 0.9866387067668138, 0.0011899875368836389 9.8e-01 (1.0e-03) 0.984410853909344, 0.0010001389936852806 ${A}$ SPAM parameter of the exponential decay $Ap^m$. 9.9e-01 (2.5e-02) 0.9904227690166243, 0.025480625295485296 9.8e-01 (2.5e-02) 0.9838820492908029, 0.02514576645069323 9.9e-01 (1.9e-02) 0.9854597450672223, 0.019354145875507517 XRB Extended Randomized Benchmarking Cliffords (1,) Key: labels: (1,) protocol: XRB twirl: Cliffords on  Cliffords (2,) Key: labels: (2,) protocol: XRB twirl: Cliffords on  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. 3.5e-03 (1.2e-03) 0.0035338110296041503, 0.0011952799782960746 3.7e-03 (1.1e-03) 0.003678100110014043, 0.0010773248858548204 2.1e-03 (1.0e-03) 0.00205522102682789, 0.0009973426841300209 ${e}_{S}$ The probability of a stochastic error acting on the specified systems during a random gate. 6.8e-03 (4.9e-04) 0.006844867257057796, 0.0004857898243469372 6.3e-03 (6.0e-04) 0.00634286981487564, 0.0006033981642263732 1.3e-02 (3.4e-04) 0.012559603433162092, 0.0003399144565482061 ${u}$ The unitarity of the noise, that is, the average decrease in the purity of an initial state. 9.8e-01 (1.3e-03) 0.9818094902582014, 0.0012865724199585414 9.8e-01 (1.6e-03) 0.9831393231569827, 0.0015988557019310672 9.7e-01 (7.2e-04) 0.9733744392235458, 0.0007160432336485587 ${A}$ SPAM parameter of the exponential decay $Au^m$. 1.0e+00 (3.3e-02) 0.9977519865067824, 0.03266677411994535 1.1e+00 (3.4e-02) 1.0519785296194566, 0.03407731701643016 1.0e+00 (1.9e-02) 1.0451122247311946, 0.019157298661284548 IRB Interleaved Randomized Benchmarking Cliffords (1,) : Gate.h Key: cycles: (Cycle((1,): Gate.h),) labels: (1,) protocol: IRB twirl: Cliffords on  Cliffords (2,) : Gate.h Key: cycles: (Cycle((2,): Gate.h),) labels: (2,) protocol: IRB twirl: Cliffords on  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.0e-02 (2.4e-03) 0.020248088707584766, 0.0024035642074237717 2.5e-02 (4.2e-03) 0.02543913292540767, 0.004207472305567472 2.8e-02 (2.3e-03) 0.02824639945303995, 0.0022763556935825337 ${e}_{IU}$ An upper bound on the inferred value of $e_F$ that accounts for systematic errors in the interleaved estimate. 3.1e-02 (5.3e-03) 0.030805838408997366, 0.005310385344209074 4.0e-02 (7.3e-03) 0.03961689466290222, 0.007272275550207393 2.9e-02 (5.0e-03) 0.029375252027849, 0.005038859536145379 ${e}_{IL}$ A lower bound on the inferred value of $e_F$ that accounts for systematic errors in the interleaved estimate. 3.2e-03 (1.6e-03) 0.0032204915232663667, 0.0016011116255540284 6.1e-03 (2.7e-03) 0.006103370967915883, 0.0026996590527222685 6.5e-03 (2.3e-03) 0.006498760549310846, 0.002271224369727628 ${p}$ Decay parameter of the exponential decay $Ap^m$. 9.7e-01 (3.2e-03) 0.973002548389887, 0.0032047522765650295 9.7e-01 (5.6e-03) 0.9660811560994564, 0.005609963074089962 9.7e-01 (2.4e-03) 0.9698705072500907, 0.002428112739821369 ${A}$ SPAM parameter of the exponential decay $Ap^m$. 9.2e-01 (5.7e-02) 0.9170879784558287, 0.05740726181291256 1.0e+00 (9.1e-02) 1.0072770186081166, 0.09114077517020312 9.5e-01 (4.2e-02) 0.9468417696975395, 0.04213413477272197

Plot a summary of information:

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

Total running time of the script: ( 0 minutes 6.510 seconds)

Gallery generated by Sphinx-Gallery