Skip to content

Per-shot observable expectations and Pauli-target OBSERVABLE_INCLUDE (like Clifft's EXP_VAL) #249

Open

Description

@rafaelha

Motivation

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

  1. 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.
  2. Return the per-shot expectation ⟨(−1)^obs⟩ as a float. CUDA backend #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 #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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions