Clifford Circuits: Simulating Thousands of Qubits in Milliseconds with Stim
· 4 min read · ZKSF team
The fastest simulation result on this platform is not a 30-qubit or a 100-qubit circuit. It is a 5,000-qubit GHZ circuit, 5,000 qubits with 5,000 layers of depth, simulated exactly in 0.56 seconds on a laptop. The result relies on the most underused theorem in quantum computing, not on any trick.
The left side builds a GHZ state one gate at a time, an illustrative 8-qubit chain standing in for the real 5,000-qubit headline result, tracking stabilizer storage instead of a statevector: 6.25 MB at n=5,000, versus a statevector number too large to write down. The reported wall times underneath (0.01s at 100 qubits up to 0.56s at 5,000) are the actual benchmarks. The right side is the important idea: a Clifford circuit stays easy no matter how entangled it gets, a GHZ state at 5,000 qubits is about as entangled as a physical system can be, and it's still trivial to simulate. What actually makes a circuit hard is non-Clifford content, "magic," tracked separately from entanglement. Whether a circuit is Clifford is decided by a single scan of its gate list.
The Gottesman-Knill theorem (1998) establishes that circuits built entirely from Clifford gates, Hadamard, S, CNOT, CZ, the Pauli gates, and measurement, can be simulated classically in polynomial time. Not approximately: exactly. The restriction is strict; a single T gate or arbitrary rotation returns the circuit to exponential cost.
How the method works
Instead of tracking 2^n amplitudes, a stabilizer simulator tracks the group of Pauli operators that leave the state invariant, its stabilizers. For n qubits that is n operators, each describable in about 2n bits, quadratic total storage rather than exponential. Clifford gates map Pauli operators to Pauli operators, so each gate updates the table in linear time. A 5,000-qubit state fits in roughly 6 MB.
Circuit Qubits Method Wall time
GHZ (Clifford) 100 stabilizer 0.01 s
GHZ (Clifford) 500 stabilizer 0.06 s
GHZ (Clifford) 1,000 stabilizer 0.11 s
GHZ (Clifford) 5,000 stabilizer 0.56 sThe reference open-source implementation is Stim, an engine built specifically for this workload: vectorized, cache-tuned, and capable of sampling circuits with millions of qubits. A router that scans a circuit's gate list and finds nothing outside the Clifford family selects this engine automatically.
Why a restricted gate set matters
Quantum error correction is built almost entirely from Clifford operations. Surface codes, repetition codes, syndrome extraction circuits, and stabilizer measurements together make up the machinery that current roadmaps depend on, and essentially every error-correction paper published relies on stabilizer simulation, usually at scales of hundreds to thousands of physical qubits that no other method reaches.
Clifford circuits also anchor hardware verification. Randomized benchmarking, GHZ-state fidelity tests, and many device-calibration protocols are Clifford by design, precisely so that their ideal outcomes can be computed classically and compared directly against measured hardware output.
There is a useful lesson in where the boundary actually sits.
- Entanglement alone does not make simulation hard. A 5,000-qubit GHZ state is about as entangled as a physical system gets, yet it simulates trivially.
- The hardness lives in non-Clifford resources, often called magic. Researchers track T-gate count for this reason, much as an accounting department tracks a budget line.
- The identity 'more entanglement equals more quantum power' does not hold as a general rule, and treating it as one leads to mispriced simulation budgets.
For work that touches error correction, hardware verification, or stabilizer states, the practical rule is straightforward: confirm whether a circuit is Clifford (a single scan of its gate list; the router here performs this automatically). When it is, the qubit ceiling is effectively removed, the answer is exact, and the cost is negligible.
Run your own 100-qubit circuit, with an error bar.