The 36 shipped entries predated the provenance rework (no
transformation/distribution/seed fields) yet still validated as
RunResponses, so a hit would render a crippled first run. Worse-and-
better at once: every key was already unreachable — the key hashes
QPY bytes (changed by the qiskit upgrade) and the script's preset
mirror had drifted from the frontend's defaultData (JS `500` vs
Python `500.0`, missing fidelity params).
* run_cache: stamp cache_schema=2 on write, treat unstamped/old
entries as misses (logged once per key); writes scrub the seed
envelope (disk cache is seed-free by design; per-step seed_used
stays as the honest record). 6 new unit tests; lane now 86 green.
* Delete the 36 dead files; regenerate qucad+compvqc x 9 samples (18
entries) from the LIVE Space via the new resumable
scripts/regenerate_precomputed_cache_live.py, which refuses to run
unless local qiskit == live /api/health qiskit (key parity).
Torch-heavy presets (qubound/qshot/full) stay unca…
Audit C1: pinned step-cache identity includes node ids
TheYuchen
d5ab6bd
Per-node seeds derive from sha256(root_seed:node_id), but the step
cache's _prefix_hash keyed only {type, data} per node — so two
id-renamed, structurally identical graphs under the same pinned seed
shared cache entries while owing DIFFERENT draws (live-demonstrated
cross-graph poisoning: run B was served run A's seeded numbers).
Fix: in the salted (seed-pinned) regime the per-node hash payload now
includes the node id — node ids are part of seed identity. The fresh
(unsalted) regime stays id-free on purpose: fresh runs never cache
stochastic steps, so id-blind prefix sharing is sound there and the
precomputed/prewarm namespace is untouched.
Regression tests: pinned hash is id-sensitive, fresh hash stays
id-blind, plus an executor-level same-seed a1-vs-b1 test asserting the
renamed graph executes with its OWN derived seed (no poisoned cache
hit) and then replays bit-exactly from its own entry. Lane: 80 green.
Backend: sampled fidelity always runs as B=min(8,max(2,shots//128))
batches; batch i seeded sha256(f"{node_seed}:batch:{i}") so replays
are bit-exact regardless of any run's stopping point. Streaming SSE
interleaves {"step_progress": {node_id, batch_i, n_batches,
shots_done, successes, point, ci95}} frames (worker thread + queue in
the executor; eager path unaffected). RunRequest.precision_target
(CI half-width, (0,0.5]) = server-honoured optional stopping, min 2
batches; distribution records shots executed vs requested,
stopped_early, and the full per-batch trace. qlib duplicates the
Wilson fn (no app import from qlib); twins pinned equal by test.
Frontend: toolbar precision-target select (off/±5/±2/±1pp); live
narrowing CI band + shot counter on node faces from streamed frames;
evidence-funnel in the fidelity card (one line per batch, opacity
ramp, target ticks at point±target, early-stop annotation); RunRecord
persists precision_target + stopped_early; restore/replay writes the
tar…
Seed coverage for QuBound/Qshot + cost estimates from run history
TheYuchen
91b2cd9
Closes the two remaining claim-integrity gaps for "every run is
exactly replayable" over "stochastic, costly experiments":
Seeds. QuBound trains its LSTM on BOTH ok paths (live IBM history and
the cached 14-day pickle) — there is no precomputed-only branch in the
handler — so both now seed the global RNGs (_seed_stochastic_libs:
random + numpy + lazily-imported, try/except-guarded torch) and thread
node_seed into qlib (Aer seed_simulator + Sabre seed_transpiler in
get_labels_fromNoise); results carry nondeterministic=True +
seed_used. Qshot's pilot seed was 99991 + hash(str(base)) — str hashes
are PYTHONHASHSEED-salted, i.e. "fixed" only until the next server
restart. pilot_seed is now threaded predict → recommend_shots →
compute_pilot_pf, making the recommendation reproducible across
processes given the seed. Executor cache logic untouched: fresh runs
draw fresh node seeds (honest new draw, cache-bypassed), pinned runs
re-derive the same seeds (cacheable in the seed-salted namespace)…
Gate-level circuit diff: qubit-lane LCS alignment per step
TheYuchen
94e47b0
Backend:
- New services/circuit_diff.py: lane_sequences() tokenizes each
qubit's gate sequence (name + 3dp param fingerprint; unbound
params keep symbol names; 2q gates on both lanes with c/t role
tags, symmetric ops undecorated; measures kept, barriers skipped)
and diff_lanes() aligns before/after lanes with a standard LCS
diff (kept/removed/added in merged order). Hard cap 12 qubits /
600 combined ops -> truncated marker.
- Executor: copy the circuit BEFORE dispatch (handlers may mutate
ctx["circuit"] in place -- the historical QuBound measure_all bug
shape), stamp gate_diff into StepResult.transformation when the
step changed the circuit. Best-effort: any diff failure is logged
and omitted, never breaks a run.
- tests/test_gate_diff.py: 14 torch-free unit tests incl. an
executor wiring test that mutates in place.
Frontend:
- New CircuitDiff.tsx inside SignatureCard, collapsed <details>
("Gate-level diff / N removed / M added"): one mono-labelled row
per qu…
Transformation signatures: uniform circuit-delta vocabulary per step
TheYuchen
f956d64
Phase 2 (part 1) of the evidence-workbench rework. The executor now
snapshots the circuit's structure (shape + gate counts by op) before
and after every dispatched node and stamps a uniform transformation
payload onto each successful StepResult: before/after snapshots,
shape delta (qubits/depth/gates/params), per-op count delta, and a
changed flag distinguishing pass-through steps from mutating ones.
Captured centrally — handlers (and user plugins) never build this
themselves, which is what keeps the vocabulary identical across
QuCAD pruning, CompVQC folding, transpiles, and anything a plugin
does. Kind-specific detail stays in each handler's summary.
Frontend renders it at two densities: SignatureTile on canvas nodes
(nonzero delta channels only, e.g. "D-4 G-12 P-12"; decrease=green
since every optimizer in the catalog aims downward, increase=amber,
qubit-width neutral) and SignatureCard in the results pane
(before → after per channel + per-op chips). Pass-through steps say
so expli…
Provenance core: run identity, replayable seeds, distribution payloads
TheYuchen
2efd890
Phase 0 of the evidence-workbench rework. Every run now gets a
server-stamped provenance envelope (run_id, seed_mode, root_seed,
app_version) in both the eager and SSE routes; the SSE stream opens
with a run_meta event. Every run draws a root seed even when the
caller doesn't pin one, so any historical run is replayable later by
sending its recorded seed back.
Per-node seeds derive from sha256(root_seed, node_id) — independent
of execution order and of unrelated graph edits, keeping A/B
comparisons honest. Sampled fidelity accepts the seed
(seed_simulator) and reports a structured distribution payload:
binomial successes/shots, Wilson 95% CI, top-16 outcome histogram.
Cache semantics: seed-pinned runs live in a salted cache namespace
and may cache stochastic steps (reproducible by construction); fresh
runs keep today's namespace and the nondeterministic bypass.
Precomputed disk-cache responses are never served for pinned runs.
19 new unit tests (seed derivation, Wilson edges, salted…
Code quality cleanup + first unit-test seed
Yuchen Yuan
6962cb3
Post-audit polish on the bug-fix wave from the last 9 commits:
* Hoist function-level constants to module top so they're
discoverable and reusable: _FAKE_BACKENDS_AVAILABLE,
_FIDELITY_METHODS, _FIDELITY_UNBOUND_POLICIES,
_COMPVQC_MAX_QP_VARS, _COMPVQC_ROTATION_GATES.
* Move 'import re' from inside _format_exception_for_user to the
file's top-level imports.
* Standardise validation error phrasing on 'Choose one of: ...'
(was a mix of 'Allowed values:' and 'Choose one of:').
* Add the same name-validation rigour to _handle_ibm_backend that
_handle_fake_backend has — refuse empty / non-string names with
a clear message, and surface IBM's resolution failure through
_format_exception_for_user instead of letting it bubble as a 500.
* Drop the now-unused '_qpy_bytes' alias from run_cache.py; the
one remaining call site uses the canonical name directly.
* Drop the trivial _is_known_fake_backend wrapper; inline the
membership test at the one …