Skip to content

feat(qsearch): default-off compile rewrites - basis-state prep for diagonal QUBOs, calibration-ranked layout (J2) - #50

Closed
AetherAI3 wants to merge 5 commits into
mainfrom
claude/qcomms-j2-compile
Closed

AetherAI3 wants to merge 5 commits into
mainfrom
claude/qcomms-j2-compile

Conversation

@AetherAI3

@AetherAI3 AetherAI3 commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two default-off compile rewrites in the one compile_program (lane J2, Experiment J). The I6 comm-ops chunk jobs are strictly diagonal QUBOs, so their optimum is a basis state: today Nano emits it through a QAOA layer (correct only at γ = −π/2, β = π/4) and places it on FakeFez's best qubits from its 2025-02-26 calibration, which on today's ibm_fez include a 7.5 % readout qubit. With both options on, the 90-circuit J2 sample goes from ESP 0.810 to 0.951 on the 2026-10-31 ibm_fez snapshot (modelled), with the FakeFez decode rate unchanged and a shorter program.

  • CompileOptions(basis_prep, layout, calibration, calibration_sha256, layout_backend); compile_program(job, *, options=None) reads CompileOptions.from_env() when options is None. Env unset = the unchanged compile: same ISA, record and compiled_plan_digest (checked on all 90 sample jobs against the I6 pin b4f7ae6).
  • NANO_QSEARCH_BASIS_PREP=1: a strictly diagonal QUBO (no coupling, no zero diagonal entry) is compiled as its unique minimiser (x on the 1 bits, measure), so the output no longer depends on the angles. Coupled QUBOs and explicit joint5 jobs are untouched.
  • NANO_QSEARCH_LAYOUT=target | calibration:<snapshot.json> (+ NANO_QSEARCH_LAYOUT_BACKEND): a circuit without two-qubit gates on a Fez target puts bit i on the i-th best qubit by −log(1−readout) − ½·log(1−x), skipping qubits with a missing/out-of-range error or T1; the transpile must keep that placement or the compile is refused.
  • When an option is on, the compile record and digest carry a rewrites block (what was applied, the snapshot's sha256 and the qubits). A malformed value or unreadable snapshot is a ValueError, so the IBM runtime answers REFUSED rather than silently compiling the default.
  • docs/qsearch-service.md: env table rows + a "Compile options" section.

Evidence (Predator bench/qcomms/j2_compile/, preregistered cycles, offline, no QPU): c0 → c2 on 30 agents / 90 chunks of I6 rep1: 2q 0 → 0, depth 3 → 2, ops 39.9 → 23.9, ESP on ibm_fez snapshot 0.8096 → 0.9509, FakeFez 3-shot decode 2,998 → 2,995 of 3,000 (not worse, Fisher p 0.23).

An integration branch with the HW-0 device compile (#49) merged in is at claude/qcomms-j2-on-hw0 (compile_program(job, *, backend=None, options=None)); this PR itself is against main and does not depend on #49.

Test plan

  • tests/test_qsearch_compile_options.py (16, incl. the review fixes) on skt-d-01 (~/skt/venv, ATLAS 5d8c19b2)
  • all tests/test_qsearch_*.py on the same host: 309 passed; 1 failure that also fails on pristine d740bb5 there (test_cleanup_errors_are_ignored)
  • options off: compiled_plan_digest identical to Nano b4f7ae6 on all 90 J2 sample jobs
  • CI (self-hosted runners; GitHub Actions billing lock this week)
  • independent review (1 bug, 6 risks, 1 question): bug + 4 risks fixed in 09b22da (another device's snapshot entry refused, layout_backend without calibration refused, errors_digest for target mode, snapshot shape/range checks, non-finite diagonal refused); kept by intent: env options on the device path, the ordinary label; not done: pinning d740bb5 digests in a unit test (qiskit-version brittle; shown on the 90 sample jobs instead)
  • after the fixes the J2 sample's c2 ISA bytes are unchanged (qpy sha256 90/90, both contexts); options off still equals b4f7ae6

🤖 Generated with Claude Code

Verified integration disposition

This older standalone compile-options alternative is superseded by #51, included in actual main integration #82 at cb6ea884d63dcaa8cc0e7c0b952bb88784e8219f. Its exact head 09b22da41015d1276d74dc1b0ed1eebc9d4ecdc0 is NOT falsely represented as an ancestor. All13 named regression tests are present in the15-test #51 superset, whose compile-options implementation was reviewed in the intended ancestry stack. No duplicate alternative patch was applied.

The human explicitly authorized the three integration PRs Nano82/ATLAS188/Predator460 to use reviewed passing LOCAL evidence in place of the earlier self-hosted gate. The waiver is recorded verbatim in those merged integration PR bodies; it is not a passing CI claim or a separate waiver-based admin merge of this source PR. Cloud41322926091 remains FAILED STARTUP with zero jobs/check runs. Local source pins, commands, counts, skips, review limitations, merged trees and actual target branches are recorded there and in the captain evidence bundle.

This source PR is retired as included/superseded by that actual integration. Issue #61 remains open for incomplete service-wire acceptance; other issue closure requires its own acceptance audit. Branches are preserved. No formal GitHub approval, production activation, runner/security/credential change or provider execution occurred.

AetherAI3 and others added 5 commits October 31, 2026 08:12
…agonal QUBOs, calibration-ranked layout

CompileOptions (env NANO_QSEARCH_BASIS_PREP=1, NANO_QSEARCH_LAYOUT=target|calibration:<snapshot.json>,
NANO_QSEARCH_LAYOUT_BACKEND) extends compile_program (options=None reads the env; unset = unchanged compile
and digest). basis_prep: a strictly diagonal QUBO is prepared as its unique minimiser (x + measure), so the
output no longer depends on the QAOA angles. layout: a circuit without two-qubit gates on a Fez target puts
logical bit i on the i-th best qubit by readout + half x error, skipping qubits with missing error or T1,
ranked from the transpile target or a calibration snapshot. The compile record and digest carry a rewrites
block when any option is on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…get and the layout ranking

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ot collide with the HW-0 device compile

compile_program(job, *, options=None) composes with HW-0 N2's compile_program(job, *, backend=None);
FEZ_TARGETS / _fez_backend replace DEVICE_TARGETS / _device_backend, which N2 defines with another meaning.
No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- layout=calibration ranks only the job's own device entry (a fake_fez rehearsal may read ibm_fez); another
  device's same-width entry is refused instead of placing fez qubits by its errors
- layout_backend without layout=calibration is refused, not silently ignored
- layout=target records errors_digest, a digest of the error numbers it ranked
- calibration entries are shape-checked and read for qubits 0..num_qubits-1 only (ValueError otherwise)
- diagonal_ground refuses a non-finite entry instead of reading it as a 0 bit

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant