betaFeedback

WorksPhysics and Astronomy

General Noise Channels and Mid-Circuit Measurements for Pre-Trajectory Sampling with Batched Execution

Abstract

Many studies of quantum protocols require fast sampling of large amounts of measurement data from noisy quantum circuits, such as for training machine-learning decoders for quantum error correction. Exact simulation of realistic noise is expensive, while stabilizer-based simulators are fast but approximate, for example through Pauli twirling, which generally alters the output statistics. Pre-trajectory sampling with batched execution (PTSBE) accelerates exact trajectory simulation by sampling noise before state evolution. This method requires the outcome probability of every stochastic event to be independent of the state, which excludes mid-circuit measurements and general Kraus channels. We present a generalization of PTSBE to measurement and Kraus operators without approximation. Each event is partially pre-sampled, while deferred outcomes are drawn during grouped execution via multinomial branching and cached-state reuse. We implement the method for GPUs as an extension of CUDA-Q. On distance-3 topological code memories under amplitude damping, it is up to 24x faster than conventional trajectory sampling in CUDA-Q. On 30-qubit random circuits with mid-circuit measurements, it is up to 83x faster and outperforms the near-Clifford simulator Clifft when more than about 25% of the gates are non-Clifford. With repeated sampling of each final state, its sampling rate per trajectory exceeds that of CUDA-Q by nearly five orders of magnitude. Our method also allows us to compare exact amplitude damping with its Pauli-twirled channel on a surface-code memory, revealing that twirling overestimates the detection rate by 21% and raises the logical error rate of a lookup decoder by 8%. This work makes exact, high-throughput simulation practical for general noisy circuits, from data generation for training decoders to studying measurement-based fault-tolerant protocols under realistic noise.

Introduction

The classical simulation of noisy quantum circuits serves many purposes, from predicting hardware behavior to generating training data for machine-learning models. Moreover, most such applications require large numbers of sampled measurement records, one per execution of the circuit, called a shot, under a hardware-accurate noise model. A prominent example is quantum error correction (QEC), which relies on repeated measurements to identify errors while preserving encoded quantum information [1, 2]. These measurement records are increasingly processed by machine-learning decoders [3, 4, 5], which must be trained on large datasets representative of the noise encountered during computation. Hardware can provide such data directly, but collecting data at scale is costly and offers limited control over the underlying error processes. Simulation is a complementary data source, provided that it combines high sampling throughput with a faithful treatment of the noise model of interest.

The fastest QEC simulators achieve much of their efficiency by exploiting structure in the circuit or noise model. Stabilizer simulators, such as Stim [6], enable extremely fast sampling of Clifford circuits with Pauli noise, while more recent methods such as Clifft [7] extend efficient simulation into the near-Clifford regime. More general noise processes can often be replaced by stochastic Pauli models, for example through Pauli twirling, making them compatible with such specialized simulators. This approximation often reproduces logical error rates well [8, 9], but it can bias them [10, 11, 12] and does not in general preserve the full effect of the original channel on a QEC circuit. Approximations by Clifford channels and Pauli measurements come closer, but still do not reproduce the channel [13, 14, 15].

For applications in which simulated measurement records become the input to statistical analysis or machine-learning pipelines, changes in the distribution of these records can matter directly. Efforts to retain the exact channel have so far relied on density-matrix simulation, limited to about 17 qubits [16], or on tensor networks, which either assume perfect syndrome measurements [17] or take seconds per shot [18]. Quasiprobability decompositions also retain the exact channel and estimate circuit statistics without bias, but return signed-weight samples [19, 20, 21, 22]. Quantum-trajectory simulation handles any channel through stochastic pure-state evolution [23, 24, 25, 26, 27] and can be accelerated with a delayed inner product algorithm [28]. Conventional trajectory simulators [28, 29], however, evolve every shot independently and closely related trajectories can repeat the same state evolution.

Several simulators exploit this redundancy. Approximate schemes reuse states across a fixed tree of subcircuits at a bounded cost in accuracy [30]. Among exact simulators, some fix every noise outcome before the simulation starts, so that identical prefixes can be found and evolved once [31, 32, 33]. Pre-trajectory sampling with batched execution (PTSBE) [34, 35] also fixes all outcomes in advance, and gains its speed by evolving each distinct trajectory once and drawing its measurement records in a single batch, with control over how many records each trajectory produces, including nonproportional allocations. Fixing outcomes in advance, however, requires their probabilities to be independent of the state, which excludes mid-circuit measurements (MCMs) and general (non-mixture-of-unitaries) Kraus channels unless decoherence is first twirled into Pauli noise [33]. Other exact simulators draw each outcome during state evolution and copy the state shared by several shots only when their outcomes differ [36], which handles any channel or measurement but fixes nothing in advance. To our knowledge, no exact simulator combines the speed of pre-sampled, batched execution with support for state-dependent operations.

In this work, we generalize PTSBE to circuits containing mid-circuit measurements and general Kraus channels [Fig. 1], in a GPU simulator based on CUDA-Q [29]. With the lower bounds of the delayed inner product algorithm [28], the outcome probabilities of each stochastic event are split into a state-independent part, pre-sampled before execution, and a residual distribution, evaluated on the intermediate state when the trajectory reaches the event. Each trajectory is thus first drawn as a proposal, which holds for every event either a pre-sampled outcome or, for a deferred event, the residual distribution. Identical proposals evolve as one group. At a deferred event, a single multinomial draw from the residual distribution splits the group that reaches it, and sibling groups restart from the state cached before the event, in a tree-based simulation structure [30, 32].

Together, these mechanisms retain the computational advantages of PTSBE across state-dependent operations and without approximation. On distance-3 topological code memories under amplitude damping, generalized PTSBE achieves 11–24× higher sampling throughput than conventional trajectory sampling with CUDA-Q v0.15.1, a leading GPU-accelerated statevector simulator [29, 37]. On random monitored circuits of 16 to 30 qubits with Pauli noise, it is 47–318× faster than CUDA-Q, and it outperforms Cliftt above a crossover density of non-Clifford gates that falls from 62% to 24% as the qubit count grows, reaching up to a 103×10^3 \times speedup. With amplitude damping, which Cliftt does not support, the speedup over CUDA-Q is 83–176×. In the nonproportional sampling regime, our sampling rate per trajectory exceeds that of CUDA-Q by a factor of more than 7×1047 \times10^4, and about 90% of the shots are distinct in their trajectory and terminal bits.

The rest of this manuscript is organized as follows. Section II reviews trajectory simulation, the original, fully pre-sampled PTSBE, and the delayed inner product algorithm. Section III generalizes PTSBE to partially pre-sampled trajectories, with grouped execution and terminal readout. Section IV first demonstrates that replacing amplitude damping by its Pauli-twirled channel changes the syndrome statistics of a surface-code memory, motivating exact channel simulation, and then benchmarks generalized PTSBE against CUDA-Q and Cliftt. Finally, § 1.4 discusses the origin of the speedups, exact noise-model advantages, and future research directions.

Background

The generalized implementation of PTSBE presented in this manuscript combines the trajectory reuse of the original PTSBE [34, 35] with the state-independent lower bounds of the delayed inner product algorithm [28]. We review both after summarizing the foundations of conventional trajectory simulation for noisy quantum systems.

Quantum trajectories

We consider a circuit in which deterministic unitary blocks UiU_i are interleaved with stochastic events VvV_v, v=1,…,Lv = 1, \ldots, L, such as noise channels and mid-circuit measurements [Fig. 1(a)]. Each trajectory is represented by a statevector initialized in ∣ψ0⟩|\psi_0\rangle. For event VvV_v, let Av\mathcal{A}_v denote the finite set of its possible outcomes, such as which Kraus operator of a noise channel acts or which result a measurement gives, and {Kv,a}a∈Av\{K_{v,a}\}_{a\in\mathcal{A}_v} the associated operators, satisfying

Figure 1. Pre-trajectory sampling with batched execution for state-dependent stochastic events. (a) An example circuit with deterministic unitary blocks UiU_i and stochastic events VvV_v, colored by their pre-sampling probability svs_v in all panels: orange for mid-circuit measurements (sv=0s_v = 0), blue for general Kraus channels (0<sv<10 < s_v < 1), and green for mixed-unitary channels (sv=1s_v = 1). Each bar shows how the draw of an event splits into pre-sampled outcomes and a part drawn on the intermediate state (Sec. II C). (b) Conventional trajectory simulation draws stochastic outcomes during propagation and evolves each trajectory independently. (c) Original PTSBE pre-samples complete trajectories when every event has sv=1s_v = 1, deduplicates repeated trajectories, and prepares each retained trajectory α\alpha once for mαm_\alpha terminal samples. (d) A diagram of the generalized PTSBE process presented in this work. (1) At event VvV_v, a proposal stores either a pre-sampled outcome, with total probability svs_v (solid), or, with probability 1−sv1 - s_v, the residual distribution pvresp_v^{\mathrm{res}} (hatched). Identical proposals are grouped with their multiplicity. (2) At a deferred event, pvresp_v^{\mathrm{res}} is evaluated once on the group’s intermediate state, and a multinomial draw splits the group into sibling groups, one per occupied outcome. Dashed arrows mark siblings that resume from the cached state. (3) Each trajectory is prepared once and sampled in a batch at the terminal readout, here with proportional sampling, such that each trajectory receives as many terminal samples as its multiplicity.

∑a∈AvKv,a†Kv,a=I.(1)\sum_{a\in\mathcal{A}_v} K_{v,a}^{\dagger}K_{v,a} = I. \tag*{(1)}

In a trajectory, a noise channel acting on density matrices as ρ↦∑aKv,aρKv,a†\rho\mapsto\sum_a K_{v,a}\rho K_{v,a}^{\dagger} applies its Kraus operator Kv,aK_{v,a} when outcome aa occurs, and a projective measurement applies the projector Kv,aK_{v,a} of result aa, for instance Kv,a=∣a⟩⟨a∣K_{v,a} = |a\rangle\langle a| with a∈{0,1}a \in\{0,1\} for a single-qubit measurement. For a normalized ∣ψ⟩|\psi\rangle immediately before an event, the probability of outcome aa is

pv,a(ψ)=⟨ψ∣Kv,a†Kv,a∣ψ⟩,(2)p_{v,a}(\psi) = \langle\psi|K_{v,a}^{\dagger}K_{v,a}|\psi\rangle, \tag*{(2)}

and, for pv,a(ψ)>0p_{v,a}(\psi)>0, the corresponding renormalized state is

∣ψv,a⟩=Kv,a∣ψ⟩pv,a(ψ).(3)\lvert\psi_{v,a}\rangle=\frac{K_{v,a}\lvert\psi\rangle}{\sqrt{p_{v,a}(\psi)}}. \tag*{(3)}

For a mid-circuit measurement, outcome aa is also added to the classical measurement record. Trajectory simulation draws the outcome of each stochastic event with the probabilities of Eq. (2) on the intermediate state and updates the state by Eq. (3). Conventional implementations evolve one independent trajectory per shot [Fig. 1(b)].

Original PTSBE

In its original version, PTSBE [34, 35] obtains its efficiency in two steps, illustrated in Fig. 1(c). It first samples the noise outcomes of every trajectory before state evolution (pre-trajectory sampling) and groups repeated trajectories. It then evolves each distinct trajectory once and reuses its final state for batched terminal readout (batched execution). Each final state is sampled either a fixed, possibly large, number of times or in proportion to the trajectory’s probability. However, selecting outcomes in advance requires state-independent probabilities. By Eq. (2), this means that original PTSBE only works for operators conforming to Kv,a†Kv,a∝IK_{v,a}^{\dagger}K_{v,a}\propto I, i.e., Kraus operators that are proportional to unitaries, as is the case for Pauli and other mixture-of-unitary channels. As a result, MCMs, qubit resets, and general Kraus channels fall outside the scope of the original PTSBE algorithm.

