This repository implements the Randomized Benchmarking (RB) protocol described in:
Magesan, Gambetta, Emerson
Scalable and Robust Randomized Benchmarking of Quantum Processes (PRL, 2011)
The goal of this project is to faithfully reproduce the RB protocol at the level of both:
- experimental procedure
- theoretical interpretation
The implementation follows the paper step-by-step and supports:
- noiseless simulation
- gate-independent noise
- gate-dependent noise
This codebase is designed not only to reproduce RB results but also to serve as a foundation for further research, including extensions toward correlated noise estimation and Pauli channel learning.
This project implements the full RB pipeline:
- Generate random Clifford sequences
- Construct quantum circuits with noise
- Measure survival probabilities
- Average over random sequences
- Fit exponential decay to extract noise parameters
The implementation preserves the structure of the original protocol:
and computes:
rb_project/
│
├── main.py # Entry point (CLI execution)
├── configs.py # Experiment configuration
│
├── clifford.py # 1-qubit Clifford group (24 elements)
├── sequence.py # Sequence generation and inverse computation
├── noise.py # Noise model Λ_{i_j,j}
├── circuit.py # Quantum circuit (QNode)
│
├── experiment.py # Step 1–3 (RB experiment loop)
├── fitting.py # Step 4 (curve fitting)
├── utils.py # Plotting utilities
│
└── results/ # Output directory
Install required dependencies:
pip install pennylane numpy scipy matplotlibFrom the project root:
python main.pym=1, F=...
m=2, F=...
...
===== FIT RESULT =====
A = ...
p = ...
B = ...
r = ...
results/rb_decay.png
Set:
p_noise = 0Expected:
- F(m) ≈ 1 for all m
- No decay
Expected:
- Smooth exponential decay
- Good fit to:
Expected:
- Deviation from pure exponential
- Visible curvature in residuals
This corresponds to the correction term:
Quantum Process Tomography (QPT):
- scales exponentially
- sensitive to SPAM errors
Randomized Benchmarking solves this by:
- sampling random Clifford sequences
- averaging over sequences
- extracting a single decay parameter
The RB protocol relies on the fact that the Clifford group forms a unitary 2-design.
This implies:
where:
Thus, arbitrary noise is effectively reduced to a depolarizing channel.
RB measures:
which experimentally corresponds to:
Probability of returning to the initial state after applying a random sequence and its inverse.
For gate-independent noise:
where:
-
$p$ : depolarizing parameter -
$A, B$ : SPAM-related constants
For 1 qubit
If noise depends on the gate:
then:
This leads to deviations from exponential decay.
-
Exact 1-qubit Clifford group (24 elements)
-
Random sequence generation
-
Exact inverse gate construction
-
Noise insertion after each gate
-
Support for:
- gate-independent noise
- gate-dependent noise
-
Monte Carlo averaging over sequences
-
Curve fitting to extract:
- decay parameter
$p$ - error rate
$r$
- decay parameter
-
Plot generation
- Faithful implementation of the original RB protocol
- Modular separation of components
- Reproducible experiments via configuration
- Clear mapping between theory and code
- time-dependent noise
- correlated multi-qubit noise
- include correction term explicitly
- estimate
$q - p^2$
- extend Clifford group
- include entangling gates (CNOT)
Move beyond RB:
RB measures a single parameter
This implementation serves as a stepping stone toward:
- correlated noise estimation
- stabilizer-based protocols
- Walsh-Hadamard reconstruction
This repository implements the full Randomized Benchmarking protocol from first principles and verifies its behavior under different noise models.
It provides both:
- a faithful reproduction of the original method
- a structured platform for further research in quantum noise characterization