Deltakit is a Python package providing a toolkit to create, execute, analyse and benchmark quantum error correction (QEC) experiments. You can use Deltakit to design new high-level QEC logic, and to compile and run it on real hardware and simulators.
For more detailed information, check out the Deltakit documentation.
For any usage questions or comments, visit our Q&A forum.
Standard QEC experiments proceed through several fundamental stages, each of which is facilitated by the functionality provided in the deltakit package:
- Circuit generation: brings together a representative noisy circuit for the experiment of choice and a quantum error correcting code.
- Simulation: generates measurement results by executing and sampling the circuit on the numerical simulator Stim.
- Decoding & analysis: uses either a standard decoder of choice or Riverlane's proprietary ones to decode measurement samples, apply corrections and produce interpretable relevant metrics.
deltakit is publicly available on PyPI and can be locally installed with pip:
pip install deltakitdeltakit helps the design and execution of complete QEC experiments. The first step is to define an encoding process from a quantum circuit and a parametrisable code chosen from a standard family. For instance, here we use the rotated surface code from the Calderbank–Shor–Steane (CSS) family. The next step is to declare a QPU instance together with a noise model and a native gate set to compile the circuit to. This produces a QPU compliant noisy circuit that can be executed either on numerical simulators (Stim) or physical hardware to generate noisy bitstring samples. The final step is to apply the decoding process on these bitstrings and correct the circuit. In the following example, a Minimum Weight Perfect Matching-based decoder publicly available from the PyMatching library is used and the logical error probability (LEP) is generated for interpretation.
from deltakit.circuit.gates import PauliBasis
from deltakit.decode import PyMatchingDecoder
from deltakit.decode.analysis import run_decoding_on_circuit
from deltakit.explorer.analysis import calculate_lep_and_lep_stddev
from deltakit.explorer.codes import RotatedPlanarCode, css_code_memory_circuit
from deltakit.explorer.qpu import QPU, ToyNoise
# Step 1. Encoding
# Create a noisy memory circuit with the rotated planar code
d = 3 # Code distance.
rplanar = RotatedPlanarCode(width=d, height=d)
circuit = css_code_memory_circuit(rplanar, num_rounds=d, logical_basis=PauliBasis.Z)
# Step 2. Declare a noisy QPU instance
qpu = QPU(circuit.qubits, noise_model=ToyNoise(p=0.01))
noisy_circuit = qpu.compile_and_add_noise_to_circuit(circuit)
# Step 3. Perform simulation and correct the measured observable flips with a decoder
num_shots, batch_size = 100_000, 10_000
decoder, noisy_circuit = PyMatchingDecoder.construct_decoder_and_stim_circuit(noisy_circuit)
result = run_decoding_on_circuit(
noisy_circuit, num_shots, decoder, batch_size, min_fails=100
)
# Step 4. Print relevant results
fails = result["fails"]
lep, lep_stddev = calculate_lep_and_lep_stddev(fails, num_shots)
print(f"LEP = {lep:.5g} ± {lep_stddev:.5g}")deltakit allows access to advanced simulation capabilities on the cloud platform via token authentication. To generate a personal access token, please follow the steps described on the Deltakit website. The generated token can be registered locally by executing the following code once.
from deltakit.explorer import Client
Client.set_token("<your-token>")N.B.set_token does not need to be called again, except in case of token revocation.
An instance of the cloud API is required to execute a remote experiment:
from deltakit.explorer.codes import css_code_stability_circuit, RotatedPlanarCode
from deltakit.circuit.gates import PauliBasis
from deltakit.explorer import Client
# Instantiate a cloud client.
# A token needs to be registered first.
client = Client.get_instance()
# Generate a stability experiment with the rotated planar code.
circuit = css_code_stability_circuit(
RotatedPlanarCode(3, 3),
num_rounds=3,
logical_basis=PauliBasis.X,
client=client
)
# Display the resulting circuit
print(circuit)There are various ways to contribute to deltakit:
- Submitting issues: To submit bug reports or feature requests, please use our issue tracker.
- Developing in
deltakit: To learn more about how to develop withindeltakit, please refer to contributing guidelines. - Security: For any security concern, please see our security policy.
Note: Any contribution will require a Contribution Licence Agreement signature when a Pull Request is created. The recommended contributing workflow is detailed in our contributing guidelines.
This project is distributed under the Apache 2.0 License.
If you find this toolkit useful, please consider citing it:
@software{deltakit,
author = {Prawiroatmodjo, Guen and Burton, Angela and Suau, Adrien and Nnadi, Chidi and Bracken Ziad, Abbas and Melvin, Adam and Richardson, Adam and Walayat, Adnaan and Moylett, Alex and Virbule, Alise and Safehian, AmirReza and Patterson, Andrew and Buyskikh, Anton and Ruben, Archi and Barber, Ben and Reid, Brendan and Manuel, Cai Rees and Seremet, Dan and Byfield, David and Matekole, Elisha and Gallardo, Gabriel and Geher, Gyorgy and Turner, Jack and Lal, Jatin and Camps, Joan and Majaniemi, Joonas and Yates, Joseph and Johar, Kauser and Barnes, Kenton and Caune, Laura and Zigante, Lewis and Skoric, Luka and Jastrzebski, Marcin and Ghibaudi, Marco and Turner, Mark and Haberland, Matt and Stafford, Matthew and Blunt, Nick and Gillett, Nicole and Crawford, Ophelia and McBrien, Philip and Ishtiaq, Samin and Protasov, Stanislav and Wolanski, Stasiu and Hartley, Tom},
title = {Deltakit},
month = sep,
year = 2025,
publisher = {Zenodo},
doi = {10.5281/zenodo.17145113},
url = {https://doi.org/10.5281/zenodo.17145113},
}