The delayed inner product algorithm

The delayed inner product algorithm [28] assigns to each outcome aa of event VvV_v a probability lower bound that holds for any input state,

pv,a=σmin⁡(Kv,a)2,sv=∑a∈Avpv,a.(4)p_{v,a}=\sigma_{\min}(K_{v,a})^2,\qquad s_v=\sum_{a\in\mathcal{A}_v}p_{v,a}. \tag*{(4)}

where σmin⁡(Kv,a)\sigma_{\min}(K_{v,a}) denotes the smallest singular value of Kv,aK_{v,a}, so that σmin⁡(Kv,a)2\sigma_{\min}(K_{v,a})^2 is the smallest eigenvalue of Kv,a†Kv,aK_{v,a}^{\dagger}K_{v,a}. The quantity pv,ap_{v,a} is the largest state-independent lower bound on pv,a(ψ)=∥Kv,a∣ψ⟩∥2p_{v,a}(\psi)=\lVert K_{v,a}\lvert\psi\rangle\rVert^2 over all normalized input states, attained when ∣ψ⟩\lvert\psi\rangle is an eigenvector for this eigenvalue. Since the total probability is normalized for any state, 0≤sv≤10\leq s_v\leq1.

At each event, the algorithm draws a number rr uniformly between 0 and 1 and compares it with svs_v.

  • If r<svr<s_v, the interval [0,sv)[0,s_v) is cut into consecutive segments of length pv,ap_{v,a}, one per outcome, which are known before the simulation. Outcome aa is selected if rr falls in its segment, without evaluating any pv,a(ψ)p_{v,a}(\psi).

  • If r≥svr\geq s_v, the interval [sv,1)[s_v,1) is cut into segments of length pv,a(ψ)−pv,ap_{v,a}(\psi)-p_{v,a}, the excess of each probability over its bound. These lengths depend on the intermediate state, so they are computed only in this case.

Outcome aa thus covers a total length pv,a+[pv,a(ψ)−pv,a]=pv,a(ψ)p_{v,a}+[p_{v,a}(\psi)-p_{v,a}]=p_{v,a}(\psi), and the selection follows Eq. (2) exactly. The bound sum svs_v is the probability that r<svr<s_v, so that the outcome is selected without evaluating any probability on the state, and we call it the pre-sampling probability of the event. The algorithm draws rr separately for each trajectory when it reaches the event. It therefore skips evaluating pv,a(ψ)=⟨ψ∣Kv,a†Kv,a∣ψ⟩p_{v,a}(\psi)=\langle\psi|K_{v,a}^{\dagger}K_{v,a}|\psi\rangle, an inner product with the state, whenever r<svr<s_v, but still evolves every trajectory separately.

Generalized PTSBE

Partially pre-sampled trajectories

The original PTSBE requires sv=1s_v=1 at every event. We relax this requirement by allowing trajectories to remain partially pre-sampled until the relevant quantum state becomes available.

For sv<1s_v<1, normalizing the state-dependent segments of Sec. II C by their total length 1−sv1-s_v gives the residual probability distribution

pv,ares(ψ)=pv,a(ψ)−pv,a1−sv.(5)p_{v,a}^{\mathrm{res}}(\psi)=\frac{p_{v,a}(\psi)-p_{v,a}}{1-s_v}. \tag*{(5)}

These probabilities are nonnegative and sum to one, giving the exact decomposition

pv,a(ψ)=pv,a+(1−sv)pv,ares(ψ).(6)p_{v,a}(\psi)=p_{v,a}+(1-s_v)p_{v,a}^{\mathrm{res}}(\psi). \tag*{(6)}

This decomposition allows part of the outcome selection to take place before state evolution. Before execution, we draw for each event VvV_v a random variable ZvZ_v with state-independent probabilities

Pr⁡(Zv=a)=pv,a(a∈Av),\Pr(Z_v=a)=p_{v,a}\qquad(a\in\mathcal{A}_v),
Pr⁡(Zv=pvres)=1−sv(sv<1).(7)\Pr(Z_v=p_v^{\mathrm{res}})=1-s_v\qquad(s_v<1). \tag*{(7)}

If Zv=aZ_v=a, outcome aa is pre-sampled. If Zv=pvresZ_v=p_v^{\mathrm{res}}, the event is deferred, and its outcome is drawn at run time from the residual distribution evaluated on the intermediate state. By Eq. (6), the total probability of selecting aa is pv,a(ψ)p_{v,a}(\psi), with the corresponding state given by Eq. (3). A partially pre-sampled trajectory is represented by the proposal sequence

Z=(Z1,…,ZL),Zv∈Av∪{pvres}.(8)Z=(Z_1,\ldots,Z_L),\qquad Z_v\in A_v\cup\{p_v^{\mathrm{res}}\}. \tag*{(8)}

When sv=1s_v=1 at every event, all outcomes are selected before state evolution and the original PTSBE is recovered [Fig. 1(c)], which happens exactly for Kraus operators proportional to unitaries (Supplementary Note S2 B). Nontrivial MCMs have sv=0s_v=0, so their outcomes are always sampled during execution. General Kraus channels, including nonunital noise channels, can take intermediate values 0<sv<10<s_v<1, giving the partially pre-sampled events illustrated in Fig. 1(a).

Amplitude damping, for instance, has Kraus operators Kv,0=diag⁡(1,1−γ)K_{v,0}=\operatorname{diag}(1,\sqrt{1-\gamma}) for no decay and Kv,1=γ∣0⟩⟨1∣K_{v,1}=\sqrt{\gamma}|0\rangle\langle1| for decay, where γ\gamma is the decay probability of ∣1⟩|1\rangle. By Eq. (4), pv,0=1−γp_{v,0}=1-\gamma and pv,1=0p_{v,1}=0, so a trajectory needs the state at a damping location only with probability γ\gamma.

Grouped execution and terminal sampling

Algorithm 1 summarizes generalized PTSBE. It consists of a preprocessing step and the three stages of Fig. 1(d), which the paragraphs below motivate in order. Supplementary Note S1 proves that the trajectories follow the law of NN independent trajectory simulations.

Preprocessing. Once per channel and before constructing any states, we compute the lower bounds and pre-sampling probabilities of Eq. (4) and the operators that evaluate Eq. (5). The Kraus representation of a noise channel is not unique, and svs_v depends on it. Refactoring the Kraus operators to raise svs_v reduces the expected number of deferred events per proposal, ∑v(1−sv)\sum_v(1-s_v), and we provide a search over equivalent representations that maximizes it (Supplementary Note S2). The standard form of amplitude damping, used later in our benchmarks, is already optimal. A larger svs_v does not guarantee a shorter runtime, because the new representation also changes how often trajectories coincide and branch, so we propose this search as an optional preprocessing step for other noise models.

Pre-sampling and grouping. Using only the lower bounds, we independently sample NN proposals, Eq. (8), from Eq. (7) and group identical proposals with their multiplicities [Fig. 1(d), stage 1]. Each distinct proposal is then evolved once for all its

Image not extracted

Figure 1 (PDF p. 5).

copies. A group gg contains cgc_g identical proposals Zg\boldsymbol{Z}_g, which have the same pre-sampled outcomes and the same deferred events. These proposals share a quantum state ∣ψg⟩|\psi_g\rangle and advance through the circuit together.

Pre-sampled and deferred events. When a group reaches the stochastic event VvV_v, it proceeds based on its associated random variable ZvZ_v [Fig. 1(d), stage 2]. If Zv=aZ_v=a, all cgc_g proposals advance through outcome aa by Eq. (3), without evaluating the residual distribution. If Zv=pvresZ_v=p_v^{\mathrm{res}}, the residual distribution is evaluated a single time on the shared state ∣ψg⟩|\psi_g\rangle, for the whole group. The group is then split by a single multinomial draw

Cg∼Multinomial⁡(cg,pvres(ψg)),(9)C_g\sim\operatorname{Multinomial}(c_g,p_v^{\mathrm{res}}(\psi_g)), \tag*{(9)}

where Cg,aC_{g,a} is the number of proposals assigned to outcome aa. This draw is exact because the members share ∣ψg⟩|\psi_g\rangle, so their residual draws are independent and identically distributed. Outcomes with Cg,a=0C_{g,a}=0 are never simulated. For each outcome with Cg,a>0C_{g,a}>0, applying Kv,aK_{v,a} according to Eq. (3) produces a successor group of Cg,aC_{g,a} proposals. Each successor group then continues, updating the measurement

Algorithm 1. Generalized PTSBE. Execute⁡(Z,c,∣ψ⟩,v0)\operatorname{Execute}(Z,c,|\psi\rangle,v_0) evolves cc identical proposals ZZ from ∣ψ⟩|\psi\rangle, starting at event Vv0V_{v_0}.
Require: {Ui}\{U_i\}, {Vv}\{V_v\}, ∣ψ0⟩|\psi_0\rangle, NN, mode for mαm_\alpha
Preprocessing
1: pv,a,sv ∀vp_{v,a},s_v\ \forall v ▹\triangleright Eq. (4)
Stage 1: pre-sampling and grouping
2: Zv(n)∼Z_v^{(n)}\sim Eq. (7) independently ∀n≤N, ∀v\forall n\le N,\ \forall v
3: Group identical Z(n)Z^{(n)} into groups (Zg,cg)(Z_g,c_g)
Stage 2: grouped execution, depth first
4: for all groups gg do Execute⁡(Zg,cg,∣ψ0⟩,1)\operatorname{Execute}(Z_g,c_g,|\psi_0\rangle,1)
Stage 3: terminal sampling
5: for all α\alpha do draw mαm_\alpha samples from ∣ψα⟩|\psi_\alpha\rangle
6: procedure Execute⁡(Z,c,∣ψ⟩,v0)\operatorname{Execute}(Z,c,|\psi\rangle,v_0)
7: for v=v0,…,Lv=v_0,\ldots,L do
8: ∣ψ⟩←Uv−1∣ψ⟩|\psi\rangle\leftarrow U_{v-1}|\psi\rangle
9: if Zv=pvresZ_v=p_v^{\mathrm{res}} then ▹\triangleright deferred
10: (Ca)a∈Av∼Multinomial⁡(c,pvres(ψ))(C_a)_{a\in A_v}\sim\operatorname{Multinomial}(c,p_v^{\mathrm{res}}(\psi)) ▹\triangleright Eq. (9)
11: Cache ∣ψ⟩|\psi\rangle if several Ca>0C_a>0
12: for all aa with Ca>0C_a>0 do
13: Zv←aZ_v\leftarrow a
14: Execute⁡(Z,Ca,∣ψv,a⟩,v+1)\operatorname{Execute}(Z,C_a,|\psi_{v,a}\rangle,v+1)
15: return
16: a←Zv, ∣ψ⟩←∣ψv,a⟩a\leftarrow Z_v,\ |\psi\rangle\leftarrow|\psi_{v,a}\rangle ▹\triangleright Eq. (3)
17: a←Za\leftarrow Z ▹\triangleright all outcomes fixed: trajectory α\alpha
18: ∣ψα⟩←UL∣ψ⟩|\psi_\alpha\rangle\leftarrow U_L|\psi\rangle ▹\triangleright final state of α\alpha
19: cα←cα+cc_\alpha\leftarrow c_\alpha+c ▹\triangleright multiplicity of α\alpha

Table 1.

record at mid-circuit measurements.

Branching and caching. When the multinomial draw gives several outcomes with Cg,a>0C_{g,a} > 0, the group splits into sibling groups, one per such outcome, which all start from the state cached immediately before the event. The first branch continues from the intermediate state, and the others restart from the cached copy. Depth-first traversal bounds the number of cached states by the number of deferred events on the current path (Supplementary Note S6 A). Different proposals can produce the same trajectory, because an outcome can be pre-sampled or drawn on the intermediate state. Their multiplicities are therefore added.

