You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-shot observable expectations and Pauli-target OBSERVABLE_INCLUDE (like Clifft's EXP_VAL) #249
Clifft's end-to-end magic state cultivation results (arXiv:2604.27058) rely on its EXP_VAL P instruction. At its position in the circuit, it returns the exact value ⟨ψ|P|ψ⟩ for each shot as a float, without noise and without collapsing the state. The probe is placed just before the final MPP that measures Y_L (convert_s_to_t.py, run_end2end_bruteforce.py).
|T⟩ is not a Pauli eigenstate, so a sampled MPP Y_L comes out wrong in (1−1/√2)/2 ≈ 14.6% of shots even without errors. Estimating an infidelity of 1e-6 to within 10% then takes about 2.5e13 shots, compared with about 1e8 using the exact per-shot value. Tsim can't reproduce these runs today.
Proposal
Accept OBSERVABLE_INCLUDE(k) P with Pauli targets. Tsim currently rejects them in src/tsim/core/parse.py. Stim already defines this as a noiseless Pauli term of observable k that doesn't collapse the state, so no new instruction is needed. With S[T] tags, Stim reads the circuit as the S-proxy, where the term is deterministic, so the DEM and the decoder can still be built from the same circuit.
Return the per-shot expectation ⟨(−1)^obs⟩ as a float.CUDA backend (up to active_width=11) #219 already does this with observable_expectations, but only on CUDA. Add it to the CPU lane executor (in float64) and to sample().
Caveats
Conditioning: the expectation is only exact if it is conditioned on every detector used downstream, both for postselection and for decoding. When a postselected detector is settled after the observable's measurement, CUDA backend (up to active_width=11) #219 falls back to the sampled ±1. Detectors that the decoder reads are not covered. It may be better to schedule the observable's measurement after all detectors of its component.
Non-Clifford states: a sampled bit for a term that doesn't collapse the state is only well-defined if the term comes at the end of the circuit or commutes with everything after it. Anticommuting terms at the same point, such as X_L, Y_L and Z_L, have expectations but no joint distribution of bits, so they must not be lowered to sequential MPPs. A first version could accept only terms at the end of the circuit and evaluate each one without collapsing the state.
Related: #21 (DEM for non-deterministic observables).
Activity