verifiable-quantum-circuit-compilation / optimization-decision.md
igorholt's picture
Add optimization-decision.md — Verifiable Quantum Circuit Compilation
1541e78 verified
|
Raw History Blame Contribute Delete
9.74 kB

Optimization decision — Verifiable Quantum Circuit Compilation

Date: 2026-11-07. Status: decision made from verified baselines; first measurement in progress. Author: xI, from three read-only surveys (paper + scoring docs, Google Drive, GitHub).

0. What we know for certain

Scoring: overall score = geometric mean of baseline_cost / submitted_cost across the three tasks; reference submission scores 1.0 by construction; any failing task rejects the whole submission. (Kaggle rules, not the paper — the paper defines only per-task scores.) A 2x improvement on any one task is worth exactly as much as 2x on any other. There is no benefit to over-optimizing one task.

Verified baselines (Nov 7, 2026):

Task Baseline score Verified by Q Dominant cost
dfthcsos 3,355,599,588.32 local full run, exact README match 730 ANGLES QROM 85% of Toffolis; λ_eff = 49.301369 multiplies everything
invsqrt 2,068,518.26 sampled (paper full-run 2.08e6) local sampled run x=1..1024 260 ~7,735 Toffolis + 37 rotations; worst error only ~2.1x inside tolerance
DQI 24,439,463,583,672.93 Kaggle notebook, full 102,400 shots, 0 errors 1,893 5.7M Toffolis; Q^2 weighting; per-position inversion ~25% of Toffolis

The organizers commit SHA-256 hashes of their own best internal runs (paper p.7) and say AI agents already found "significant improvements over the previously published baselines" — but publish no numbers. The true bar above the reference baselines is unknown. Assume the reference is not the bar.

The bar is now measured (2026-11-07, public Kaggle notebooks): the field is at ~25x the reference geometric mean. Public notebooks show LB 24.94 ("Verified Three-Task Portfolio") and best 24.87 ("The Unbearable Lightness of Quantum Circuits"); a participant repo read Nov 2 put the leader at ~28.0. What the field did, per those notebooks: DQI rebuilt at 892 qubits (vs 1,893 reference — the Q^2 lever, exactly as §1 predicts), chemistry refit with a (9, 143, 40) factorization, invsqrt at 62 qubits (vs 260). So to be competitive, roughly 3x per task (3^3 ≈ 27) is the scale of improvement needed — not 10%. The levers in §1 are confirmed by the field; the work is execution, not discovery.

1. Where the headroom is (inference from the paper)

dfthcsos — λ_eff is a straight multiplier. Score = λ_eff x T_total x Q_total. λ_eff = sqrt(E_gap(2Λ - E_gap)); the baseline's 12-bit quantization costs only 0.1% of λ_eff, so the factorization itself is the lever: better (R,B,C) rank allocation and better-optimized vectors (u, w, W) flow straight through, subject to ε_fro ≤ 20 mHa and the floors Λ > 49.0 Ha, E_gap > 3.914898 Ha. This is a classical numerical optimization (the dfthc-sos starter kit's trainer), not a circuit problem — it can be iterated locally with fast verification (25 s per verify).