Terminal sampling. Let cαc_\alpha denote the accumulated multiplicity of a trajectory α\alpha. Each trajectory is re-executed once to prepare its final state, from which mαm_\alpha measurement records are drawn in a batch (Fig. 1(d), stage 3). We provide three modes for mαm_\alpha: 1) proportional sampling, mα=cαm_\alpha= c_\alpha, which gives the same distribution of measurement counts as independent trajectory sampling, 2) rescaled proportional sampling, mα=bcαm_\alpha= b c_\alpha with a positive integer bb, which draws more records from the same sampled trajectories, and 3) nonproportional sampling, mα=mm_\alpha= m for every trajectory independently of its multiplicity (suited to generating large labeled datasets), with the terminal samples of each trajectory weighted by cα/Nc_\alpha/N to estimate circuit statistics (Supplementary Note S3).

Applications and performance

We generalize PTSBE to trajectory sampling with any Kraus channel and mid-circuit measurement, for general-purpose circuit simulation as well as QEC dataset generation. We first show why exact simulation of such channels matters, by comparing amplitude damping with its Pauli-twirled channel on a surface-code memory (Sec. IV A). We then measure the speedup on random monitored circuits and QEC memories over exact conventional trajectory sampling and over the near-Clifford simulator Clifft in the noise regime it supports (Sec. IV B).

QEC statistics with general noise channels

We consider a distance-3 rotated surface-code memory over three rounds, with single-qubit amplitude damping after every layer as the only noise source (Supplementary Note S4 A). Each shot yields a syndrome SS, the outcomes of the 24 detectors comparing successive stabilizer measurements, and a logical bit LL, equal to 1 when the stored state is flipped. We compare two noise models, the exact channel, simulated with our method, and the Pauli-twirled channel, sampled with Stim [6], through the total-variation distance (TVD) between their distributions of the syndrome SS,

dTV=12∑S∣Pexact(S)−Ptwirl(S)∣,(10)d_{\mathrm{TV}} = \frac{1}{2} \sum_{S} \left|P_{\mathrm{exact}}(S) - P_{\mathrm{twirl}}(S)\right|, \tag*{(10)}

which ranges from 0 for identical distributions to 100% for distributions with no syndrome in common. Given a detection, the two distributions lie at a TVD of 19.8%, well above the 0.4% that finite sampling alone produces with about 10910^9 sampled syndromes each. This disagreement appears both in individual syndromes, whose probabilities change by up to 329-fold (Figure 2(a), Supplementary Note S5 B), and in the detection rate, which the twirled noise overestimates by 21%, with at least one detection in 30.3% of shots against 25.1% under exact noise (Figure 2(a), inset).

Figure 2. Effect of Pauli twirling on syndrome statistics and decoding. Exact amplitude damping (generalized PTSBE) is compared with its twirled channel (Stim) for a distance-3 rotated surface-code memory storing ∣0⟩L|0\rangle_L over three rounds. In (a) and (c), points are shaded by 12[Pexact(S)+Ptwirl(S)]\frac{1}{2}[P_{\mathrm{exact}}(S)+P_{\mathrm{twirl}}(S)]. (a) Ratio Ptwirl(S)/Pexact(S)P_{\mathrm{twirl}}(S)/P_{\mathrm{exact}}(S) for the 1,000 most probable syndromes with a detection, with ±1\pm1 s.d. bars. Triangles mark syndromes absent from all exact shots. The TVD, Eq. (10), is computed given a detection and compared with the TVD that finite sampling alone would produce. Inset: share of shots with at least one detection. Syndrome data sampled with the twirled channel, as stabilizer simulators require, therefore misweight individual syndromes by up to a factor of 329 and overestimate the detection rate by 21%. (b) TVD between the exact and twirled syndrome distributions given the error set EE, the locations where a decay can occur. Error sets are ordered from most to least probable, and vertical lines separate the regions with ∣E∣=0,1,2,3|E| = 0, 1, 2, 3 locations, each labeled with its share of shots. The distance grows with ∣E∣|E| and clusters on horizontal plateaus at 25%, 50%, and 75%. The insets explain these plateaus by breaking down the syndrome mismatch for three example error sets, with each syndrome listed by the detectors DiD_i that fire. For instance, exact damping leaves a Z-check ancilla in ∣0⟩|0\rangle quiet, whereas the twirled channel erroneously fires its detector pair half the time (50% plateau). (c) Logical-flip probability P(L=1∣S)P(L = 1 \mid S) of each syndrome under the exact and twirled channels. Circled syndromes lie on opposite sides of 1/21/2 (tinted quadrants), so lookup decoders built from the two models apply opposite corrections to them. Decoding with twirled statistics raises the logical error rate from 0.424% to 0.458% on 10710^7 exact shots. Shown are syndromes seen in at least 100 shots under both models (99.75% of exact shots, standard errors at most 0.05%).

To locate where the two models differ, we sort shots by their error set EE (Figure 2(b)), the locations where a decay can occur. Our pre-sampling identifies these locations as the deferred events of a proposal. Each location enters EE with probability γv\gamma_v, so P(E)P(E) is known in closed form and lets us estimate the exact distribution set by shot (Supplementary Note S5 A). We draw the Pauli errors of the twirled channel at the same locations and compare the two models for each EE. The distance is near zero when EE is empty, since no decay can occur. It grows with ∣E∣|E|, because each location in EE is a place where the two models act differently. For each ∣E∣|E|, distances cluster near zero and along plateaus at 25%, 50%, and 75%. The syndrome distributions of three example error sets (Figure 2(b), zooms) reveal the origin of this structure. Amplitude damping leaves ∣0⟩\lvert0\rangle unchanged, whereas the twirled channel can flip it. Consequently, a location of EE on a Z-check ancilla in ∣0⟩\lvert0\rangle produces no detection event under exact damping, but triggers a detector pair half the time under the twirled channel, generating the 50% plateau. With two such locations, the Pauli twirling approximation spreads over four equally likely syndromes and the distance reaches 75%.

Finally, a decoder built from these statistics inherits the identified mismatch (Figure 2(c)). We build a lookup table from each model and test both on the same 10710^7 exact-noise records. The table built from the twirled model fails on 0.458% of these records, against 0.424% for the exact table, an 8% relative increase in logical error rate. Because the test records follow the exact noise, each syndrome counts in proportion to its exact probability. Figure 2(c) shows only syndromes seen in at least 100 shots under both models. Given that rarer syndromes arise mostly from larger error sets, where the models differ more Figure 2(b), one could expect them to receive opposite corrections more often. This lookup decoder is a

simple case, which uses only the side of 1/21/2 on which each estimate of P(L=1∣S)P(L = 1 \mid S) falls, and twirling could affect more sophisticated decoders more. For instance, soft-output decoders, which estimate this probability itself [38], also respond to shifts that do not cross 1/21/2, and learned decoders that take the full measurement bitstrings as input [4], not only the syndromes computed from them, are also sensitive to differences that the syndromes do not show.

Accelerating exact trajectory simulation

We compare the sampling throughput of our implementation with conventional trajectory sampling in CUDA-Q v0.15.1 [29], using its cuStateVec-based GPU statevector simulator [37], in both terminal allocation modes of Sec. III B. We also compare with the near-Clifford simulator Clifft [7] on circuits with only Pauli noise, since it does not support noise channels with non-unitary Kraus operators, such as amplitude damping. Our generalized PTSBE and CUDA-Q both evolve single-precision GPU statevectors under the same exact channels on one GPU. Clifft runs on 16 CPU cores. We expect the timings reported here to improve as we continue to develop our open-source implementation (Supplementary Note S7 B).

Proportional sampling

We first run the 17-qubit surface-code memory of Sec. IV A, its X-basis counterpart, and a 10-qubit distance-3 color-code memory, all under amplitude damping, and measure the throughput for MM shots, one per proposal Figure 3(a). At M=102M = 10^{2}, the speedup is 1.5×1.5\times to 3.5×3.5\times, depending on the memory circuit, because the 10210^{2} draws contain only 54 distinct proposals in each surface-code memory and 37 in the color code. As MM increases, the most probable trajectories keep recurring and the fraction of distinct shots falls, so that at M=106M = 10^{6} the speedup reaches 11×11\times for both surface-code memories. The color code has fewer noise locations, 261 against 384, so its trajectories repeat more often, leading to a greater speedup of 24×24\times.

Figure 3. Speedup of generalized PTSBE over trajectory sampling and near-Clifford simulation. (a) Speedup over trajectory sampling in CUDA-Q (top) and fraction of distinct shots, the number of distinct (trajectory, terminal bitstring) pairs per shot (bottom), against the number of shots MM, for three distance-3 memories run for three rounds under amplitude damping. Clifft is not shown, since it can only approximate this noise channel. (b) Speedup at 10610^{6} shots over CUDA-Q (solid) and over Clifft (dashed), against the density η\eta of non-Clifford gates in random monitored circuits of n=16n = 16, 2424, and 3030 qubits and depth D=8D = 8. Each Clifford gate is replaced with probability η\eta by a non-Clifford Pauli rotation, under the same noise at every η\eta. Generalized PTSBE is faster than CUDA-Q at every density and outperforms Clifft beyond a crossover density that falls from 62%62\% at n=16n = 16 to 24%24\% at n=30n = 30. Clifft is faster in the shaded region, where the speedup is below 1. The points labeled AD repeat the η=100%\eta= 100\% circuits with amplitude damping in place of the Pauli gate noise, which Clifft does not support. Points are geometric means over three runs, and bars show one standard deviation of the log rate.

To go beyond QEC circuits, we consider random monitored circuits [39, 40] of n=16n = 16, 2424, and 3030 qubits with D=8D = 8 alternating layers of random single- and two-qubit Clifford gates Figure 3(b). Each gate is replaced with probability η\eta by a non-Clifford Pauli rotation, so that η\eta sets the non-Clifford gate density. Some qubits are measured and reset after every second layer, and Pauli gate noise of probability 10−310^{-3} acts throughout, independently of η\eta. Details and D=16D = 16 circuits are discussed in Supplementary Note S7. We sweep η\eta and compare with CUDA-Q and Clifft. Near the Clifford regime, Clifft is faster since it is designed for such circuits. Its cost grows with the number of non-Clifford rotations, however, and our method outperforms it above η≈62%\eta\approx62\%, 35%35\%, and 24%24\% for n=16n = 16, 2424, and 3030, reaching up to 3.8×3.8\times, 103×10^3\times, and 681×681\times respectively at η=1\eta= 1. The speedup over CUDA-Q is nearly flat in η\eta, reaching 4747–318×318\times depending on the circuit size, since a statevector engine applies Clifford and non-Clifford gates at the same cost.

We also run the η=1\eta= 1 circuits with the Pauli gate noise replaced by amplitude damping (AD) of strength γ=10−3\gamma= 10^{-3} after single-qubit layers and 5×10−45 \times10^{-4} per qubit after two-qubit layers [Fig. 3(b), AD]. Stabilizer and near-Clifford simulators such as Stim and Clifft can only approximate this channel, so we compare with CUDA-Q only, giving speedups of 176×176\times, 111×111\times, and 83×83\times for n=16n = 16, 2424, and 3030, of the same order as with Pauli noise.

The speedup decreases with nn, because larger circuits have more noise locations, so trajectories repeat less often, and because the reported runs sample the final states only once all trajectories are complete, which requires preparing each of them again, a cost that grows with nn. A future version of our implementation will offer an alternative readout mode, which samples each trajectory as soon as its final state is reached.

Nonproportional sampling

As in the original PTSBE algorithm [34], our simulator supports a nonproportional mode which assigns the same number mm of terminal samples to every trajectory, yielding many labeled shots per trajectory evolution, as needed for instance for large QEC datasets. We now apply it in the presence of state-dependent events, using a random monitored circuit with n=30n = 30, D=16D = 16, η=1\eta= 1, and amplitude damping on every qubit, which records 14 mid-circuit and 30 terminal bits per shot [Fig. 4]. We draw 100 proposals, which give 100 distinct trajectories.

