By Sara Metwalli, Adrien Suau, and Amirreza Safehian
Two new Deltakit packages were released today to push the analysis of Quantum Error Correction (QEC) techniques beyond Clifford gates. deltakit-compile is an MLIR-based program representation that allows you to better express and control your QEC programs through a large collection of implemented transformations. deltakit-visualise renders those programs as interactive 3D spacetime structures, so you can see what you have built rather than infer it from the code.
Why we need a new representation
Practical QEC has been built around Stim, and for good reason. Stim is an outstanding stabiliser simulator, and its circuit format has become the field’s default interchange layer. That format does exactly what it was designed to do.
However, Stim’s circuit format describes what a Clifford simulator needs to consume. It was never intended to serve as a general representation of a quantum program, and it does not try to.
As the field moves towards larger fault-tolerant workloads, we increasingly need to express things that sit outside that scope: classical control flow interleaved with quantum operations, non-Clifford resources and the routines that produce them, and hierarchical structure across a program rather than a flat list of instructions.
You can work around this. Most of us have. But the workarounds are bespoke, they do not compose, and they are not easily reusable between research groups. What the field is missing is a shared, well-specified representation that these workloads can be built on top of. This is where our two new packages come in.
deltakit-compile
deltakit-compile is built on xDSL (https://xdsl.dev), which is itself based on an MLIR (Multi-Level Intermediate Representation), part of the LLVM (Low-Level Virtual Machine) toolchain. That means we are not reinventing compiler infrastructure. We are inheriting two decades of work on how to represent programs, define transformations over them, and keep those transformations composable and testable.
On top of that foundation, we have added a set of dialects and passes specific to QEC, drawn from our team’s work on error-corrected architectures. The result is modular and reusable: you can take the passes that are useful to you, write your own alongside them, and rely on a specification rather than on undocumented conventions.
Here is what a memory experiment looks like in deltakit-compile:
Example code:
from deltakit_compile.frontend.logasm import LogAsmBuilder, RotatedPlanarPatch
from deltakit_visualise.logical_assembly_visualiser import LogicalAssemblyVisualiser
rounds = 20
builder = LogAsmBuilder()
p = builder.declare_patch(RotatedPlanarPatch(3, 3, location=(0, 0)))
p.prepare("Z")
p.measure_stabilisers(rounds)
b = p.measure("Z")
builder.add_return(b)
program = builder.build_program()
LogicalAssemblyVisualiser(program).visualise()
For hardware teams, deltakit-compile can target Riverlane’s Deltaflow hardware directly, so the same program representation carries from design through to execution.
deltakit-visualise
deltakit-visualise turns a compiled program into a 3D spacetime view you can rotate, slice and inspect.
Time runs along one axis, so a memory experiment becomes a structure you can scrub through round by round rather than a wall of instructions. Figure 1 shows a slice through a 20-round quantum memory program, where you can inspect the logical patch in a single round.
Different programs call for different views. Figure 2 shows a CNOT program, where the implicit parallelism in the schedule becomes visible in a way it simply is not in a text listing. Figure 3 shows a logical patch in a rotated planar code, lifted directly from a program.
The package is structured the same way as the compiler: customisable passes and pipelines you can extend. If you add a pipeline in deltakit-compile, you can add a matching visualisation pass so your view keeps up with your changes. It works with deltakit-compile and with other MLIR-based compilers.
In practice, this is useful for two things: understanding a program while you are still building it, and finding the point where it went wrong when it does not behave the wayas you expected.
What’s next
Together, deltakit-compile and deltakit-visualise give users the ability to design and understand error correcting codes that will take us one step closer to fault-tolerant quantum computers.
You just need to run the following command to get started with these two new packages:
pip install deltakit-compile deltakit-visualise
And here are the repo links: