Methods

The techniques behind each tool: where each comes from, what it does on our benchmarks, and where its code is. Some reproduce published methods, some extend them, and some were designed here. The measured effects come from the scripts behind the benchmarks.

Compiler

Phase folding published

Every wire carries a parity of the circuit's inputs: CNOTs XOR parities, X gates flip them, and other gates start new ones. Diagonal rotations on the same parity merge into one, however many gates lie between them, and the CNOTs they kept apart then cancel.

Adders: 19% fewer CNOTs than Qiskit at level 3 (196 against 241 at 32 qubits; 181 since 0.4.13, with gathering and Pauli pairs); QFT, QAOA and Heisenberg chains: 7–25% fewer gates in all; compiling through CNOTs first does the same for CZ devices (adders: 40 CZs instead of 49).

Amy, Maslov and Mosca, IEEE TCAD 2014; Nam, Ross, Su, Childs and Maslov, npj QI 2018 · phase_folding.rs

Rotation merging through Cliffords published

Phase folding stops at Hadamards. Moved through every Clifford gate before it with a stabilizer tableau, each Z rotation is a rotation about a Pauli string, and rotations about the same string merge whenever everything between them commutes with it.

Since 0.4.12 the tableau takes each gate in one update, where a √X, a CZ or an X used to be three or four (H S H, H CX H, H S S H): the same outputs, byte for byte, with rotation merging 41% cheaper on a CZ chip compilation of the 16-qubit Hamiltonian (1.37 → 0.81 billion instructions). That made CZ compilations 0.97–0.98× the time; the 16-qubit Hamiltonian on a heavy-hex chip still takes 2.6 s, against Qiskit's 0.11–0.15 s, most of it in rounds of the whole pipeline.

Zhang and Chen, arXiv:1903.12456 · pauli_network.rs (apply_all_to_map)

Pauli networks extended

A Hamiltonian simulation step is a list of Pauli rotations, each conventionally written with its own CNOT ladders. QCC reads the circuit back as rotations and one Clifford, and builds it again greedily: each controlled-Pauli gate is the one that most lowers the weights of the rotations coming next, so commuting rotations share their CNOTs. It is kept only when it needs no more two-qubit gates and no more gates in all.

One Trotter step of random Hamiltonians: 47% fewer CNOTs than Qiskit at 8 qubits (101 against 191), 20% at 16 (313 against 393) and 7% at 32 (687 against 740), with 39%, 18% and 15% fewer gates in all (286, 790 and 1511 against 474, 972 and 1789).

After Rustiq: Goubault de Brugière and Martiel, arXiv:2404.03280, and pytket's GreedyPauliSimp, whose seeded trials QCC also runs; Clifford synthesis after Bravyi et al., arXiv:2105.02291 · pauli_network.rs

Pauli networks on the chip's couplings extended

A Pauli network synthesized as if every qubit were coupled puts its CNOTs on pairs far apart, and routing them costs more than the network saves. On a chip QCC also synthesizes it on the physical qubits, from each initial layout its routings found: every CNOT that sets up a rotation is on a coupled pair, and each candidate is scored by what it does to every rotation's spanning tree on the chip (the minimum spanning tree of its qubits under the chip's distances) rather than to its weight, so commuting rotations still share CNOTs. The Clifford left at the end is synthesized on the chip too, or routed (next entry), and the best trial of each is optimized as one more candidate, kept only if it is the cheapest.

Since 0.4.15, on a 19-qubit heavy-hex chip: Hamiltonians at 8 and 16 qubits 335 → 189 and 1321 → 1078 CNOTs (Qiskit 425 and 1463), with CZ 307 → 184 and 1231 → 1095; on 24 held-out random Hamiltonians 15–35% fewer two-qubit gates, every one. Two-qubit gates against Qiskit on the chip 0.924× → 0.880× with CX, 0.897× → 0.862× with CZ. The 16-qubit Hamiltonian takes 2.8× the time with CX (1.4 s) and 1.5× with CZ (3.0 s).

Architecture-aware Pauli synthesis as in Paulihedral (Li et al., ASPLOS 2022, arXiv:2109.03371) and Tetris (Jin et al., ISCA 2024, arXiv:2309.01905), here inside the Rustiq-style greedy network · pauli_network.rs (synthesize_on) · device.rs (networks_on_chip)

Clifford synthesis on the chip's couplings published

A Pauli network on a chip ends with a Clifford, what is left of the rotations' frame. Synthesized as if every qubit were coupled and then routed, it cost about a tenth of the network's CNOTs. QCC also synthesizes it with every CNOT on a coupled pair: one row of its tableau at a time, the row's two Pauli images are gathered onto one qubit along Steiner trees of the qubits still free (whichever image first needs fewer CNOTs), and that qubit is taken out; the row and qubit needing fewest CNOTs go first, and never a qubit whose removal would split the free ones. Both endings are kept and the best of each optimized, so no circuit gets costlier.

Since 0.4.16, on a 19-qubit heavy-hex chip: Hamiltonians at 8 and 16 qubits 189 → 187 and 1078 → 1063 CNOTs, with CZ 184 → 181 and 1095 → 1030; on 22 held-out random Hamiltonians of 6–16 qubits 10874 → 10463 CNOTs (−3.8%) and 10589 → 10214 CZs (−3.5%), none with more two-qubit gates. Dropping the Clifford altogether would give 9601 CNOTs there, so most of its cost remains. The chip Hamiltonians take 1.10–1.38× the time.

Winderl et al., "Architecture-Aware Synthesis of Stabilizer Circuits from Clifford Tableaus", arXiv:2309.08972; Steiner trees by the heuristic of Takahashi and Matsuyama · pauli_network.rs (clifford_on)

Cheap frames for Pauli networks ours

Single-qubit gates are most of what a Pauli network costs. The basis changes that set up each CNOT are not undone after it: the rotations still to come are read in the new frame, which leaves their weights alone, and the frame is paid for once, at the end. Each CNOT is placed whichever way round needs fewer basis changes, and those use √X, native on IBM devices, rather than Hadamards.

About half the network's single-qubit gates: on a 16-qubit Hamiltonian, 792 gates in all instead of 1285, against Qiskit's 972 and pytket's 887.

pauli_network.rs

A charge for local Cliffords, and trials judged one by one ours

The greedy synthesis of a Pauli network charges each candidate CNOT for the single-qubit Cliffords it needs; a hundredth of a weight only breaks ties. Besides its eight seeded trials at that charge, QCC runs four at a tenth of a weight, which give up a few CNOTs for fewer single-qubit gates, and compares every trial with the direct compilation on its own, keeping the first of the cheapest that needs no more two-qubit gates and no more gates in all. Before, only the trial with the fewest CNOTs was compared, and on a 32-qubit Hamiltonian it needed more gates in all, so no network was kept. The usual trials still run, so no circuit can get worse.

32-qubit Hamiltonian: 740 → 687 CNOTs and 1555 → 1511 gates (Qiskit 740 and 1789, pytket 737 and 1681); 8 qubits 107 / 293 → 101 / 286; on a heavy-hex chip at 8 qubits 349 / 713 → 345 / 648 with CX and 331 / 1333 → 310 / 1119 with CZ. On 15 held-out random Hamiltonians, 0.981× the CNOTs and 0.980× the gates, worse on none. It costs 1.3–1.5× the time on Hamiltonians (32 qubits 0.33 s → 0.40–0.45 s); nothing else changes.

passes.rs (network_trials, paying_network) · pauli_network.rs

Gate counts without Euler angles ours

Two-qubit synthesis prices every way of moving a rotation across a gate by the single-qubit gates it leaves, hundreds of thousands of counts on a large circuit. A count only asks whether some Euler angles are multiples of 2π, and those angles are the phases of products of the unitary's entries, so QCC tests the products directly instead of computing the angles with arctangents. With sparse parities in phase folding and cheaper Clifford tracking in rotation merging, every benchmark circuit compiles faster and to the same gates.

0.73× the time of the previous version in geometric mean over 24 circuits, identical outputs; the 32-qubit Quantum Volume circuit 230 ms → 155 ms (Qiskit: 69 ms).

one_qubit.rs

Two-qubit synthesis in context ours

Runs of gates on one pair of qubits are resynthesized from their 4×4 unitary with the fewest two-qubit gates (KAK). Many syntheses use that many; they differ in their single-qubit gates. A block's outer gates merge with its neighbours' afterwards, so QCC picks the one with the fewest gates between its first and last two-qubit gate, not the fewest in isolation.

Quantum Volume: 1% fewer gates than synthesizing each block alone, which brings QCC level with Qiskit there.

KAK and templates after Vatan and Williams, PRA 2004 · two_qubit.rs

Moving gates through symmetric blocks ours

An XX + YY + ZZ interaction, as in Heisenberg models, commutes with the same rotation on both qubits, so the single-qubit gates around such a block are not fixed: a factor can pass through it from one side to the other. Blocks are synthesized one at a time, so QCC then picks, for each symmetric block, the factor that leaves the gates between it and its neighbours cheapest.

Heisenberg chains: 8–9% fewer gates with CX (1173 against Qiskit's 1568 at 32 qubits; 1143 with Pauli pairs), and with CZ 7–13% fewer than Qiskit instead of a fifth more.

symmetric_blocks.rs

Optimizing to a fixed point for CZ devices extended

For a CZ device QCC reads the circuit through CX, each CZ as H·CX·H, so that phase folding sees parities, then translates it back. Every translation leaves single-qubit gates where the next reading finds more to fold, so one run of the pipeline is far from a fixed point (for CX it nearly is one). QCC runs the pipeline again on its own result while it gets cheaper, up to eight rounds, keeping a round only when it is strictly cheaper. Qiskit's level 3 loops its optimizations the same way, and GUOQ alternates rewriting and resynthesis until nothing improves.

On a heavy-hex chip with CZ: 0.908× Qiskit's two-qubit gates and 0.848× its gates, from 0.917× and 0.868×; the 16-qubit Hamiltonian 1379 → 1292 CZs, 5372 → 4572 gates (Qiskit: 1477, 5357). No circuit got worse; compiling for CZ took 1.65× as long, of which 0.4.5 won back most by running candidates side by side (below).

Xu, Molavi, Tannu and Albarghouthi, Optimizing Quantum Circuits, Fast and Slow, ASPLOS 2025; passes.rs

Independent candidates side by side ours

Much of compiling is several candidates worked out from the same input and compared at the end: SABRE's 32 layout trials, the direct compilation and the one through CX for a CZ device (in every round of the fixed point above), the Pauli networks, and on a chip the routing of the logical circuit with and without a network. QCC runs them on all cores and takes the results back in the order a loop would produce them, so the first of the cheapest is kept as before and the output does not depend on the threads; the direct candidates, which were compiled twice to try a network, are compiled once. Under 64 instructions everything stays on one thread.

The 112 compilations of the benchmark circuits give byte-identical outputs. On 4 vCPUs, against 0.4.4: 0.51× the time on a heavy-hex chip with CX and 0.62× with CZ (the 16-qubit Hamiltonian with CZ 5.6 s → 2.2 s, still slower than Qiskit's 0.15 s), 0.82× inside Qiskit with CZ; unchanged with CX without a chip.

parallel.rs

Syntheses shared across a compilation ours

A compilation for a CZ device runs the pipeline many times on circuits that differ little: the direct pipeline and the one through CX, round after round, on each candidate's qubits. Most blocks come back with the same unitary to the bit, and each pipeline synthesized them again. QCC keeps one compilation's two-qubit syntheses, for each set of native gates, shared by every pipeline on every thread. A synthesis depends only on the unitary, its objective and the native gates, so this changes no output.

On the 16-qubit Hamiltonian on a heavy-hex chip with CZ, 66% of the synthesis requests had been made before in the same compilation. With block gathering that no longer copies what it tries: 0.83× the time of 0.4.5 on the chip with CZ (the Hamiltonian 2.1 s → 1.6 s, still slower than Qiskit's 0.15 s) and 0.82× inside Qiskit with CZ, byte-identical outputs; unchanged with CX.

lower.rs (SynthesisCache)

Gathering blocks through commuting gates extended

Two gates on the same pair of qubits fall in different blocks when a gate on one of them and a third qubit lies between, even if that gate commutes with one of them: cx a,b; cx a,c; cx b,a is a SWAP and one CNOT once cx a,c moves aside. QCC moves such gates out of the way when they commute exactly with what they cross (single-qubit gates counted together), taking along the gates that depend on them, and only where the gathered block needs fewer CNOTs; the circuit is kept only when it needs no more two-qubit gates and no more gates in all.

Random Clifford+T: 150 CNOTs instead of 154 at 16 qubits, and 310 at 32, as many as pytket with fewer gates in all (1034 against 1039). On a heavy-hex chip: the 16-qubit QFT 353 CNOTs instead of 357 (Qiskit 356), the 16-qubit QAOA 180 instead of 188, both with CX; four of the 32 chip results got worse in one count or both.

As tket's Clifford simplification: Fagan and Duncan, arXiv:1901.10114; Sivarajah et al., arXiv:2003.10611 · commuting_blocks.rs

Carrying gates between blocks extended

When the gates between two blocks on a pair do not commute with them, part of a block may still commute with them once moved through the single-qubit gates between: in cx a,b; h b; cx b,c; cx a,b, h b · cx a,b is cz a,b · h b, and the CZ commutes with the control of cx b,c, so it joins the last CNOT and the pair needs one CNOT instead of two. QCC carries the end of a block (from one of its last three two-qubit gates) forward into the next block on its pair, or the start of one back: across a single-qubit gate g the carried part D becomes g D g†, across any other gate it must commute exactly. A move is made only where the two blocks then need fewer CNOTs, on results that will not be optimized again, and the circuit is kept only when it needs no more two-qubit gates and no more gates in all. Gates stay on their pairs, so it is safe on a chip.

On a heavy-hex chip: the 16-qubit Hamiltonian 1336 → 1321 CNOTs, and with CZ 1256 / 4454 → 1231 / 4208 CZs / gates; the 8-qubit one 345 → 335 CNOTs; QAOA 8 94 → 92; the 16-qubit adder 148 → 146. Without a chip, random Clifford+T 150 / 505 → 148 / 499 at 16 qubits (pytket 148 / 495) and 310 / 1034 → 308 / 1030 at 32. No benchmark circuit got more two-qubit gates, and on 82 held-out compilations 22 got fewer and none more. It costs 1.05× the time without a chip and 1.07× on it; the 16-qubit Hamiltonian with CZ on the chip 1.5 → 2.4 s. The largest wins (733 → 704 CNOTs on the 16-qubit Clifford+T circuit on the chip) need more single-qubit gates, and are refused.

Rewrites of this kind appear in ZX-calculus Clifford simplification: Fagan and Duncan, arXiv:1901.10114; extended here to any gates of a block with exact checks · commuting_blocks.rs · device.py

Single-qubit trades through CNOTs ours

A CNOT commutes with a Z rotation on its control and an X rotation on its target, so the runs of single-qubit gates on either side can hand such a rotation across. QCC chooses the angles that make both runs cheapest. It hides Z rotations from phase folding, so it runs only on a circuit that will not be optimized again.

With gathering, random Clifford+T: 278, 505 and 1034 gates in all at 8, 16 and 32 qubits, instead of 293, 525 and 1074.

symmetric_blocks.rs

Pauli and rotation pairs around two-qubit gates extended

A Pauli that commutes with a two-qubit gate (X with a CNOT's target, Z with its control or with a CZ) can be put on both sides of it without changing the circuit, each copy merging into the single-qubit gates on its side. Along a wire this carries a stray X, left by a synthesis between two CNOTs, to gates further on that absorb it for free, or to another X. Qiskit's Optimize1qGatesSimpleCommutation moves gates one commutation at a time into existing runs; QCC solves each wire exactly, across any number of gates, with a dynamic programme over its runs. Since 0.4.14 the last pass also pairs rotations: a whole axis commutes with a CNOT's target (X), its control and a CZ (Z), so at each gate the programme may choose a rotation about it, at an angle that removes an outer rotation of a nearby run, as well as the Pauli. A Z rotation at the end of one run can then join the start of another through several CNOT controls or CZs. It runs once on the final result, after every choice between circuits, so it never changes a two-qubit gate count.

Since 0.4.13: no two-qubit gate added and no circuit costlier; Clifford+T at 16 qubits 499 → 484 gates (pytket 495), QAOA at 32 634 → 615, Heisenberg at 32 1173 → 1143; on adders the gathered blocks, refused before for a few more gates in all, now pay: 40 / 105 → 37 / 104, 92 / 245 → 85 / 244, 196 / 525 → 181 / 524 CNOTs / gates. 1% fewer gates over the benchmark, at 1.04× the time. Rotation pairs (0.4.14): Clifford+T at 32 qubits 1009 → 988 gates (pytket 1039), at 16 484 → 476; on the heavy-hex chip the 16-qubit adder 402 → 395 with CX; 0.866× → 0.863× Qiskit's gates without a chip; 67 of 234 compilations fewer gates, none more; 1.03× the time without a chip, 1.00× on it.

After Qiskit's Optimize1qGatesSimpleCommutation · pauli_pairs.rs

SWAP elision and permutation-aware synthesis extended

A SWAP costs three CNOTs; relabelling the qubits after it costs nothing. The same holds for a SWAP hidden in a block: a CNOT each way is a SWAP and one CNOT, so a block that is a SWAP away from fewer CNOTs is synthesized that way. QCC relabels whenever the moved qubits are measured last, so the output is exactly equivalent, and otherwise when asked to, reporting where each qubit's state ends.

QFT: 12, 24 and 48 fewer CNOTs at 8, 16 and 32 qubits; random Clifford+T: up to 5% fewer.

As Qiskit's ElidePermutations and pytket's implicit wire swaps · permutation.rs

Numerical synthesis for any entangling gate ours

For native gates without a known template (iSWAP, √iSWAP, √SWAP, …), the fewest uses are found numerically: first matching the target's Makhlin invariants, then the single-qubit gates around them, both by Levenberg–Marquardt from seeded starts.

Try it in the decomposition playground · numeric.rs

Layout and routing

Perfect layouts extended

When the pairs of qubits a circuit's gates use form a graph that fits inside the chip's coupling graph, a subgraph search places them so that no SWAP is needed. The circuit is optimized first, so fewer pairs remain to fit.

GHZ states and Heisenberg chains on a heavy-hex chip: no SWAP at all.

As Qiskit's VF2Layout · perfect.rs

SWAPs counted for what they cost published

A SWAP right after gates on the same pair merges into them: after a CNOT it costs one more CNOT, after a generic block nothing. The router lowers the score of such SWAPs by the CNOTs they save, and keeps the routing whose SWAPs cost least once merged.

With more layout trials, 8% fewer two-qubit gates on a heavy-hex chip: the 16-qubit QFT went from 479 CNOTs to 357, and QCC alone used 5% fewer than Qiskit's level 3 (6.5% with CX since 0.4.2).

NASSC: Liu, Li and Zhou, HPCA 2022; SABRE: Li, Ding and Xie, ASPLOS 2019 · sabre.rs

Cheaper routing, spent on more routings extended

SABRE's result depends a lot on how it breaks ties, so trying more tie-breakings pays, if routing is cheap. QCC's router now builds a circuit's dependency graph and gate matrices once for all its routings, allocates nothing per SWAP, writes out only the routing it keeps and remembers what merging a SWAP into a block saves; it makes exactly the same choices as before. Each layout is then routed 16 times instead of 4. Because the SWAPs' cost is only an estimate of the optimized circuit, the routing the first 4 would have kept is optimized too, and the cheaper kept, so no circuit gets worse.

A routing search takes 2.1–2.9× fewer instructions, with byte-identical outputs. On a heavy-hex chip QCC alone goes from 0.934× to 0.928× Qiskit's two-qubit gates with CX and 0.904× to 0.899× with CZ (Quantum Volume at 16 qubits 822 → 783 CNOTs); on 40 held-out circuits, fewer two-qubit gates on 19 and more on none. 0.86× the time of 0.4.7 with CX, 0.97× with CZ, but 1.37× on the 16-qubit Hamiltonian with CZ.

More trials as in LightSABRE: Zou, Treinish, Hartman, Ivrii and Lishman, arXiv:2409.08368; keeping the narrower search's routing is ours · sabre.rs · device.rs

Instructions without heap memory ours

The passes copy, relabel and rebuild instructions all the time, and each instruction used to own a name string and lists of qubits and parameters: two or three allocations per copy. Now a known gate's name is a static string and up to three qubits and parameters are stored inline, so copying an instruction allocates nothing. Internal maps hash with FxHash instead of SipHash, and the Python wrapper pauses the cyclic garbage collector while instructions cross to and from the Rust core, whose tens of thousands of short-lived objects set off collections that walked the whole heap.

The 160 benchmark compilations give byte-identical outputs. Allocation went from 27% to 10% of the core's instructions on the 32-qubit Quantum Volume circuit. Against 0.4.8 side by side: 0.85× the time without a chip (Quantum Volume at 32 qubits 149 → 92 ms, Qiskit about 50), 0.93× on a heavy-hex chip with CX and 0.83× with CZ.

ir.rs · hashing.rs · native.py

Pauli-network scoring from tables ours

For every CNOT it places, the greedy Pauli-network synthesis scores nine candidate gates (σ on one qubit controlling τ on the other) on up to 64 pairs of qubits, and it used to apply each candidate's gates to the letters of every rotation ahead. What a candidate does to the letters of its two qubits is the same on any pair, so each is now a table of what becomes of the 16 letter pairs, worked out once, and the nine scores are summed in one pass in their old order, so they are the same numbers. Moving gates through symmetric blocks also keeps its KAK decompositions by the block's matrix: most blocks are a lone CNOT.

142 compilations (the benchmark circuits with and without a chip, inside Qiskit, and 15 held-out Hamiltonians) give byte-identical outputs. On the 32-qubit Hamiltonian the core runs 3.4 billion instructions instead of 14.4. Against 0.4.9 side by side, the Hamiltonians take 0.59× / 0.37× / 0.32× the time at 8 / 16 / 32 qubits with CX (340 → 110 ms at 32; Qiskit about 23) and 0.71× / 0.52× / 0.42× with CZ; on the heavy-hex chip, where routing and the CZ rounds dominate, 0.96×.

The synthesis follows Rustiq (Goubault de Brugière and Martiel) and pytket's GreedyPauliSimp; the tables are ours · pauli_network.rs · symmetric_blocks.rs · run.py

Multi-core mapping

Hungarian Qubit Assignment published

Assigns qubits to the cores of a modular machine slice by slice, solving each slice as an assignment problem with lookahead, so that the qubits of each gate meet in one core with few teleportations.

1.24× fewer teleportations than FGP-rOEE over 105 configurations, 7.8× faster.

Escofet et al., arXiv:2309.12182 · multicore/

Latency-aware assignment ours

Counting teleportations treats every move alike, but a move that waits for a busy link delays its gate. HQA-latency also weighs how long each move would hold up its gate, given how many EPR pairs each link can supply at once.

6–12% shorter circuits than HQA on average, and never longer.

MULTICORE.md

Routing with communication ports ours

Inside each core, qubits are routed with SABRE to fixed communication qubits wired to the links, with an exchange when a port is taken, and EPR pairs are scheduled into the links' free time.

On TeleSABRE's own device and circuits: 0.26× its EPR pairs and 0.51× its SWAPs, and no deadlocks.

SABRE: Li, Ding and Xie, ASPLOS 2019 · routing/

Simulator

Fused, cache-blocked state vectors extended

The state is stored as qsim stores it, eight real and eight imaginary parts per cache line, with AVX2 kernels for 1–6-qubit gates. Dependent gates fuse into matrices of up to 4 qubits, and every gate of a stage runs on 1 MiB regions that stay in L2, relabelling qubits instead of moving them back.

830 gates become 69 kernels and 9 sweeps over memory; 3–4× faster than qsim.

qevedo-simulator

Stabilizer tableaux and Pauli frames extended

Clifford circuits run once on a tableau that switches between row and column layouts as the work requires; the other shots propagate bit-packed Pauli frames in parallel, cache-sized blocks.

A distance-101 surface code, 20,401 qubits: 10,000 shots in 1.5 s, 8× faster than Stim.

After Aaronson and Gottesman, PRA 2004, and Gidney, Quantum 2021

Pauli noise in the frames published

A Pauli error only multiplies a shot's Pauli frame, so noisy Clifford circuits keep one noiseless reference shot and every shot adds its own errors. The sampler draws the geometric gap to the next error rather than a random bit per qubit and shot. Channels wait until a gate touches their qubits, so a layer's noise is one step.

A distance-101 surface code with circuit-level noise, 10,000 shots: 6.0 s on 4 vCPUs against Stim's 37.5 s (14.9 s on one thread), with the same detection statistics.

Gidney, Quantum 2021 · qevedo-simulator

Detection events from Stim circuits extended

Stim's circuit format, read with its detector and observable annotations, repeat blocks and measurement-flip probabilities. A detector fires when its measurements' parity differs from the noiseless reference shot's, as in Stim; measurement flips are drawn after the run, since they do not touch the state. The shot-major output decoders take is written in Rust, in parallel, by walking only the set bits, straight into the array NumPy sees.

Stim's generated distance-51 surface code, 10,000 shots: 1.13 s on 4 vCPUs against 10.1 s for Stim's detector sampler (1.97 s on one thread), with the same detection rates and logical error rates.

Gidney, Quantum 2021 · qevedo-simulator

Pauli product measurements and correlated errors extended

Stim's MPP, PAULI_CHANNEL_2 and correlated errors (E, ELSE_CORRELATED_ERROR), as Floquet, lattice-surgery and measurement-only codes and calibrated hardware noise models use them. Each Pauli product is lowered to basis rotations, a CX ladder onto one of its qubits, a single-qubit measurement and the same gates undone: the ladder makes that qubit's Z the product, so neither the tableau nor the Pauli frames need new code. A chain of correlated errors becomes one channel with each product's unconditional probability, sampled with the same geometric gaps between errors as the other channels.

Toric-code memory with all three, L = 30, 10,000 shots: 0.787 s on 4 vCPUs against 4.310 s for Stim's detector sampler (4.0–6.9× over L = 10–30), with the same detection statistics; checked exactly against Stim on 300 random circuits and against a state vector.

Gidney, Quantum 2021 · bench_mpp.py · qevedo-simulator

Heralded errors, parity measurements and the rest of Stim's gates extended

Every instruction of Stim 1.16 but classically controlled gates and sweep bits. MXX, MYY and MZZ are two-factor Pauli product measurements, and SPP is an S gate on the product's last qubit between the same basis rotations and CX ladder. A heralded error (HERALDED_ERASE, HERALDED_PAULI_CHANNEL_1), as erasure qubits use it, becomes a correlated error Xh ⊗ {I, X, Y, Z} on one extra qubit h, which is then measured into the herald's record and reset, so herald and error are exactly as correlated as in Stim with no change to the sampler. The other 25 Clifford gates (ISWAP, SQRT_XX, XCY, CXSWAP, …) are short sequences of the simulator's own gates.

Correctness, not speed: each gate's Pauli table equals Stim's tableau; on 300 random circuits of the new instructions the outcomes span the same space as Stim's at the same rates; a repetition code on erasure qubits with heralds and noisy MZZ fires all 35 detectors at Stim's rate (200,000 shots). Classically controlled gates (CX rec[-1] 0) are still rejected.

Gidney, Quantum 2021 · tests/stim.rs · test_simulator.py · improvement-log.md (2026-11-24)

Results written into NumPy's memory ours

Measurement records and detection events go from the bit-packed sampler into their final NumPy layout in one parallel pass in Rust: bools, or bit-packed with eight detectors per byte as in Stim. Measurement records are expanded through a byte table, and detection events are transposed by their set bits, with the observables appended when asked. The arrays come from NumPy's allocator before sampling starts, so their huge pages are first touched by the parallel writers and nothing is zeroed or copied, and one visit to the thread pool both samples and writes.

Distance 51, 10,000 shots, against the previous release on the same machine: records in 0.41× the time on 4 vCPUs (0.55× on one thread), detection events in 0.67× (0.87×), and 0.35× (0.37×) with the observables appended. Bit-packed detection events at distance 101: 13.6 s against Stim's 303 s. Bit-packed records on small codes did not get faster (0.93–1.03× at distance 11).

compare_builds.py · qevedo-simulator

Inside Qiskit ours

A Qiskit backend (QevedoSimulator) and the V2 primitives (QevedoSampler, QevedoEstimator) in qevedo.simulator.qiskit. Circuits are read gate by gate: the simulator's own gates by name, the other standard gates (ecr, iswap, ryy, …) as their exact matrices, and anything else (QFT, multi-controlled X, UnitaryGate, Pauli evolutions) through its definition, with the global phase kept. The backend and the sampler choose the method per circuit as the simulator does, and keep mid-circuit measurements and resets. The estimator evaluates every observable on one exact state vector per parameter set up to 24 qubits, and uses Pauli propagation beyond that, with a bound on the error.

Through the same Qiskit calls on both sides, on an i9-14900K: Quantum Volume 20 to 28 with 1000 shots 32× to 6.6× faster than Qiskit Aer, QFT 24 and 28 20× and 8.0×, and the estimator 30× to 5.5× faster than Aer's on Quantum Volume 16 to 22 with 50 observables, with values equal to 6e-17. Every standard gate is checked against Qiskit's Statevector, global phase included.

bench_qiskit.py · qevedo-simulator

Sparse Pauli propagation extended

For an expectation value, the observable is propagated backwards through the circuit as a sum of Pauli strings: Clifford gates collect in a frame and cost nothing, each non-Clifford rotation can split a string in two, and strings with small coefficients are dropped. The strings live in 64 hash maps that each rotation updates in two parallel passes.

<Z62> of IBM's 127-qubit kicked Ising utility circuit: the same value and strings as IBM's pauli-prop, 15–117× faster end to end on 4 threads.

Sparse Pauli dynamics after Begušić, Gray and Chan, arXiv:2308.05077 · qevedo-simulator

Clifford frames around a small dense state ours

For Clifford circuits with a few T gates, the state is a Clifford frame applied to a dense state of only the qubits the non-Clifford gates touch. The peak size is computed before simulating, so the backend can be chosen automatically.

200 qubits with 20 T gates: 1000 shots in 0.11 s.

qevedo-simulator

Pauli noise around a small dense state published

Noisy circuits with a few non-Clifford gates, such as magic-state preparation: each shot carries a Pauli frame, errors multiply into it, and shots share one Clifford frame and a dense state until an error makes a rotation act differently on them. The X a measurement would add to the shared frame for one outcome goes into those shots' frames instead. The shared frame's work is compiled once into a program, and each group of shots runs through it on its own, depth first, with its dense state in cache.

Exact: agrees with Clifft and with distributions summed over every error. With the changes below, 1.17–16.1× faster than Clifft on all 10 noisy random Clifford+T circuits of the benchmark (1.17× on the 24-qubit one on 4 vCPUs).

Clifft: Chase and Labib, arXiv:2604.27058 · bench_noisy_nearclifford.py · noisy_nearclifford.csv

Pauli pairs as register pairs ours

The near-Clifford backend's dense kernels (expectation values, rotations, and a measurement that retires its qubit in one pass) combine each amplitude with the one at its index XOR the Pauli's X part. With AVX2, a register holds two neighbouring amplitudes, and its partners are always one other register, swapped when the X part includes position 0, so every Pauli reads whole registers. Signs come from a small table plus one population count per block, and the expectation visits each pair once, keeping only the product its phase needs.

The kernels run 2–4× faster in cache (the measurement drops from 1.3 to 0.32–0.43 ns per amplitude). Noisy Clifford+T cases take 0.60–0.91 of the time they took before; at 100 qubits, 1.71 → 1.21 s on one thread. ARM wheels still use the scalar kernels.

compare_noisy_builds.py · improvement-log.md (2026-11-10)

Sign registers instead of Pauli frames extended

A noisy shot's Pauli frame only matters through whether it anticommutes with each rotation's and measurement's Pauli, and it is a product of Paulis put in at known steps, of which only whether each one happens depends on the shot. So each possible error flips a fixed set of those signs, worked out once per run, and a shot keeps one bit per rotation and measurement: an error XORs a few words, and the frames' conjugations are gone. Clifft keeps such sign bits; here the rows are found in the physical picture, carrying the few checks backwards through the physical gates, where every error is a one-qubit Pauli, so compiling a run got cheaper too.

Noisy Clifford+T cases take 0.24–0.77 of the time they took before (200 qubits on one thread: 2.03 → 0.49 s), one-shot runs 0.64–0.78; the counts for a seed are unchanged.

Clifft: Chase and Labib, arXiv:2604.27058 · compare_noisy_builds.py · improvement-log.md (2026-11-12)

No split where a qubit joins the dense part ours

When an error flips the sign of a rotation for some shots of a group, those shots used to split off with a dense state of their own. But when the rotation brings a new qubit into the dense part, that qubit is in |0⟩ and the rotation's Pauli has X or Y on it, so a Z on it turns the rotation's angle around and leaves the state alone. The shots that need the other sign take that Z into their sign bits and keep the group's dense state. In Clifford+T circuits nearly every rotation is of this kind, so groups split almost only at measurements, by outcome. Clifft runs one shot at a time and does each shot's dense work separately.

Noisy Clifford+T cases take 0.285–0.704 of the time they took before (100 qubits at p = 10⁻³ on one thread: 0.614 → 0.180 s; 60 qubits at 10⁻²: 0.316 → 0.102 s), and the time hardly depends on the error rate any more (0.167–0.177 s from p = 0 to 10⁻³ at 100 qubits). Exact, as before; the counts for a seed change.

compare_noisy_builds.py · improvement-log.md (2026-11-14)

One row of bits per shot ours

Once the final measurements start, a group of noisy shots splits at nearly every measurement of the dense part, by outcome, down to single shots: tens of thousands of splits in a 10,000-shot run. The classical bits were kept as columns over the shots, one vector per bit, so each split allocated and gathered two vectors per classical bit. Timing each step showed that this bookkeeping took two thirds of the run, against a seventh for the dense kernels. Each shot now keeps its sign bits, classical bits and reset scratch bits in one row, so a split copies a few words per shot and compacts the rest in place.

Noisy Clifford+T cases take 0.222–0.596 of the time they took before (100 qubits at p = 10⁻³ on one thread: 0.149 → 0.033 s; 24 qubits: 0.022 → 0.009 s), with the same counts for the same seed; one-shot runs cost what they did.

compare_noisy_builds.py · noisy_nearclifford_before_after.csv · noisy_nearclifford_sweep.csv

Fewer fixed costs per noiseless measurement ours

Without noise, the final measurements also split groups of shots by outcome down to single shots: about 98,000 measurements of the dense part in a 10,000-shot run of a 100-qubit circuit, nearly all on one shot, so their fixed costs outweighed the kernels. Every pending measurement used to be classified before each one; now the scan stops at the first that acts on the dense part, and classifying reads the frame's bits without allocating. A measurement pulls its Pauli back through the frame once instead of several times, and a split writes both outcomes' dense states in one pass over the parent instead of reading it twice.

The noiseless 100-qubit, 24-T example takes 0.835 of the time it took before at 1000 shots, 0.622 at 10,000 and 0.511 at 100,000 (4 vCPUs, including the gates), with the same counts for the same seed. Each new dense state still takes fresh memory, whose page faults are a large part of what is left at 1000 shots.

compare_examples.py · examples_before_after_recheck.csv · improvement-log.md (2026-11-18)

Word-wide gathers for the noiseless frames extended

After the fixed costs above, the noiseless final measurements still spent most of their instructions on bookkeeping. A row of the column-major Clifford frame is now collected 64 bits at a time in registers rather than read, ORed and written back one bit at a time, and buffers are reused for a whole branch instead of allocated per measurement. When a group of shots splits, the leaving shots are gathered a word at a time: each word of the mask is planned once and reused over all ~300 columns, with full words copied, sparse ones moved bit by bit and dense ones packed with the compress of Warren's Hacker's Delight (§7-4), rather than BMI2's pext, which is microcoded on AMD Zen 1 and 2.

21.6% fewer instructions at 20,000 shots (7.69 → 6.03 × 10⁹, one thread). The noiseless 100-qubit, 24-T example takes 0.797 of the time it took before at 100,000 shots, 0.914 at 10,000 and 0.984 at 1000 (medians of 60 interleaved rounds, 4 vCPUs, including the gates), with the same counts for the same seed. At 1000 shots the gain is within noise; the row gathers are still the largest item.

compare_examples.py · examples_before_after_recheck.csv · improvement-log.md (2026-11-22)