Conventional trajectory sampling in CUDA-Q evolves one trajectory per shot, at 0.723 shots/s, and we compare this rate with our shot rate per trajectory (Supplementary Note S7 E). The speedup rises from 1.4×1.4\times at m=102m = 10^2 to over 70,000×70{,}000\times at m=107m = 10^7, because generating the trajectories takes a fixed 46.3 s while sampling their final states grows only from 55.5 s to 149 s over five orders of magnitude in mm. Across these batch sizes, the fraction of distinct shots stays above 0.89 [Fig. 4, bottom], so most additional terminal samples still yield new labeled records, for instance as training data for decoders.

All records share the noise realizations of these 100 trajectories, and each carries its trajectory label. Because the number of trajectories and the number of samples per trajectory are set independently, a dataset can cover more noise realizations or draw more terminal samples from each trajectory. When trajectories repeat, weighting each record by the multiplicity of its trajectory restores unbiased estimates of circuit statistics (Supplementary Note S3B).

Discussion

Generalized PTSBE is faster than conventional trajectory sampling in all of the diverse benchmarks explored in this manuscript. In particular, it is up to 24×24\times faster on QEC memories in the proportional mode, up to 318×318\times faster on random monitored circuits, and up to 70,000×70{,}000\times faster per trajectory in the nonproportional mode. It also outperforms the near-Clifford simulator Clifft beyond a crossover density of non-Clifford gates. In generalized PTSBE, each distinct trajectory is evolved just once, regardless of how many shots it serves, so the speedup depends on how many such trajectories and shots a circuit requires.

For QEC applications, these quantities grow with the number of likely error configurations, which is in turn set by code size, number of rounds, and error rates, such that larger codes and longer memories potentially lead to smaller speedups (Supplementary Note S6 A). Conversely, for larger codes, each evolution acts on a larger statevector, which increases the time saved per avoided evolution, as this grows exponentially in qubit number. The net effect of these two competing phenomena is system-dependent and could be evaluated in future studies. The nonproportional mode speedup is insensitive to the number of distinct trajectories, because its gain comes from repeated readout of each one, and thus strictly benefits from larger codes. Both modes should also benefit from further optimization of our implementation (Supplementary Note S7 B).

Pauli twirling is often adopted so that high-throughput simulators can be used, but this choice is not generally accurate for QEC data. In our comparison, a lookup decoder built from twirled statistics makes 8% more logical errors on exact noise, whereas the syndrome distribution that a decoder takes as input shifts by a TVD of 19.8% given a detection. The conditional analysis traces this shift to error sets in which the twirled channel flips states that damping leaves unchanged. Stabilizer simulators can avoid the Pauli twirling approximation when a channel is a mixture of Clifford operations and reset with positive weights, as thermal relaxation is for T2≤T1T_2 \le T_1 [12]. Pure amplitude damping, with T2=2T1T_2 = 2T_1 as in Sec. IV A, requires negative weights, which cannot serve as sampling probabilities, while our method samples it exactly.

Together, the speed and exactness of our approach enable large-scale simulation of protocols built on mid-circuit measurements and non-Clifford gates under realistic non-Pauli noise, providing a practical tool for the development of fault-tolerant quantum computers. In particular, at millions of labeled shots per second, each tagged with the trajectory that produced it, our method can supply the large and accurate datasets that AI-based decoders require under realistic nonunital channels, such as amplitude damping.

These capabilities open several directions for future work, as we expect the speedups of our method to benefit any study that samples many shots of a generally and realistically noisy circuit. For QEC, the most direct application is to train learned decoders on these extensive and exact datasets. Such decoders could also be compared with ones trained on twirled data, beyond the distance-three code and lookup decoder of Sec. IV A. The same contrast between exact and approximate noise models extends to logical gadgets, in particular to protocols based on repeat-until-success [41, 42] or postselection, whose mid-circuit measurements our method treats exactly, such as gate synthesis, magic-state distillation [43], and cultivation [44]. Identifying the regimes in which approximate models fail would accelerate the design of such gadgets and of their circuit implementations, a task that models trained on exact data could also support. Combining partial pre-sampling with tensor-network PTSBE, which has been demonstrated on circuits of up to 200 qubits with Pauli noise [35], could bring mid-circuit measurements and general noise channels beyond the 30 qubits of statevector simulation. Finally, our framework can be applied immediately to rare-event sampling, as is vital for achieving low logical error-rate decoders [45, 46].

acknowledgments

L.F. performed part of this work during an internship at NVIDIA. L.F. and D.R.E. acknowledge research funding from NVIDIA to MIT. The authors acknowledge the use of AI tools to assist with code development and manuscript editing. The authors reviewed all AI-assisted output and take full responsibility for the content of this work.

code availability

Our implementation will soon be released as open-source software.

competing interests

T.L.P., J.G.L., and L.F. are inventors on a patent application filed by NVIDIA, titled “Statevector caching and batching techniques for efficient mid-circuit measurement simulations”. The other authors declare no competing interests.

Author contributions

T.L.P., J.G.L., and L.F. conceived the project. L.F. developed the method and its software implementation, performed the simulations, and analyzed the results. I.S. contributed to the algorithm for general Kraus channels, T.N. to the software implementation, and J.G.L. to the quantum error correction applications. P.P. supported the final code development and optimization, large-scale benchmarks, and the preparation of the open-source software. D.L., B.K., and K.M.S. provided guidance on the applications, simulations, and analysis. T.L.P. and D.R.E. supervised the research. L.F. wrote the manuscript with input from all authors.

References

Supplementary Information:

Exactness of the method

Events, proposals, and trajectories

The circuit starts in a normalized pure state ∣ψ0⟩|\psi_0\rangle and contains LL stochastic events, each a local Markovian channel or a measurement. Event VvV_v has outcomes a∈Ava \in\mathcal{A}_v with square Kraus operators Kv,aK_{v,a}, and we write Av,a=Kv,a†Kv,aA_{v,a}=K_{v,a}^{\dagger}K_{v,a}, so that ∑aAv,a=I\sum_a A_{v,a}=I.

A proposal Z=(Z1,…,ZL)Z=(Z_1,\ldots,Z_L) carries one variable ZvZ_v per event, either a pre-sampled outcome or the residual distribution pvresp^{\mathrm{res}}_v. A trajectory α\alpha lists every outcome needed to reconstruct its state, including reset outcomes that are never recorded. A shot consists of the recorded mid-circuit outcomes and one bitstring yy sampled from the trajectory’s final state. Each final state is sampled mαm_\alpha times, so several shots can share a trajectory.

Pre-sampled and deferred outcomes

Eqs. (4)–(6) split each outcome probability into a state-independent part pv,a=σmin⁡(Kv,a)2=λmin⁡(Av,a)p_{v,a}=\sigma_{\min}(K_{v,a})^2=\lambda_{\min}(A_{v,a}), the lower bound of the delayed inner product algorithm [28], and a residual part. Two facts complete the argument. First, Av,a⪰pv,aIA_{v,a}\succeq p_{v,a}I, so for sv<1s_v<1 the operators

Rv,a=Av,a−pv,aI1−sv(11)R_{v,a}=\frac{A_{v,a}-p_{v,a}I}{1-s_v} \tag*{(11)}

are positive semidefinite and sum to the identity. The residual probabilities pv,ares(ψ)=⟨ψ∣Rv,a∣ψ⟩p^{\mathrm{res}}_{v,a}(\psi)=\langle\psi|R_{v,a}|\psi\rangle of Eq. (5) therefore form a distribution on every normalized state. Second, the ZvZ_v are drawn before execution, independently across events, with

Pr⁡(Zv=a)=pv,a,Pr⁡(Zv=pvres)=1−sv,P(Z)=∏v=1LPr⁡(Zv),(12)\Pr(Z_v=a)=p_{v,a},\qquad\Pr(Z_v=p_v^{\mathrm{res}})=1-s_v,\qquad P(Z)=\prod_{v=1}^{L}\Pr(Z_v), \tag*{(12)}

and a deferred event is completed at run time by an independent draw from pvresp_v^{\mathrm{res}} on the intermediate state. Both routes apply the update of Eq. (3), and by Eq. (6) their probabilities add up to pv,a(ψ)p_{v,a}(\psi). Each event therefore selects its outcome and its conditional state with the ordinary trajectory law. Since the variables ZvZ_v are independent, induction over the events extends this to the joint law of all mid-circuit and terminal measurements. The argument holds in exact arithmetic, and Supplementary Note S6 B gives the numerical tolerances.

Any smaller bounds 0≤bv,a≤pv,a0\leq b_{v,a}\leq p_{v,a} give the same result once svs_v and Rv,aR_{v,a} are recomputed from them. Supplementary Note S4 C uses this freedom. At sv=0s_v=0 every event is deferred and pv,ares=pv,ap^{\mathrm{res}}_{v,a}=p_{v,a}. At sv=1s_v=1, completeness forces Av,a=pv,aIA_{v,a}=p_{v,a}I, so the outcome probabilities do not depend on the state and no residual draw occurs.

Grouped execution

The NN proposals are independent draws, and grouping identical ones extends the trajectory reuse of the original PTSBE [34] algorithm. The cgc_g members of a group share their outcomes so far, their mid-circuit record, and their remaining proposal, hence the same state ∣ψg⟩|\psi_g\rangle. At a deferred event, drawing their outcomes independently would give outcome counts Cg,aC_{g,a}, with ∑aCg,a=cg\sum_a C_{g,a}=c_g, distributed as

Pr⁡({Cg,a}a∣cg,ψg)=cg!∏aCg,a!∏a[pv,ares(ψg)]Cg,a.(13)\Pr(\{C_{g,a}\}_a\mid c_g,\psi_g)=\frac{c_g!}{\prod_a C_{g,a}!}\prod_a\left[p^{\mathrm{res}}_{v,a}(\psi_g)\right]^{C_{g,a}}. \tag*{(13)}

One draw of this vector reproduces these counts, and only outcomes with Cg,a>0C_{g,a}>0 are evolved. Repeating the argument at every later event shows that grouped and independent execution produce the same law.

Two proposals can end in the same trajectory α\alpha, because an outcome can be pre-sampled or drawn on the intermediate state. They then share a final state and are merged by adding their multiplicities.

The multiplicities sum to NN, so drawing cαc_\alpha terminal samples from each final state reproduces the counts of NN independent trajectory simulations. Supplementary Note S3 treats larger terminal allocations, and Algorithm 1 summarizes the procedure.

Measurements, resets, and readout

A projective measurement with more than one possible outcome has λmin⁡(Pa)=0\lambda_{\min}(P_a)=0 for every projector, hence sv=0s_v=0, and its residual law is the Born rule. A reset to ∣0⟩\lvert0\rangle uses K0=∣0⟩⟨0∣K_0=\lvert0\rangle\langle0\rvert and K1=∣0⟩⟨1∣K_1=\lvert0\rangle\langle1\rvert. Its outcome is not recorded but stays in the trajectory, because for an entangled input the two outcomes leave the other qubits in different states. Terminal measurements of commuting Pauli products are sampled jointly after one basis change, which preserves their correlations.

Kraus representation and max-ss

Unitary freedom and objective

Suppressing the event index, let a channel E\mathcal{E} on a dd-dimensional space have Kraus operators K1,…,KkK_1,\ldots,K_k. Any unitary W∈U(k)W\in\mathrm{U}(k) gives another representation Ka′=∑bWabKbK'_a=\sum_b W_{ab}K_b of the same channel, since

∑aKa′ρKa′†=∑b,c(∑aWabWac∗)KbρKc†=∑bKbρKb†.(14)\sum_a K'_a\rho K_a'^\dagger=\sum_{b,c}\left(\sum_a W_{ab}W_{ac}^*\right)K_b\rho K_c^\dagger=\sum_b K_b\rho K_b^\dagger. \tag*{(14)}