DQI — qubits pay quadratically. Score = R(ε+) x Q^2 x T. 2(n+3)b = 1,752 of the 1,893 qubits are the two EEA polynomial arrays. A 1% qubit cut is worth a 2% Toffoli cut. Second lever: the per-position Itoh-Tsujii inversion, 1.44M Toffolis (25%), which the paper says "can be improved" — batch inversion (Montgomery's trick) is our inference, not paper-named. Third: GF(2^12) multiplier 63 → 51 Toffolis is demonstrated in the literature (Ref. [12]), ~0.5M Toffolis. Fourth, paper-endorsed: deliberate approximation — ε+ = 1e-3 costs only R = 1.21 vs the 1.19 floor, so a rarely-failing but much cheaper decoder can beat an exact one. This is the biggest prize and the slowest loop (full verify = 201 s on a Kaggle notebook; not runnable at full scale on this 8 GB VM).

invsqrt — polynomial and bit-widths. Score = Q x C, C = Toffolis + T/4. The paper names the central tradeoff directly: cubic polynomial over a small rescaled range vs a simpler polynomial over a larger range; coefficient accuracy from QROM; "a completely different route… simply finding a good polynomial approximation over the input domain." Bit-widths (14/17/28/28/29) were tuned for worst error 2.84e-8, ~2.1x inside the 2^-24 tolerance — narrower widths cut the big 28-bit multipliers but eat the rotation margin, since rotation T-cost is priced by leftover margin. Fastest local loop (sampled verify), but full verify is 200.5M shots — sampled only, locally.

2. The decision

First: dfthcsos. Reasons, in order:

  1. λ_eff is a direct multiplier on the whole task score, and the lever is classical numerical optimization — no new circuit construction, no verifier risk beyond the two error floors.
  2. Fastest verification loop of the three at full scale (~25 s, local).
  3. The brot/rank sweep is measurable before any commitment: evaluate_words gives error_1/error_2 vs brot and rank, so the first experiment either confirms or kills the headroom in minutes.

Second: invsqrt. Fast sampled loop locally; polynomial redesign is paper-invited and the 2.1x error margin is the measurable constraint. Risk: full verification is 200M shots, so any candidate needs a Kaggle-scale final check.

Third: DQI. Largest absolute prize (Q^2 + 25% inversion block + demonstrated 51-Toffoli multiplier), but the slowest loop and the biggest circuit (86M instructions). Attack it after the other two have a verified pipeline, using the Kaggle notebook for full verification. Do not start here — iteration cost would dominate the work.

3. What the surveys found (and did not)

  • Google Drive: nothing directly relevant. No kickmix/dfthcsos/FeMoCo/Qualtran hits; no prior optimization plan. Tangential only: a CUDA-Q kernel optimization notebook (Oct 4, 2026) and GTX 1650 optimization notes (May 11, 2026) — different framework, background only. The optimization starts from local material.
  • GitHub: no igor-holt repo for this competition; local quantum-comp work is not pushed anywhere. Upstream Qualtran is current (local HEAD 9a0c11a = upstream latest, Nov 2). Gap found: the local Qualtran repo is a blobless sparse checkout with only docs/kickmix/ and kickmix/ on disk — the qualtran/ package is not checked out and import qualtran fails in the venv. Fix before using any bloq: git sparse-checkout add qualtran (or pip-install qualtran).
  • No optimizer exists anywhere in the stack. Neither Qualtran nor kickmix ships a circuit-optimization pass. Gains come from hand-built bloq substitutions + rotation-synthesis tuning, verified with the kickmix cost counter. The building blocks exist: rotation synthesis + NewtonRaphsonApproxInverseSquareRoot / PolynmomialEvaluationInverseSquareRoot (invsqrt); GF/GF-poly arithmetic (DQI); THC + double factorization + Givens (dfthcsos); QROM/SelectSwapQROM (angle tables).

4. First measurement — DONE 2026-11-07 (sweep ran 161 s)

Script + results: dfthcsos_brot_sweep.py, dfthcsos_brot_sweep.json. Method: recovered the reference angle words (3,976 x 75) from the circuits with the stock verifier's own simulator, re-quantized them to fewer bits by round-to-nearest, re-evaluated with the stock evaluate_words.

brot error_1 (mHa) error_2 (mHa) λ_eff verdict
12 (baseline) 3.19 18.64 49.301 PASS; score reproduced exactly: 3,355,599,588.32
11 76.95 29.80 49.395 REJECTED — both errors over 20 mHa
10 134.85 44.89 49.626 REJECTED
9 273.48 83.77 50.969 REJECTED
8 590.54 172.44 55.454 REJECTED
7 1,328.67 349.00 66.056 REJECTED
6 3,078.97 729.04 93.243 REJECTED

Two findings that change the plan:

  1. Naive bit reduction is dead. One bit less (12 → 11) blows error_1 from 3.19 to 76.95 mHa — 4x over the bound. Lower brot also raises λ_eff (E_gap grows with quantization error), so there is no tradeoff to rescue. (The numerically lower "scores" at brot 11/10 in the JSON are meaningless: those submissions are rejected, score = ∞.)
  2. The baseline is already near the two-body bound. error_2 = 18.64 mHa leaves only 1.36 mHa of headroom under 20 mHa. Any rank reduction or re-quantization must be paired with re-optimization of the vectors — the factorization has almost no slack to spend.

Revised first lever: factorization refit, not rounding. Re-optimize the vectors/weights (U, w, W) to minimize λ_eff subject to ε_fro ≤ 20 mHa, at brot=12 — or quantization-aware vectors for brot=11. The metrics function (evaluate_dfthc_angle_words) and the baseline factorization are both local, so this is a classical scipy optimization; the dfthc-sos starter kit trainer is not in the downloaded dataset (it lives in a separate starter-kit dataset named in SCORING_README.md) and is not strictly required.

5. Verification discipline

  • Every candidate is verified with the stock verifier before it counts. No hand-waved cost claims.
  • dfthcsos: local full verify (~25 s). invsqrt: sampled locally, full on Kaggle. DQI: full on Kaggle notebook only (201 s, 4 workers).
  • Nothing is submitted to the competition without Igor's explicit go-ahead. Nothing is published from a Kaggle notebook without his say-so.
  • Per-stage Toffoli splits for invsqrt/DQI (marks exist in the reference builders) are still unmeasured — extract before optimizing either circuit's internals.

6. Open / unconfirmed

  • Exact overall geometric-mean formula (Kaggle rules, not paper).
  • Organizers' internal best-run scores (hashes only).
  • dfthcsos error_1/error_2 of the baseline (being measured now).
  • Whether brot reduction keeps error_1/error_2 under 20 mHa (sweep will tell).
  • Per-stage Toffoli splits for invsqrt and DQI.