The trajectories change with the representation [47, 48, 49, 50], and so does the pre-sampling probability. Max-ss preprocessing searches for the representation with the largest

s(W)=∑aσmin⁡(∑bWabKb)2.(15)s(W)=\sum_a\sigma_{\min}\left(\sum_b W_{ab}K_b\right)^2. \tag*{(15)}

It applies only to noise channels whose outcomes are not recorded, since remixing the outcomes of a measurement would change the record. A larger svs_v leaves fewer deferred draws, ∑v(1−sv)\sum_v(1-s_v) per proposal on average.

Upper bound and amplitude damping

The matrix KaKa†K_aK_a^\dagger has the same eigenvalues as Ka†KaK_a^\dagger K_a, so KaKa†⪰paIK_aK_a^\dagger\succeq p_aI. Summing over aa gives E(I)⪰sI\mathcal{E}(I)\succeq sI, hence

s≤sub≡λmin⁡[E(I)]≤1(16)s\le s_{\mathrm{ub}}\equiv\lambda_{\min}[\mathcal{E}(I)]\le1 \tag*{(16)}

for every representation, where the last inequality follows from Tr⁡E(I)=d\operatorname{Tr}\mathcal{E}(I)=d. A representation that reaches subs_{\mathrm{ub}} is optimal.

If s=1s=1, the positive semidefinite matrices Ka†Ka−paIK_a^\dagger K_a-p_aI sum to zero and all vanish. Each nonzero KaK_a is then pa\sqrt{p_a} times a unitary, and the representation is a mixture of unitaries. Conversely, a channel that is a mixture of unitaries has s=1s=1 in its mixture form, even when another of its representations has s<1s<1. Nonunital channels never reach s=1s=1, since a mixture of unitaries maps II to II.

The standard amplitude-damping representation of Eq. (22) has p0=1−γp_0=1-\gamma and p1=0p_1=0, and

E(I)=diag⁡(1+γ,1−γ),s=sub=1−γ.(17)\mathcal{E}(I)=\operatorname{diag}(1+\gamma,1-\gamma),\qquad s=s_{\mathrm{ub}}=1-\gamma. \tag*{(17)}

It is therefore optimal, and preprocessing leaves it unchanged. The Pauli channels of the random circuits already have s=1s=1, so preprocessing plays no role in the reported timings. For generalized amplitude damping with equilibrium excited population pe<1/2p_e<1/2 (Sec. S2 D), E(I)=diag⁡[1+γ(1−2pe),1−γ(1−2pe)]\mathcal{E}(I)=\operatorname{diag}[1+\gamma(1-2p_e),1-\gamma(1-2p_e)] and sub=1−γ(1−2pe)s_{\mathrm{ub}}=1-\gamma(1-2p_e).

The search starts from the supplied representation and from random unitaries. Each step multiplies WW by eiϵHe^{i\epsilon H} for a random Hermitian HH, keeps the step only if ss increases, and shrinks ϵ\epsilon after a rejection. It stops within 10−910^{-9} of the bound (S6) or after a fixed number of steps. A candidate must reproduce the Choi matrix ∑avec⁡(Ka)vec⁡(Ka)†\sum_a \operatorname{vec}(K_a)\operatorname{vec}(K_a)^\dagger of the input to 10−1010^{-10} and pass the checks of Supplementary Note S6 B. Otherwise the original representation is kept, so the adopted ss never decreases.

Examples

Table S1 applies the search to five channels.

ChannelInputAfter searchsubs_{\mathrm{ub}}
Amplitude damping, γ=0.3\gamma= 0.30.7000.700000.70000
Phase damping, λ=0.4\lambda= 0.40.6001−1.3×10−51 - 1.3 \times10^{-5}1
Generalized damping, γ=0.2\gamma= 0.2, pe=0.3p_e = 0.30.8000.919850.92000
Two-qubit dephasing, λ=0.2\lambda= 0.20.8001−2.6×10−71 - 2.6 \times10^{-7}1
Random channel, rank three0.3450.863110.86313

Table S1. Pre-sampling probability ss before and after the search of Sec. S2 C, and the bound subs_{\mathrm{ub}} of Eq. (16). For phase damping and two-qubit dephasing, the closed forms of Sec. S2 D reach s=1s = 1 exactly. Every adopted representation reproduces the input Choi matrix to 10−1010^{-10}.

  • Amplitude damping, Eq. (22), is already optimal (Sec. S2 B).

  • Phase damping with parameter λ\lambda, with K0=diag⁡(1,1−λ)K_0 = \operatorname{diag}(1,\sqrt{1-\lambda}) and K1=diag⁡(0,λ)K_1 = \operatorname{diag}(0,\sqrt{\lambda}), multiplies the coherences by 1−λ\sqrt{1-\lambda}. So does the mixture K0′=1−q IK'_0 = \sqrt{1-q}\,I, K1′=q ZK'_1 = \sqrt{q}\,Z with q=(1−1−λ)/2q = (1-\sqrt{1-\lambda})/2, which has s=1s = 1.

  • Generalized amplitude damping with equilibrium excited population pep_e uses 1−pe K0\sqrt{1-p_e}\,K_0, 1−pe K1\sqrt{1-p_e}\,K_1, pe XK0X\sqrt{p_e}\,XK_0X, and pe XK1X\sqrt{p_e}\,XK_1X, with K0,1K_{0,1} the amplitude-damping operators of Eq. (22).

  • Two-qubit dephasing, with K0=diag⁡(1,1,1,1−λ)K_0 = \operatorname{diag}(1,1,1,\sqrt{1-\lambda}) and K1=λ∣11⟩⟨11∣K_1 = \sqrt{\lambda}\lvert11\rangle\langle11\rvert, attenuates the coherences involving ∣11⟩\lvert11\rangle. It has the same closed form as phase damping, with diag⁡(1,1,1,−1)\operatorname{diag}(1,1,1,-1) in place of ZZ.

  • The random rank-three channel draws three 2×22 \times2 matrices GaG_a with independent standard normal real and imaginary entries and sets Ka=Ga(∑bGb†Gb)−1/2K_a = G_a\left(\sum_b G_b^\dagger G_b\right)^{-1/2}.

Terminal allocation

Proportional mode

Let P(α)P(\alpha) be the probability of the trajectory α\alpha, mid-circuit outcomes included, and P(y∣α)P(y \mid\alpha) that of the bitstring yy given α\alpha. The NN proposals give NN independent trajectory draws with multiplicities cαc_\alpha, and the terminal samples are independent given the trajectories. Supplementary Note S1 C shows that mα=cαm_\alpha= c_\alpha reproduces independent sampling.

The allocation mα=bcαm_\alpha= b c_\alpha, with bb a positive integer, gives bNbN records. It corresponds to the optional proportional resampling of the original PTSBE [34], with sampled multiplicities in place of trajectory probabilities. A record picked at random follows the circuit distribution, but records drawn from the same trajectory are correlated. For a real statistic f(α,y)f(\alpha,y) with mean μα\mu_\alpha and variance σα2\sigma_\alpha^2 given α\alpha, the average μ^\hat{\mu} of ff over the bNbN records has variance

Var⁡(μ^)=Var⁡α(μα)N+Eα(σα2)Nb.(18)\operatorname{Var}(\hat{\mu}) = \frac{\operatorname{Var}_\alpha(\mu_\alpha)}{N} + \frac{\mathbb{E}_\alpha(\sigma_\alpha^2)}{Nb}. \tag*{(18)}

A larger bb shrinks the second term. The first term depends only on the number of trajectory draws.

Nonproportional mode

Nonproportional mode gives the same number mm of terminal samples to each of the NtrajN_{\mathrm{traj}} distinct trajectories. An unweighted average over the records then weights every trajectory by 1/Ntraj1/N_{\mathrm{traj}} instead of cα/Nc_\alpha/N. The multiplicities are kept, and with fˉα\bar{f}_\alpha the mean of ff over the mm samples of α\alpha, the weighted estimator

μ^w=∑αcαNfˉα(19)\widehat{\mu}_w = \sum_\alpha\frac{c_\alpha}{N}\bar{f}_\alpha \tag*{(19)}

is unbiased over the trajectory draws. Its variance has the same trajectory term Var⁡α(μα)/N\operatorname{Var}_\alpha(\mu_\alpha)/N as Eq. (18), plus a measurement term proportional to 1/m1/m. When the proposals are chosen deliberately, as in Supplementary Note S5 A where each error set EE receives its own number of runs, the records of each error set are averaged first and the averages are weighted by P(E)P(E), as in Eq. (27).

In Figure 4, N=Ntraj=100N=N_{\mathrm{traj}}=100, so all weights are equal.

Figure 4. Bulk generation of labeled shots with generalized PTSBE in nonproportional mode. A random monitored circuit of n=30n = 30 qubits and depth D=16D = 16, with amplitude damping on every qubit, is sampled from 100 trajectories that each receive the same number mm of shots. Top: shot rate per trajectory, the total rate divided by the number of trajectories, against mm. Conventional trajectory sampling in CUDA-Q (blue) simulates one trajectory per shot. The speedup grows from 1.4×1.4\times at m=102m = 10^2 to 70,000×\times at m=107m = 10^7. Bottom: fraction of distinct shots, the number of distinct (trajectory, terminal bitstring) pairs per shot. Each shot carries its trajectory label.

Fraction of distinct shots

The fraction of distinct shots is the number of distinct pairs (α,y)(\alpha,y) among the M=∑αmαM=\sum_\alpha m_\alpha shots, divided by MM. Two shots with the same bitstring and different trajectories count as distinct. The fraction measures repetition in the labeled dataset and says little about how often trajectories repeat. At n=24n=24 and D=16D=16, almost every shot is distinct even though each trajectory serves about four shots (Figure S3).

Figure S3. Trajectory reuse in the random monitored circuits at 10610^{6} proportional shots. a, Distinct trajectories per shot. Each distinct trajectory is prepared once for terminal sampling. b, Fraction of distinct shots, the number of distinct (trajectory, measurement outcome) pairs per shot. At n=24n = 24 and D=16D = 16 almost every shot is distinct, even though each trajectory serves about four shots. Open markers are the AD circuits at D=16D = 16. Means over three runs.

For one trajectory sampled mm times, the expected number of distinct bitstrings is

E[να∣α]=∑y[1−(1−P(y∣α))m].(20)\mathbb{E}[\nu_\alpha\mid\alpha]=\sum_y\left[1-\left(1-P(y\mid\alpha)\right)^m\right]. \tag*{(20)}

A uniform distribution over 2302^{30} bitstrings would still give a distinct fraction of about 0.995 at m=107m=10^7. The measured 0.89 in Figure 4 shows that each trajectory’s readout distribution is far from uniform.

Amplitude damping and its Pauli twirl

Memory circuit and noise

Figure 2 uses a distance-three rotated surface-code memory storing ∣0⟩L\lvert0\rangle_L, the distance-three ZZ memory of the Clifft benchmark suite [7] with its noise instructions removed. Nine data qubits and eight ancillas run three rounds of stabilizer measurement, followed by a ZZ-basis measurement of the data qubits. The syndrome S∈{0,1}24S\in\{0,1\}^{24} collects all detectors: four at the first round, eight comparing each pair of successive rounds, and four at the final readout. Each detector, like the logical bit LL, is a parity of measurement outcomes that vanishes without errors.

Each round lasts 1.1 μs\mu\mathrm{s}, the cycle time of the distance-three experiment of Ref. [51], and uses that experiment’s gate and readout durations: two 40-ns single-qubit layers, four 98-ns entangling layers, and a 400-ns readout interval. The remaining 228 ns form the reset interval. Amplitude damping acts on every qubit after each gate layer and before readout, and on the nine data qubits during reset, which gives 3(2+4+1)⋅17+9=3843(2+4+1)\cdot17+9=384 noise locations. An exposure duration Δtv\Delta t_v gives the damping parameter

γv=1−exp⁡(−Δtv/T1),(21)\gamma_v=1-\exp(-\Delta t_v/T_1), \tag*{(21)}

with T1=68 μsT_1=68\,\mu\mathrm{s}, the mean operating T1T_1 of the 105-qubit processor of Ref. [52]. We omit additional dephasing, so the model has T2=2T1T_2=2T_1, and amplitude damping is the only noise source. Gates, initialization, and measurements are otherwise ideal, and the exact and twirled simulations share the circuit, the detectors, and the noise locations.

Twirl formulas

At location vv, amplitude damping has Kraus operators

Kv,0=diag⁡(1,1−γv),Kv,1=γv∣0⟩⟨1∣.(22)K_{v,0}=\operatorname{diag}(1,\sqrt{1-\gamma_v}),\qquad K_{v,1}=\sqrt{\gamma_v}|0\rangle\langle1|. \tag*{(22)}

A qubit with excited population ρ11\rho_{11} decays with probability γvρ11\gamma_v\rho_{11}. The channel leaves ∣0⟩|0\rangle unchanged and is nonunital, since it maps II to I+γvZI+\gamma_v Z. The Pauli twirl of a single-qubit channel [8], T(E)(ρ)=14∑PPE(PρP)P\mathcal{T}(\mathcal{E})(\rho)=\frac{1}{4}\sum_P P\mathcal{E}(P\rho P)P with P∈{I,X,Y,Z}P\in\{I,X,Y,Z\}, removes the cross terms between the Pauli components of the Kraus operators. It leaves the Pauli channel with probabilities pP=∑a∣Tr⁡(PKa)/2∣2p_P=\sum_a|\operatorname{Tr}(PK_a)/2|^2, which for amplitude damping are

pX=pY=γv4,pZ=(1−1−γv)24,pI=1−γv2−pZ.(23)p_X=p_Y=\frac{\gamma_v}{4},\qquad p_Z=\frac{(1-\sqrt{1-\gamma_v})^2}{4},\qquad p_I=1-\frac{\gamma_v}{2}-p_Z. \tag*{(23)}

The twirled channel is unital and flips ∣0⟩|0\rangle with probability γv/2\gamma_v/2, where damping does nothing. Using Eq. (23) at every location gives the Pauli circuit that we sample with Stim [6].

Conditioning on an error set

The standard representation has pv,0=1−γvp_{v,0}=1-\gamma_v and pv,1=0p_{v,1}=0, so each location is deferred with probability γv\gamma_v. The error set EE of a proposal is its set of deferred locations, which need not coincide with the locations where a decay occurs. It has probability

P(E)=∏v∈Eγv∏v∉E(1−γv).(24)P(E)=\prod_{v\in E}\gamma_v\prod_{v\notin E}(1-\gamma_v). \tag*{(24)}

Outside EE the update Kv,0K_{v,0} is applied, and inside EE the qubit decays with probability ρ11\rho_{11} on the intermediate state.

Figure 2(b) conditions the twirled channel on the same EE by applying Supplementary Note S1 B to the twirled channel with bounds bI=1−γvb_I=1-\gamma_v and bX=bY=bZ=0b_X=b_Y=b_Z=0. The twirled model then applies the identity outside EE and, inside EE, a Pauli drawn from the residual distribution

(πI,πX,πY,πZ)=(12−pZγv,14,14,pZγv).(25)(\pi_I,\pi_X,\pi_Y,\pi_Z)=\left(\frac{1}{2}-\frac{p_Z}{\gamma_v},\frac{1}{4},\frac{1}{4},\frac{p_Z}{\gamma_v}\right). \tag*{(25)}

Supplementary Note S1 then gives

∑EP(E)Ptwirl(S∣E)=Ptwirl(S).(26)\sum_E P(E)P_{\mathrm{twirl}}(S\mid E)=P_{\mathrm{twirl}}(S). \tag*{(26)}

with the same P(E)P(E) as the exact model. Other bounds give the same unconditional twirl with different conditional distributions, so the per-set comparison depends on this choice, while the global comparisons do not.

Each injected Pauli flips a fixed set of detectors, so summing over the at most 4∣E∣4^{|E|} assignments gives Ptwirl(S∣E)P_{\mathrm{twirl}}(S\mid E) exactly. Under exact noise the Kv,0K_{v,0} updates outside EE still act, so even the empty set gives a detection, with probability 6.3×10−46.3\times10^{-4}, whereas its twirled distribution is always quiet.

Statistics of the QEC comparison

Estimate of the exact distribution

Our method generates the exact-noise records in single precision, with one terminal sample per draw, each record being a pair (S,L)(S,L). We estimate their distribution error set by error set. Every set with ∣E∣≤2|E|\le2 is simulated on its own, and sets with ∣E∣≥3|E|\ge3 are drawn from Eq. (24) conditioned on ∣E∣≥3|E|\ge3 and pooled into one tail sample (Table S2). Counts are kept separately for each error set, even when two error sets lead to the same trajectory. With q^E(x)\widehat{q}_E(x) the fraction of the nEn_E records of error set EE equal to xx, and q^tail(x)\widehat{q}_{\mathrm{tail}}(x) the same fraction among the ntailn_{\mathrm{tail}} records with ∣E∣≥3|E| \ge3,

P^exact(x)=∑∣E∣≤2P(E)q^E(x)+P(∣E∣≥3)q^tail(x)(27)\widehat{P}_{\mathrm{exact}}(x) = \sum_{|E|\le2} P(E)\widehat{q}_E(x) + P(|E| \ge3)\widehat{q}_{\mathrm{tail}}(x) \tag*{(27)}

for any value xx of SS or of (S,L)(S,L). The weights are known exactly, so the allocation sets the precision without biasing the estimate. Sampling is independent within and across error sets, which gives the plug-in variance

Var⁡^(x)=∑∣E∣≤2P(E)2nEq^E(x)[1−q^E(x)]+P(∣E∣≥3)2ntailq^tail(x)[1−q^tail(x)].(28)\widehat{\operatorname{Var}}(x) = \sum_{|E|\le2} \frac{P(E)^2}{n_E}\widehat{q}_E(x)[1-\widehat{q}_E(x)] + \frac{P(|E| \ge3)^2}{n_{\mathrm{tail}}}\widehat{q}_{\mathrm{tail}}(x)[1-\widehat{q}_{\mathrm{tail}}(x)]. \tag*{(28)}

Figure 2(a) uses 10910^9 Stim records and Figure 2(c) uses 2.1×10102.1 \times10^{10}. A separate set of 10710^7 exact-noise records from proportional sampling serves as the decoder test set and checks this estimate: the two quiet-syndrome probabilities differ by 0.3 combined standard errors. Rebuilding the twirled distribution from its conditional distributions through Eq. (26) also agrees with direct Stim sampling, with standardized differences of mean 0.02 and standard deviation 0.97 over the 1,000 most likely nonzero syndromes.

Syndrome ratios and distances

Figure 2(a) ranks the nonzero syndromes by 12[P^exact(S)+P^twirl(S)]\frac{1}{2}[\widehat{P}_{\mathrm{exact}}(S) + \widehat{P}_{\mathrm{twirl}}(S)] and shows the first 1,000, which carry 95% of the exact and 93% of the twirled probability given a detection. It plots the ratio P^twirl(S)/P^exact(S)\widehat{P}_{\mathrm{twirl}}(S)/\widehat{P}_{\mathrm{exact}}(S), with pointwise bars e±σ^log⁡e^{\pm\widehat{\sigma}_{\log}} around it, where

σ^log⁡2(S)=Var⁡^(S)P^exact(S)2+1−P^twirl(S)ctwirl(S)(29)\widehat{\sigma}_{\log}^2(S) = \frac{\widehat{\operatorname{Var}}(S)}{\widehat{P}_{\mathrm{exact}}(S)^2} + \frac{1-\widehat{P}_{\mathrm{twirl}}(S)}{c_{\mathrm{twirl}}(S)} \tag*{(29)}

and ctwirl(S)c_{\mathrm{twirl}}(S) counts SS in the twirled sample. Among the displayed syndromes seen under both models, the largest ratio is 329, with σ^log⁡=0.21\widehat{\sigma}_{\log} = 0.21, and 11 ratios exceed 100. Another 25 displayed syndromes never occur in the exact sample and are marked separately.

A detection occurs in 25.1% of the exact shots and 30.3% of the twirled ones. We compute the total-variation distance dTV(P,Q)=12∑S∣P(S)−Q(S)∣d_{\mathrm{TV}}(P,Q) = \frac{1}{2}\sum_S |P(S)-Q(S)| between the full distributions and between the distributions given a detection (Table S3). For the uncertainty, 200 Poisson bootstrap replicates replace every count by a Poisson draw with that mean and renormalize each error set and the tail sample with their weights fixed. The standard error is the standard deviation of the replicate distances. Their mean exceeds the observed distance by 0.02 percentage points over all syndromes and 0.05 given a detection, which is how much finite sampling inflates the estimate. The noise reference is the 95th percentile over replicates of 12∑S∣δexact(S)−δtwirl(S)∣\frac{1}{2}\sum_S |\delta_{\mathrm{exact}}(S)-\delta_{\mathrm{twirl}}(S)|, where δ\delta is the resampled minus the original estimate. It gives the distance that sampling alone produces.

All syndromesGiven a detection
Estimate6.5419.84
Bootstrap standard error0.0010.004
Noise reference0.100.38

Table S3. Total-variation distances between the exact and twirled syndrome distributions of Figure 2, in percent.

Distances given the error set

Figure 2(b) shows, for every set with at most two deferred locations and for the three-location sample, the distance dE=dTV(P^exact(⋅∣E),Ptwirl(⋅∣E))d_E = d_{\mathrm{TV}}(\widehat{P}_{\mathrm{exact}}(\cdot\mid E),P_{\mathrm{twirl}}(\cdot\mid E)), with tied ranks spread at random. Weighted by P(E)P(E), or by draw multiplicity in the three-location sample, its mean is 0.06%, 9.9%, 20.1%, and 28.8% for ∣E∣=0|E| = 0, 1, 2, and 3. If the exact conditional distributions equaled the twirled ones, finite sampling alone would give 0, 0.04%, 1.9%, and 3.1%, the same weighted mean of the median distance between each set’s twirled distribution and 200 multinomial samples of the exact sample size. These references are not subtracted. The three examples are the most probable sets whose distance lies within 0.02 of 0.5, 0.75, and 0.25.

Logical flips and decoders

Figure 2(c) plots each model’s estimate of P(L=1∣S)=P^(S,L=1)/P^(S)P(L = 1 \mid S) = \widehat{P}(S, L = 1)/\widehat{P}(S) for the syndromes with at least 100 twirled records and at least 100 effective exact records, P^exact(S)2/Var⁡^(S)\widehat{P}_{\mathrm{exact}}(S)^2/\widehat{\operatorname{Var}}(S), among the quiet syndrome and the 10410^4 most likely nonzero ones. The 4,588 syndromes kept carry 99.75% of the exact probability. On the twirled side, 100 records bound the binomial standard error of P(L=1∣S)P(L = 1 \mid S) by 0.05. On the exact side, the delta-method standard error is at most 0.05 for every displayed syndrome.

Each lookup decoder applies the logical correction when its model gives P(L=1∣S)>1/2P(L = 1 \mid S) > 1/2, and no correction for ties or for syndromes absent from the data used to build it. We freeze both tables and evaluate them on the same 10710^7 independent exact-noise records. The table built from exact statistics fails on (0.424±0.002)%(0.424 \pm0.002)\% of them and the table built from twirled statistics on (0.458±0.002)%(0.458 \pm0.002)\%. The paired difference, 0.034±0.0010.034 \pm0.001 percentage points, is a relative increase of 7.9%. The uncertainties are one standard error over the test records, with the tables held fixed, and do not include the finite-sample error of the tables themselves, which could flip syndromes whose estimates of P(L=1∣S)P(L = 1 \mid S) lie close to 1/21/2. The 53 circled syndromes, whose estimates of P(L=1∣S)P(L = 1 \mid S) lie on opposite sides of 1/21/2, carry 0.11% of the exact probability.

Implementation

Execution and caching

Three random-number streams derived from one seed serve the proposals, the residual draws, and the terminal samples, so changing the terminal allocation leaves the trajectories unchanged. Groups are traversed depth first. At a branch, the first occupied outcome continues from the intermediate state, and each other one keeps its outcomes Z1,…,ZvZ_1,\ldots,Z_v and a reference to a copy of the state before the branch. In the benchmarks these copies stay on the GPU within a memory budget, and the oldest are evicted when memory runs out. A missing copy is rebuilt by re-applying Z1,…,Zv−1Z_1,\ldots,Z_{v-1} without new draws, so the cache capacity changes the run time and leaves the results unchanged.

The number of distinct proposals limits the reuse. For NN independent draws, its expectation is

E[Nprop]=∑Z[1−(1−P(Z))N],(30)\mathbb{E}[N_{\mathrm{prop}}] = \sum_Z \left[1 - (1 - P(Z))^N\right], \tag*{(30)}

much smaller than NN when a few proposals dominate, while branching at deferred events raises the number of distinct trajectories again. Figure S3 shows the result for the random circuits. Doubling the depth gives about ten times more distinct trajectories per shot. A deferred damping location that ends without a decay applies K0K_0, as a pre-sampled one does, so proposals that differ only at such locations merge into one trajectory. The amplitude-damping circuits accordingly give two to four times fewer distinct trajectories than their Pauli counterparts.

Finite precision

Channel preprocessing runs in double precision and the statevectors in single precision. The state is not renormalized after every operator. If the stored state is ∣ϕ⟩=κ∣ψ⟩|\phi\rangle= \kappa|\psi\rangle, then

⟨ϕ∣Rv,a∣ϕ⟩∑b⟨ϕ∣Rv,b∣ϕ⟩=⟨ψ∣Rv,a∣ψ⟩,(31)\frac{\langle\phi|R_{v,a}|\phi\rangle}{\sum_b\langle\phi|R_{v,b}|\phi\rangle} = \langle\psi|R_{v,a}|\psi\rangle, \tag*{(31)}

because the residual operators sum to the identity, so residual probabilities are read without renormalizing. Pre-sampled outcomes apply Kv,a/pv,aK_{v,a}/\sqrt{p_{v,a}}, which limits the loss of norm along long sequences of pre-sampled outcomes and leaves the normalized state unchanged.

Each channel must preserve the trace to 10−910^{-9}, and when 1−sv>10−91-s_v > 10^{-9} its residual operators must sum to the identity to 10−710^{-7} in spectral norm. Below 1−sv=10−91-s_v = 10^{-9} the residual branch is dropped. In exact arithmetic, this changes the outcome distribution of that event by at most 1−sv1-s_v in total variation, and that of the circuit by at most the sum of the dropped masses. For small circuits, host-side tests compare the probability of every measurement record, summed over the pre-sampled and deferred routes, with a density-matrix calculation. They also check trace preservation, the bound decomposition, and the invariance of the Choi matrix under remixing.

Benchmarks

Circuits and noise

The memory benchmarks use the surface-code ZZ memory of Supplementary Note S4 A, the XX memory with the same layout and damping schedule and with XX-basis preparation and readout, and a distance-three color-code memory generated with Stim [6]. The color code has seven data qubits and three ancillas. Each round applies S†S^\dagger and HH to the data qubits, then six CNOT layers and ancilla measurement and reset, with intervals of 40 ns, 6×986 \times98 ns, 400 ns, and 228 ns. Damping acts on all ten qubits during the first eight intervals and on the data qubits during reset, which gives 3(8×10+7)=2613(8 \times10 + 7) = 261 locations. All three memories use T1=68 μsT_1 = 68\ \mu\mathrm{s} and run three rounds.

The random monitored circuits have n∈{16,24,30}n \in\{16, 24, 30\} qubits and D∈{8,16}D \in\{8, 16\} alternating layers of single-qubit gates from {H,S,S†}\{H, S, S^\dagger\} and two-qubit gates CX or CZ on random pairs. Each gate is replaced, with probability η\eta, by a rotation RP(θ)=exp⁡(−iπθP/2)R_P(\theta) = \exp(-i\pi\theta P/2) about an axis PP drawn from {X,Y,Z}\{X, Y, Z\} or {XX,YY,ZZ}\{XX, YY, ZZ\}. The angle θ\theta is drawn uniformly from [0.08,0.92][0.08, 0.92], kept at least 0.05 away from multiples of 0.5, and rounded to three decimals. One random instance is fixed for each nn and DD, and the rotated gates are nested as η\eta grows over {0,0.05,0.1,0.25,0.5,0.6,0.7,0.8,0.9,1}\{0, 0.05, 0.1, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 1\}, so raising η\eta only replaces more gates. After every second layer except the last, ⌈0.05n⌉\lceil0.05n\rceil qubits are measured and reset, and all qubits are measured at the end, which records n+(D/2−1)⌈0.05n⌉n + (D/2 - 1)\lceil0.05n\rceil bits per shot. Main-text Figure 3(b) shows D=8D = 8, and Figure S1–Figure S3 add D=16D = 16 for n=16n = 16 and 24, where deeper circuits give less reuse and smaller speedups.

Figure S1. Throughput for the random monitored circuits. Green curves are our method in proportional mode at M=104M=10^4, 10510^5, and 10610^6 shots, blue curves CUDA-Q, and orange curves Clifft with 16 workers. AD denotes the η=1\eta=1 circuits with amplitude damping in place of the Pauli gate noise. Points are geometric means over three runs, and bars span one standard deviation of the log rate.

The noise is the same for every η\eta. Each single-qubit layer is followed by a Pauli channel of strength 10−310^{-3} on every qubit, cycling through depolarizing, XX, YY, and ZZ errors across the gate locations. Each two-qubit layer is followed by two-qubit depolarizing noise of strength 10−310^{-3} on every pair, and a bit flip of probability 10−310^{-3} precedes every measurement. A Pauli error of strength pp applies its Pauli with probability pp, and depolarizing noise of strength pp applies each nonidentity Pauli with probability p/3p/3 on one qubit and p/15p/15 on two. The AD circuits keep the η=1\eta= 1 gates and the bit flips and replace the gate noise by amplitude damping, with γ=10−3\gamma= 10^{-3} after single-qubit layers and 5×10−45 \times10^{-4} per qubit after two-qubit layers. All engines read the same circuit files.

Engines and timing

The reported runs used an earlier version of our implementation, which drives an internal NVIDIA GPU statevector backend directly. The released code will use the public cuStateVec library instead, with comparable timings in our tests. The reference calls cudaq.run with the nvidia target of CUDA-Q [29], which returns the full measurement record of every shot, mid-circuit outcomes included. It launches the kernel once per shot, so CUDA-Q evolves one trajectory per shot. Both engines use single-precision statevectors and simulate the exact channels, so the speedups combine trajectory reuse with the difference between the two execution paths.

Our execution time is texec=tgeneration+tsamplet_{\mathrm{exec}} = t_{\mathrm{generation}} + t_{\mathrm{sample}}. Trajectory generation covers proposal sampling, grouping, grouped evolution, and branching. Sampling covers the re-execution of each trajectory to its final state and the terminal draws. A future version of our implementation will sample each trajectory as soon as its evolution ends, which avoids this re-execution. Circuit parsing, channel preparation including max-s preprocessing, backend initialization, and the formatting and writing of the output are left out of the timer. All proportional benchmarks use mα=cαm_{\alpha} = c_{\alpha}, so a run of NN draws produces M=NM = N shots at a rate M/texecM/t_{\mathrm{exec}}.

The CUDA-Q reference warms up, sets a batch size from a short probe, and times fixed-size batches over a 120-s window, or a 30-min window at n=30n = 30, on one GPU. Its rate is the mean over batches of shots per batch time, without compilation and loading. The Clifft reference [7] runs 16 single-threaded workers pinned to distinct cores, each with its own compiled circuit, over 120-s windows after an untimed probe, and its rate is the sum of the workers’ mean rates. Clifft does not support amplitude damping.

Hardware and cache use

The proportional benchmarks ran on exclusive nodes with eight NVIDIA H100 80-GB GPUs and two Intel Xeon Platinum 8480CL CPUs, with one GPU per run. Bulk generation used one H100 GPU of a node of the same type. State copies are kept on the GPU, and before a new copy is stored, the oldest are evicted until at least 2×1092 \times10^{9} bytes would remain free (Supplementary Note S6 A). A copy takes 8⋅2n8 \cdot2^n bytes, 8 GiB at n=30n = 30. The copies held at any time stayed below 1.7 GiB at n≤24n \le24, reached 16 to 48 GiB at n=30n = 30, and reached 56 GiB, seven copies, in bulk generation. No run evicted a copy.

Run conditions and error bars

GPU clocks and thermal state were logged and competing GPU use was monitored in every session. The Clifft windows ran one at a time.

Each proportional point has three runs. The random-circuit runs of both GPU engines use three different sampling seeds. The QEC runs of our method repeat one seed, which measures timing variation on identical data, and their CUDA-Q references use three seeds. The Clifft windows are timing repetitions. Points are geometric means of the three rates, with bars spanning one sample standard deviation σlog⁡\sigma_{\log} of the log rate on each side. A speedup is the ratio of two geometric means, with σlog⁡=(σlog,ours2+σlog,ref2)1/2\sigma_{\log} = \left(\sigma_{\mathrm{log,ours}}^2 + \sigma_{\mathrm{log,ref}}^2\right)^{1/2}, which assumes that the engines vary independently. The bars show the run-to-run spread on fixed circuits.

Bulk generation

The bulk-generation circuit has n=30n = 30, D=16D = 16, η=1\eta= 1, and amplitude damping, and records 14 mid-circuit and 30 terminal bits per shot. The 100 proposals give Ntraj=100N_{\mathrm{traj}} = 100 distinct trajectories, each sampled mm times. Each budget repeats one seed three times, and the CUDA-Q reference uses three seeds over 30-min windows. The plotted rate per trajectory is m/texecm/t_{\mathrm{exec}}, the total shot rate Ntrajm/texecN_{\mathrm{traj}}m/t_{\mathrm{exec}} divided by NtrajN_{\mathrm{traj}}, and the speedup is its ratio to the CUDA-Q rate. Supplementary Note S3 B discusses what repeated readout from shared trajectories means statistically.

The CUDA-Q reference produces 0.723 shots/s, from 1,333 to 1,344 shots per window. The rates of the three runs of each budget agree to within 2%, so the error bars of Figure 4 are hidden by the markers. The largest ratio is 70,822.

Trajectory generation takes 46.3 s at every budget, and sampling grows from 55.5 s at m=102m = 10^2 to 149 s at m=107m = 10^7 (Figure S4). For 10910^9 shots the execution takes 195 s, or 5.1×1065.1 \times10^6 shots/s. The whole run takes 1,106 s of wall time, most of it spent formatting the readout (744 s) and handling records outside the timer.

Figure S4. Simulation and record-handling time for bulk generation. Three runs per point on the n=30n = 30, D=16D = 16 amplitude-damping circuit, with 100 trajectories sampled mm times each on one H100 GPU. Points are means. a, Trajectory generation, sampling, and readout formatting. Only the first two count toward the execution time. b, Execution time and total wall time, which adds setup, formatting, and record handling.

Figure S2. Speedup at 10610^{6} proportional shots. Ratios of the rates of Figure S1 to those of CUDA-Q (blue) and Clifft (orange), with error bars adding the two log standard deviations in quadrature. Our method is faster in the white region.

References

  1. [1]A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland, Surface codes: Towards practical large-scale quantum computation, Phys. Rev. A 86, 032324 (2012).DOI
  2. [2]B. M. Terhal, Quantum error correction for quantum memories, Rev. Mod. Phys. 87, 307 (2015).DOI
  3. [3]G. Torlai and R. G. Melko, Neural decoder for topological codes, Phys. Rev. Lett. 119, 030501 (2017).DOI
  4. [4]J. Bausch, A. W. Senior, F. J. H. Heras, T. Edlich, A. Davies, M. Newman, C. Jones, K. Satzinger, M. Y. Niu, S. Blackwell, G. Holland, D. Kafri, J. Atalaya, C. Gidney, D. Hassabis, S. Boixo, H. Neven, and P. Kohli, Learning high-accuracy error decoding for quantum processors, Nature 635, 834 (2024).
  5. [5]Y. Alexeev, M. H. Farag, T. L. Patti, M. E. Wolf, N. Ares, A. Aspuru-Guzik, S. C. Benjamin, Z. Cai, S. Cao, C. Chamberland, Z. Chandani, F. Fedele, I. Hamamura, N. Harrigan, J.-S. Kim, E. Kyoseva, J. G. Lietz, T. Lubowe, A. McCaskey, R. G. Melko, K. Nakaji, A. Peruzzo, P. Rao, B. Schmitt, S. Stanwyck, N. M. Tubman, H. Wang, and T. Costa, Artificial intelligence for quantum computing, Nature Communications 16, 10829 (2025).DOI
  6. [6]C. Gidney, Stim: a fast stabilizer circuit simulator, Quantum 5, 497 (2021).DOI
  7. [7]B. A. Chase and F. L. Labib, Clifft: Fast exact simulation of near-Clifford quantum circuits (2026), arXiv:2604.27058 [quant-ph].arxiv.org/abs/2604.27058
  8. [8]M. R. Geller and Z. Zhou, Efficient error models for fault-tolerant architectures and the Pauli twirling approximation, Phys. Rev. A 88, 012314 (2013).DOI
  9. [9]M. Gutiérrez and K. R. Brown, Comparison of a quantum error-correction threshold for exact and approximate errors, Phys. Rev. A 91, 022335 (2015).
  10. [10]Y. Tomita and K. M. Svore, Low-distance surface codes under realistic quantum noise, Phys. Rev. A 90, 062320 (2014).DOI
  11. [11]A. Katabarwa and M. R. Geller, Logical error rate in the Pauli twirling approximation, Scientific Reports 5, 14670 (2015).DOI
  12. [12]S. R. Garner, N. M. Myers, M. Wang, S. Stein, C. Liu, and A. Li, Simulation of thermal-relaxation noise for quantum error correction, Phys. Rev. Res. 8, 023134 (2026).DOI
  13. [13]J. Magesan, D. Puzzuoli, C. E. Granade, and D. G. Cory, Modeling quantum noise for efficient testing of fault-tolerant circuits, Phys. Rev. A 87, 012324 (2013).DOI
  14. [14]D. Puzzuoli, C. Granade, H. Haas, B. Criger, E. Magesan, and D. G. Cory, Tractable simulation of error correction with honest approximations to realistic fault models, Phys. Rev. A 89, 022306 (2014).DOI
  15. [15]M. Gutiérrez, L. Svec, A. Vargo, and K. R. Brown, Approximation of realistic errors by Clifford channels and Pauli measurements, Phys. Rev. A 87, 030302(R) (2013).DOI
  16. [16]T. E. O’Brien, B. Tarasinski, and L. DiCarlo, Density-matrix simulation of small surface codes under current and projected experimental noise, npj Quantum Information 3, 39 (2017).
  17. [17]A. S. Darmawan and D. Poulin, Tensor-network simulations of the surface code under realistic noise, Phys. Rev. Lett. 119, 040502 (2017).DOI
  18. [18]F. P. Barone, D. Jaschke, I. Siloi, and S. Montanegero, Color code thresholds under circuit-level noise beyond the Pauli framework, Quantum Science and Technology 11, 035065 (2026).DOI
  19. [19]H. Pashayan, J. J. Wallman, and S. D. Bartlett, Estimating outcome probabilities of quantum circuits using quasiprobabilities, Phys. Rev. Lett. 115, 070501 (2015).DOI
  20. [20]M. Howard and E. Campbell, Application of a resource theory for magic states to fault-tolerant quantum computing, Phys. Rev. Lett. 118, 090501 (2017).DOI
  21. [21]R. S. Bennink, E. M. Ferragut, T. S. Humble, J. A. Laska, J. J. Nutaro, M. G. Pleszkoch, and R. C. Pooser, Unbiased simulation of near-Clifford quantum circuits, Phys. Rev. A 95, 062337 (2017).DOI
  22. [22]J. R. Seddon and E. T. Campbell, Quantifying magic for multi-qubit operations, Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 475, 20190251 (2019).DOI
  23. [23]J. Dalibard, Y. Castin, and K. Mølmer, Wave-function approach to dissipative processes in quantum optics, Phys. Rev. Lett. 68, 580 (1992).pubmed.ncbi.nlm.nih.gov/10045937
  24. [24]R. Dum, P. Zoller, and H. Ritsch, Monte Carlo simulation of the atomic master equation for spontaneous emission, Phys. Rev. A 45, 4879 (1992).pubmed.ncbi.nlm.nih.gov/9907570
  25. [25]K. Mølmer, Y. Castin, and J. Dalibard, Monte Carlo wave-function method in quantum optics, Journal of the Optical Society of America B 10, 524 (1993).DOI
  26. [26]M. B. Plenio and P. L. Knight, The quantum-jump approach to dissipative dynamics in quantum optics, Rev. Mod. Phys. 70, 101 (1998).DOI
  27. [27]A. J. Daley, Quantum trajectories and open many-body quantum systems, Advances in Physics 63, 77 (2014).DOI
  28. [28]S. V. Isakov, D. Kafri, O. Martin, C. Vollgraf Heidweller, W. Mruckkiewicz, M. P. Harrigan, N. C. Rubin, R. Thomson, M. Broughton, K. Kissell, E. Peters, E. Gustafson, A. C. Y. Li, H. Lamm, G. Perdue, A. K. Ho, D. Strain, and S. Boixo, Simulations of quantum circuits with approximate noise using qsim and Cirq (2021), arXiv:2111.02396 [quant-ph].arxiv.org/abs/2111.02396
  29. [29]The CUDA-Q development team, CUDA-Q, https://github.com/NVIDIA/cuda-quantum (2026), version 0.15.1.
  30. [30]M. Wang, S. Tannu, and P. J. Nair, Accelerating simulation of quantum circuits under noise via computational reuse, in Proceedings of the 52nd Annual International Symposium on Computer Architecture (ISCA ’25) (ACM, 2025) pp. 1539–1553.
  31. [31]G. Li, Y. Ding, and Y. Xie, SANQ: A simulation framework for architecting noisy intermediate-scale quantum computing system (2019), arXiv:1904.11590 [quant-ph].
  32. [32]G. Li, Y. Ding, and Y. Xie, Eliminating redundant computation in noisy quantum computing simulation, in 2020 57th ACM/IEEE Design Automation Conference (DAC) (2020) pp. 1–6.DOI
  33. [33]S. Dangwal, T. Oberoi, A. Saipolar, D. Shah, and F. T. Chong, TUSQ: Tracking, uncomputation, and sampling for noisy quantum simulation, in 2026 ACM/IEEE 53rd Annual International Symposium on Computer Architecture (ISCA) (2026) pp. 2318–2332.arxiv.org/abs/2508.04880
  34. [34]T. L. Patti, T. Nguyen, J. G. Lietz, A. J. McCaskey, and B. Khailany, Augmenting simulated noisy quantum data collection by orders of magnitude using pre-trajectory sampling with batched execution, in Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (SC ’25) (ACM, 2025) pp. 762–773, arXiv:2504.16297 [quant-ph].arxiv.org/abs/2504.16297
  35. [35]T. L. Patti, P. Pari, Y. Gao, A. Haidar, T. Nguyen, T. Lubowe, D. Lowell, and B. Khailany, Accelerating quantum tensor network simulations with unified path variations and non-degenerate batched sampling (2026), arXiv:2604.08467 [quant-ph].arxiv.org/abs/2604.08467
  36. [36]J. Doi, H. Horii, and C. Wood, Efficient techniques to GPU accelerations of multi-shot quantum computing simulations (2023), arXiv:2308.03399 [quant-ph].arxiv.org/abs/2308.03399
  37. [37]The CUDA-Q development team, Noisy simulators, CUDA-Q documentation, https://nvidia.github.io/cuda-quantum/0.15.0/using/backends/sims/noisy.html (2026), version 0.15.0.
  38. [38]N. Meister, C. A. Pattison, and J. Preskill, Efficient soft-output decoders for the surface code (2024), arXiv:2405.07433 [quant-ph].arxiv.org/abs/2405.07433
  39. [39]B. Skinner, J. Ruhman, and A. Nahum, Measurement-induced phase transitions in the dynamics of entanglement, Phys. Rev. X 9, 031009 (2019).DOI
  40. [40]Y. Li, X. Chen, and M. P. A. Fisher, Measurement-driven entanglement transition in hybrid quantum circuits, Phys. Rev. B 100, 134306 (2019).DOI
  41. [41]A. Paetznick and K. M. Svore, Repeat-until-success: non-deterministic decomposition of single-qubit unitaries, Quantum Info. Comput. 14, 1277–1301 (2014).arxiv.org/abs/1311.1074
  42. [42]A. Bocharov, M. Roetteler, and K. M. Svore, Efficient synthesis of universal repeat-until-success quantum circuits, Phys. Rev. Lett. 114, 080502 (2015).pubmed.ncbi.nlm.nih.gov/25768742
  43. [43]S. Bravyi and A. Kitaev, Universal quantum computation with ideal Clifford gates and noisy ancillas, Phys. Rev. A 71, 022316 (2005).DOI
  44. [44]C. Gidney, N. Shutty, and C. Jones, Magic state cultivation: growing T states as cheap as CNOT gates (2024), arXiv:2409.17595 [quant-ph].arxiv.org/abs/2409.17595
  45. [45]S. Bravyi and A. Vargo, Simulation of rare events in quantum error correction, Phys. Rev. A 88, 062308 (2013).DOI
  46. [46]S. Heußen, D. Winter, M. Rispler, and M. Müller, Dynamical subset sampling of quantum error-correcting protocols, Phys. Rev. Res. 6, 013177 (2024).DOI
  47. [47]T. Vovk and H. Pichler, Entanglement-optimal trajectories of many-body quantum Markov processes, Phys. Rev. Lett. 128, 243601 (2022).DOI
  48. [48]Z. Chen, Y. Bao, and S. Choi, Optimized trajectory unraveling for classical simulation of noisy quantum dynamics, Phys. Rev. Lett. 133, 240304 (2024).DOI
  49. [49]R. Daraban, F. Salas-Ramírez, and J. Schachenmayer, Non-unity maximizing unraveling of open quantum dynamics, SciPost Physics 18, 048 (2025).DOI
  50. [50]S. Cichy, P. K. Faehrmann, L. Bittel, J. Eisert, and H. Pashayan, Classical simulation of noisy quantum circuits via locally entanglement-optimal unravelings, Phys. Rev. A 114, 022430 (2026).DOI
  51. [51]S. Krinner, N. Lacroix, A. Remm, A. Di Paolo, E. Genois, C. Leroux, C. Helling, S. Lazar, F. Swiadek, J. Herrmann, G. J. Norris, C. K. Andersen, M. Müller, A. Blais, C. Eichler, and A. Wallraff, Realizing repeated quantum error correction in a distance-three surface code, Nature 605, 609 (2022).DOI
  52. [52]Google Quantum AI and Collaborators, Quantum error correction below the surface code threshold, Nature 638, 920 (2025).DOI

Paper details

vlnc:W_256q2c22
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

AI tools

View statement
Looking for related papers…
Contents