From 9e628bf7536b61487859e66e9b93ae90a0822b57 Mon Sep 17 00:00:00 2001 From: qingyunqian Date: Thu, 30 Jul 2026 05:29:46 +0800 Subject: [PATCH 1/3] Add Task 06 final expert optimization evidence --- optimized_solutions/challenge-06/README.md | 18 + .../research/IMPLEMENTATION_COMPARISON.md | 103 + .../challenge-06/research/INSIGHTS.md | 92 + .../challenge-06/research/LOG.md | 302 ++ .../challenge-06/research/SURVEY.md | 160 + .../research/figures/factor-ablation.svg | 2869 +++++++++++++++++ .../research/plot_factor_ablation.py | 84 + .../research/profile_digital_fusion.py | 138 + .../research/profile_hamiltonian_actions.py | 175 + .../research/profile_reference.py | 164 + .../profiles/digital-fusion-profile.json | 119 + .../profiles/e01-digital-fusion-10.json | 177 + .../profiles/e01-digital-fusion-100.json | 177 + .../research/profiles/e02-dt0-auto-10.json | 177 + .../research/profiles/e02-dt0-auto-100.json | 177 + .../profiles/e03-final-five-pair.json | 64 + .../research/profiles/e03-jaxode-10.json | 177 + .../research/profiles/e03-jaxode-100.json | 177 + .../profiles/e03-jaxode-equivalence.json | 27 + .../profiles/hamiltonian-action-profile.json | 128 + .../profiles/reference-baseline-six.json | 637 ++++ .../research/profiles/reference-profile.json | 64 + .../research/run_docker_matrix.py | 463 +++ .../validate_candidate_equivalence.py | 142 + .../challenge-06/solution_6_native_jaxode.py | 164 + 25 files changed, 6975 insertions(+) create mode 100644 optimized_solutions/challenge-06/README.md create mode 100644 optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md create mode 100644 optimized_solutions/challenge-06/research/INSIGHTS.md create mode 100644 optimized_solutions/challenge-06/research/LOG.md create mode 100644 optimized_solutions/challenge-06/research/SURVEY.md create mode 100644 optimized_solutions/challenge-06/research/figures/factor-ablation.svg create mode 100644 optimized_solutions/challenge-06/research/plot_factor_ablation.py create mode 100644 optimized_solutions/challenge-06/research/profile_digital_fusion.py create mode 100644 optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py create mode 100644 optimized_solutions/challenge-06/research/profile_reference.py create mode 100644 optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json create mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json create mode 100644 optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json create mode 100644 optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json create mode 100644 optimized_solutions/challenge-06/research/profiles/reference-profile.json create mode 100644 optimized_solutions/challenge-06/research/run_docker_matrix.py create mode 100644 optimized_solutions/challenge-06/research/validate_candidate_equivalence.py create mode 100644 optimized_solutions/challenge-06/solution_6_native_jaxode.py diff --git a/optimized_solutions/challenge-06/README.md b/optimized_solutions/challenge-06/README.md new file mode 100644 index 0000000..a972012 --- /dev/null +++ b/optimized_solutions/challenge-06/README.md @@ -0,0 +1,18 @@ +# Challenge 06 optimized expert solution + +This directory packages the final reviewed Task 06 campaign from Benchmark +PR [#12](https://github.com/hmyuuu/OrbitBreakersExpertBenchmarks/pull/12), +with the final tree taken from Benchmark `main` at `7e2298b`. + +- `solution_6_native_jaxode.py` is the optimized TensorCircuit-NG variant. +- `research/IMPLEMENTATION_COMPARISON.md` is the final report. +- `research/profiles/`, `research/figures/`, and the validation/profiling + scripts preserve the factor ablations and five-pair result. + +All five matched pairs passed. Mean runtime changed from `41.4259 s` to +`27.5366 s`; mean paired speedup was `1.50446x` with a 95% t-interval of +`[1.48875x, 1.52018x]`. + +The canonical expert under `tasks/challenge-06/solution/` is intentionally +unchanged. Benchmark-harness reproduction commands in the research record +should be run in the Benchmark repository pinned above. diff --git a/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md b/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md new file mode 100644 index 0000000..10d83f6 --- /dev/null +++ b/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md @@ -0,0 +1,103 @@ +# Task 06 Human-Expert Optimization and Factor Ablation + +## Result + +The optimized solution preserves the expert's continuous-time TensorCircuit +calculation and is **1.504x faster** on the final five-pair same-machine +benchmark. Mean end-to-end runtime fell from `41.4259 s` to `27.5366 s` +(`33.53%`), and the candidate won all five counterbalanced pairs. + +| Pair | Order | Expert (s) | Candidate (s) | Speedup | +|---:|---|---:|---:|---:| +| 1 | expert → candidate | 41.3896 | 27.2906 | 1.5166x | +| 2 | candidate → expert | 41.3893 | 27.6433 | 1.4973x | +| 3 | expert → candidate | 41.4415 | 27.6251 | 1.5001x | +| 4 | candidate → expert | 41.5825 | 27.3809 | 1.5187x | +| 5 | expert → candidate | 41.3267 | 27.7431 | 1.4896x | +| **Mean** | — | **41.4259** | **27.5366** | **1.5044x** | + +The mean paired speedup is `1.50446x ± 0.00566` standard error, with a +two-sided 95% t-interval of `[1.48875x, 1.52018x]`. + +## Optimized implementation + +Two accepted changes are present: + +1. Fuse each exact digital `RZ → RY → RZ` Euler sequence into one + phase-corrected TensorCircuit `U` gate while retaining all 168 independent + angles. +2. Select TensorCircuit's native `jaxode` backend for the same adaptive + `tc.timeevol.ode_evol_global` calls, with the original vector field, + endpoints, tolerances, and maximum-step bound. + +No Trotter approximation, static answer, dense replacement simulator, or +parameter removal is used. + +## Factor ablation + +The campaign changed one factor at a time. Canonical single screens establish +the cumulative direction; isolated profilers explain which phase is affected. +Only the final promoted candidate received the five-pair inference above, so +the single-screen percentages below are diagnostic rather than independent +confidence intervals. + +| Factor | Comparison | Evidence | Attribution | +|---|---|---|---| +| Exact Euler fusion | expert `45.0372 s` six-run historical mean → e01 `42.4126 s` single canonical screen | State, energy, and gradient equivalence passed. Isolated steady gradient speedup was only `1.0042x`, but compile-plus-first-execution fell from `2.5819 s` to `2.2421 s`. | Small compile-oriented contribution; the apparent 5.8% end-to-end delta is not claimed as a separately significant effect. | +| Diffrax automatic `dt0` | e01 `42.4126 s` → e02 `42.3620 s` | Only `0.12%`; displayed outputs unchanged. | Neutral; discarded. | +| TensorCircuit `jaxode` | e01 `42.4126 s` → e03 `27.7480 s` | Same canonical evaluator and fused circuit; `1.5285x` single-screen speedup. Energy, gradient, and one-update audit passed. | **Dominant positive factor.** | +| TensorCircuit BCOO Hamiltonians | termwise MVP versus BCOO microbench | BCOO was `3.4–3.5x` slower for both analog and target actions. | Negative; discarded before integration. | +| Whole-training scan | not integrated | ODE backend change already dominates; no unsupported percentage assigned. | Open follow-up, not part of the reported speedup. | + +The defensible conclusion is therefore narrower than “all edits helped”: +**the ODE backend accounts for the large gain**. Euler fusion is a smaller +compile-cost optimization, automatic initial-step selection contributes +nothing measurable, and sparse BCOO conversion is actively harmful on this +stack. + +![Task 06 factor-ablation plots](figures/factor-ablation.svg) + +The panels use the frozen canonical screens and isolated profiler values. +They are intentionally not multiplied together: the left panel is cumulative, +while the other two isolate compilation and Hamiltonian-action mechanisms. +Regenerate with +[`plot_factor_ablation.py`](plot_factor_ablation.py). + +## Correctness + +The candidate keeps the 14-qubit Néel state, four hybrid blocks, four true +adaptive ODE evolutions per loss, all analog variables, all digital angles, +seed 2026, complex64 TensorCircuit/JAX computation, target Hamiltonian, +exactly 100 Adam updates, and every pre-update energy. + +For the `jaxode` substitution, the frozen audit measured: + +```text +initial energy absolute error: 7.39e-6 <= 5e-5 +maximum gradient element error: 3.38e-5 <= 5e-4 +post-update parameter max error: 2.98e-8 +post-update energy absolute error: 4.77e-7 <= 2e-3 +``` + +All ten cells in the final paired benchmark passed the canonical evaluator. + +## Reproduction and provenance + +The final benchmark used one no-network container, a fresh evaluator process +per cell, counterbalanced order, six CPUs, 7 GiB memory, and a 300-second cell +cap. Image ID: +`sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833`. + +Run: + +```bash +python3 research/task-06/run_docker_matrix.py \ + --repeat 5 --max-steps 100 --timeout 300 \ + --cpus 6 --memory 7g \ + --output /private/tmp/task06-e03-five-pair +``` + +Machine-readable summary: +[`profiles/e03-final-five-pair.json`](profiles/e03-final-five-pair.json). +The full experimental chronology and rejected variants are in +[`LOG.md`](LOG.md). diff --git a/optimized_solutions/challenge-06/research/INSIGHTS.md b/optimized_solutions/challenge-06/research/INSIGHTS.md new file mode 100644 index 0000000..4796a04 --- /dev/null +++ b/optimized_solutions/challenge-06/research/INSIGHTS.md @@ -0,0 +1,92 @@ +# Task 06 Research Insights + +Task: `task-06` + +Last consolidated: `2026-07-29` + +Evidence ledger: [`LOG.md`](LOG.md) + +## Current best + +Experiment e03 is the current best. In the final five counterbalanced +same-container pairs, the immutable expert averaged `41.425923 s` and e03 +averaged `27.536613 s`. The ratio of means is `1.50439x`; mean paired speedup +is `1.50446x` with a 95% t-interval of `[1.48875x, 1.52018x]`. + +## Preserved semantics + +- 14-qubit Neel state and four hybrid blocks. +- Four true adaptive ODE evolutions per loss, with the original tolerances and + maximum-step bound. +- All analog time/coupling/detuning variables and all 168 independent digital + Euler angles. +- Seed 2026, complex64 TensorCircuit/JAX computation, target Hamiltonian, + exactly 100 Adam updates, and every pre-update energy. +- Original NumPy output keys, shapes, and physical meanings. + +## Confirmed bottlenecks + +Both compilation and differentiated ODE execution are material. Immutable +profiling measured `2.851 s` lowering, `3.195 s` compilation, and +`0.2805 s` per early optimizer update, projecting `28.05 s` for 100 compiled +executions against the `45.04 s` evaluator mean. + +The expected sparse-Hamiltonian shortcut is not viable on this CPU/JAX stack. +TensorCircuit BCOO multiplication was 3.4-3.5x slower than the installed +termwise MVP in isolated analog and target actions. XLA already fuses the +short reshape/slice/broadcast Pauli sums effectively. + +Exact digital Euler fusion primarily affects compilation: the isolated +energy-gradient first call improved by about `0.34 s`, while steady execution +changed by only `0.4%`. + +## What worked + +Exact fusion of every digital `RZ -> RY -> RZ` sequence into one +phase-corrected TensorCircuit `U` gate passed state/energy/gradient audits and +reduced the canonical single screen by about 5.8%. + +Switching the same TensorCircuit raw-mode continuous ODE from Diffrax to +TensorCircuit's `jaxode` backend reduced the accepted canonical screen by a +further 34.6%. Initial energy, gradient, one Adam update, the full 100-update +functional contract, tolerances, and maximum-step bound all pass. + +## What did not work + +The old bootstrap's raw-mode ODE API failure is obsolete in the current image +and should not be treated as a present blocker. + +Do not replace the current Hamiltonian actions with TensorCircuit/JAX BCOO +unchanged. Numerical equivalence passed, but isolated steady runtime regressed +by more than 3x. + +Diffrax `dt0=None` was neutral on the canonical screen (`0.12%` faster than +e01, far below noise) and produced the same displayed optimization result. +Keep the explicit framework default unless new step-count evidence explains a +reason to revisit it. + +## Factor attribution + +The native `jaxode` substitution is the dominant positive factor: its +one-change canonical screen was `1.5285x` faster than the accepted +digital-fusion candidate. Euler fusion is smaller and primarily lowers +compile-plus-first-execution cost. Diffrax `dt0=None` was neutral, while BCOO +Hamiltonian conversion was a clear regression. See +[`IMPLEMENTATION_COMPARISON.md`](IMPLEMENTATION_COMPARISON.md) for the +ablation table and final paired result. + +## Open hypotheses + +1. Whole-training `K.jaxy_scan`. +2. A direct five-pair removal test could quantify whether `jaxode` makes the + compile-oriented digital fusion redundant. +3. Parameter-tree simplification only if later profiling supports it. +4. Diffrax solver sweep is now low priority because the native `jaxode` path + is materially faster. + +## Evidence limits + +The benchmark covers one fixed public workload, one image, and one host +resource profile. It establishes neither cross-hardware performance nor global +SOTA. Factor screens other than the final promoted comparison are diagnostic +single runs or isolated microbenchmarks and are labeled accordingly. diff --git a/optimized_solutions/challenge-06/research/LOG.md b/optimized_solutions/challenge-06/research/LOG.md new file mode 100644 index 0000000..73b4284 --- /dev/null +++ b/optimized_solutions/challenge-06/research/LOG.md @@ -0,0 +1,302 @@ +# Task 06 Autoresearch Campaign + +Task: `task-06` + +Campaign branch: `codex/orbitbreakers/task-06/extreme-native` + +Insights: [`INSIGHTS.md`](INSIGHTS.md) + +## Campaign scope + +Optimize only the immutable Task 06 human-expert TensorCircuit-NG solution. +Preserve the four true continuous-time ODE blocks, all parameters, all 100 Adam +updates, and the complete output contract. Use the latest installed framework; +do not attribute host hardware differences to solution performance. + +At `2026-07-29T01:26Z`, the upstream repository returned zero open pull +requests matching `Task 06`. + +## Frozen provenance + +- Parent: `5af98f27b9404c513df8eee0f4568b1512edee19`. +- Reference: + `0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1`. +- Evaluator: + `0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998`. +- Image: + `sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833`. +- TensorCircuit-NG `1.8.0.dev20260726`; JAX/JAXLIB `0.10.0`; Diffrax + `0.7.2`; Optax `0.2.8`. +- Resource profile: six CPUs, 7 GiB, network disabled, 300-second cell cap. +- Pair order: odd `reference -> candidate`, even + `candidate -> reference`. +- Private or hidden evaluation used: no. + +## Append-only campaign events + +- `2026-07-29T01:27:26Z`: created the dedicated branch from current + `origin/main`. Reference and editable source were byte-identical. +- `2026-07-29T01:28Z`: latest-image one-update compatibility run completed in + `7.889008 s`. The ODE API is functional; the one-update evaluator + intentionally fails convergence thresholds and is diagnostic only. +- `2026-07-29T01:29:10Z` to `2026-07-29T01:34:01Z`: completed six immutable + canonical reference runs in one no-network container with a fresh evaluator + process per run. All six passed. Runtimes were `43.976600`, `45.097434`, + `44.415753`, `44.864424`, `45.481100`, and `46.387673` seconds. Mean + `45.037164 s`, median `44.980929 s`, standard error `0.344740 s`. + Report: `profiles/reference-baseline-six.json`; + SHA-256 + `bdb7b985d6a0fa6bd6e7044816f9764e90b285fa9be0e6f07b79aa2587e9ff35`. +- `2026-07-29T01:35Z`: the first runner version omitted the gate checker's + `repeat` alias and exact `docker exec` command from serialized rows. Both + metadata fields were reconstructed deterministically from the unmodified + checkpoint; no measurement, output, status, order, or hash changed. The + runner now records both fields directly. +- `2026-07-29T01:36:02Z`: froze the public canonical Task 06 workload and + source-backed survey. Candidate edits are allowed only after + `research/check_gates.py` reports `research_ready: true`. + +## Baseline interpretation + +The canonical expert passes with initial energy density `-0.5182266235`, final +history energy density `-1.5754342079`, and independently evaluated sparse +ground energy density about `-1.6025561094`. Its learned analog parameters are +well inside all bounds. The small `1.9%` max/min runtime spread makes the +baseline suitable for paired screening. + +## Append-only corrections + +Append later corrections here; do not rewrite any result after it informs a +candidate. + +## Profiling event: immutable compiled update + +Recorded at `2026-07-29T01:41Z`. + +Profiler: `profile_reference.py` +(`sha256:ba1a9072b8b76b439429ef7cbfb9325c4f525c531dedcc9153813d17f4f183fd`). +Report: `profiles/reference-profile.json` +(`sha256:b96624021fde8f5a5c374c1e60d1e0aa5c24c1e15d624a520f35d7c0dc243a4e`). + +Lowering and compilation took `2.851043 s` and `3.194721 s`. Eight early +post-compile optimizer updates averaged `0.280501 s` and projected +`28.050100 s` for 100 executions. XLA reported about `23.52 million` FLOPs, +`101.16 MB` bytes accessed, and `18.78 MB` temporary storage per update. +The canonical evaluator mean is `45.037164 s`, so both compilation and +steady differentiated ODE execution are material; Python-only cleanup cannot +produce a large gain. + +## Profiling event: Hamiltonian action + +Recorded at `2026-07-29T01:42Z`. + +Profiler: `profile_hamiltonian_actions.py` +(`sha256:fcc5914a4bb1feb50bd3b1ca2bbc89c3b706a17ce701e8dbafba29c1058b0e46`). +Report: `profiles/hamiltonian-action-profile.json` +(`sha256:6d864f1d3ff26ec1625edacb39347ed8ba3575d1a081d4f67aedd9c314584472`). + +The TensorCircuit COO operators agreed with the expert analog action to +`8.72e-9` maximum absolute error and with the target action to `1.91e-6`. +However, native BCOO multiplication was slower on this CPU/JAX stack: + +```text +analog termwise MVP: 0.249930 ms +analog sparse BCOO: 0.851897 ms +termwise/sparse: 0.293381x + +target termwise MVP: 0.344365 ms +target sparse BCOO: 1.209447 ms +termwise/sparse: 0.284729x +``` + +Decision: `discard before candidate integration`. The installed 1.8 +`PauliStringSum2MVP` implementation is already reshape/slice/broadcast based +and XLA fuses these short local Pauli sums effectively. A full sparse rewrite +has no source-independent reason to reverse a 3.4-3.5x isolated steady +regression. Do not repeat BCOO unchanged. + +## Profiling event: exact digital Euler fusion + +Recorded at `2026-07-29T01:44Z`. + +Profiler: `profile_digital_fusion.py` +(`sha256:681c4c55ba4550db5ca2dd0729ea7c4f0495252d375102aca48cd6c2369e1d39`). +Report: `profiles/digital-fusion-profile.json` +(`sha256:48185620664abf2da8857ed17d12a148b0ed7c8f685b5ba124c2a3b3df52c113`). + +Replacing each `RZ -> RY -> RZ` triple by the exactly phased TensorCircuit +`U` gate produced maximum state, energy, and gradient errors +`8.94e-8`, `9.54e-7`, and `9.65e-7`. The isolated energy-gradient steady +speedup was only `1.0042x`, but compile-plus-first-execution fell from +`2.5819 s` to `2.2421 s`. Decision: `test end to end`; this is a compile-cost +hypothesis, not a steady-execution claim. + +## Frozen follow-up ODE hypotheses + +Source inspection after the initial survey exposed two additional +TensorCircuit-native controls that preserve a true adaptive ODE: + +1. pass `dt0=None` so Diffrax chooses its initial step instead of forcing + `0.01` for every smooth time-independent block; +2. compare TensorCircuit's `ode_backend="jaxode"` with the current Diffrax + path, preserving `rtol`, `atol`, and `max_steps`. + +Each is isolated after the digital-fusion screen. A candidate must pass a +canonical 100-update evaluator; lower-step runs are diagnostics only. + +## Experiment `e01`: exact digital Euler fusion + +Candidate commit: `9484010`. + +Candidate SHA-256: +`b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90`. + +Pre-edit diff SHA-256: +`cd45478134866b89de5b704476fd03d6f8f480a60f795b9a85f89cbb3b495085`. + +The candidate replaces each block's 42 `RZ/RY/RZ` circuit nodes with 14 +exactly phased TensorCircuit `U` nodes. It retains all three independent +angles. The exact identity audit was already frozen in +`profiles/digital-fusion-profile.json`. + +```text +max_steps=10: 10.912746 s, PASS +max_steps=100: 42.412637 s, PASS +reference six-run mean: 45.037164 s +single-screen ratio: 1.06188x +``` + +The canonical initial energy differs from the reference baseline by +`3.58e-7`; final history energy differs by `1.17e-5`. All output shapes, +bounds, history length, energy gates, and NumPy checks pass. + +Reports: + +- `profiles/e01-digital-fusion-10.json` + (`sha256:fc0b5cc821d73025443618bf771ff076ec621021ecbfe035c2ce47cb68f0d072`); +- `profiles/e01-digital-fusion-100.json` + (`sha256:b926c0b8004e30fe62c6f65dfc80204c6cfdd849ffd11ec6066f87d1854d1f4a`). + +Decision: `keep provisionally`. The canonical screen is about 5.8% below the +immutable mean and the numerical audits pass. Continue from e01 to isolate +Diffrax automatic initial-step selection. + +## Experiment `e02`: Diffrax automatic initial step + +Candidate commit: `a76876b`; restore commit: `670364d`. + +Candidate SHA-256: +`b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582`. + +The only change from e01 was `dt0=None`, asking the same TensorCircuit Diffrax +path to choose its initial step automatically while preserving solver, +tolerances, and maximum steps. + +```text +max_steps=10: e01 10.912746 s, e02 10.402433 s, e02 PASS +max_steps=100: e01 42.412637 s, e02 42.361953 s, e02 PASS +canonical delta: 0.050684 s (0.12%) +``` + +The canonical energies and returned analog parameters were byte-for-display +identical to e01. Reports: + +- `profiles/e02-dt0-auto-10.json` + (`sha256:c0d534a50c3b0e2e36b979166309913858a004fdb552111b36d85576de079dbe`); +- `profiles/e02-dt0-auto-100.json` + (`sha256:d9f17e8f27e26f6c85d33c03ae7377d7b961902b6b6f877c12ab094c823962d6`). + +Decision: `discard`. The `0.12%` single-run canonical difference is far below +normal run noise and supplies no evidence that the automatic choice improves +the accepted e01 path. Restore the simpler expert default before the next +experiment. + +## Experiment `e03`: TensorCircuit `jaxode` + +Candidate commit: `a603df8`. + +Candidate SHA-256: +`158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1`. + +Pre-edit diff SHA-256: +`c78de3e12645fd9af2fa96026017a0f30cb86b04533531b614e5a5fc704fa79b`. + +The candidate changes only TensorCircuit's ODE backend selector from +`diffrax` to `jaxode`. It still calls `tc.timeevol.ode_evol_global` in raw +mode with the identical vector field, two endpoint times, `rtol=atol=1e-6`, +and `max_steps=16`. It does not introduce a Trotter approximation or direct +matrix exponential. + +```text +max_steps=10: e01 10.912746 s, e03 6.866093 s, e03 PASS +max_steps=100: reference mean 45.037164 s + e01 42.412637 s + e03 27.747994 s, e03 PASS +canonical single-screen vs reference mean: 1.62297x +canonical single-screen vs e01: 1.52850x +``` + +The frozen numerical audit passed: + +```text +initial energy absolute error: 7.39e-6 <= 5e-5 +maximum gradient element error: 3.38e-5 <= 5e-4 +post-update parameter max error: 2.98e-8 +post-update energy absolute error: 4.77e-7 <= 2e-3 +``` + +The canonical run passes all gates with initial/final history energy +`-0.5182192326 / -1.5775290728`. Reports: + +- `profiles/e03-jaxode-10.json` + (`sha256:dd9b3d4ffbf1d146f271287520d3f9103c907131815f15fcf42b944deae70450`); +- `profiles/e03-jaxode-100.json` + (`sha256:96777324be79271c79670acd126044e53e48f7a0550834ef6552a479a8b0bdde`); +- `profiles/e03-jaxode-equivalence.json` + (`sha256:b258da71dcd109c3bcb55a11da180a48db446b3d6a7b3e0805ef095d7a00fcf1`). + +Decision: `keep`. This is the first large end-to-end gain and remains wholly +inside TensorCircuit's supported continuous-time ODE API. Continue from e03 +to isolate whole-training scan. + +## Final five-pair comparison and attribution + +Recorded at `2026-07-29T05:13:09Z`. + +Five counterbalanced pairs were run in one no-network container, using a fresh +evaluator process for every cell, six CPUs, 7 GiB memory, and the canonical +100-update workload. All ten cells passed. + +```text +reference: 41.389616, 41.389259, 41.441489, 41.582510, 41.326743 s +candidate: 27.290641, 27.643293, 27.625098, 27.380896, 27.743136 s + +reference mean: 41.425923 s +candidate mean: 27.536613 s +ratio of means: 1.504394x +mean paired speedup: 1.504463x +paired standard error: 0.005659x +95% paired t-interval: [1.488750x, 1.520175x] +candidate wins: 5/5 +``` + +Report: `profiles/e03-final-five-pair.json`. + +The runner returned a nonzero process status only because its legacy promotion +booleans require a six-run known-baseline gate; that policy is inapplicable to +this explicitly requested five-pair comparison. It does not indicate a +functional failure. + +Attribution after reviewing all campaign evidence: + +- TensorCircuit `jaxode` is the dominant factor (`1.5285x` versus e01 in the + controlled one-change canonical screen). +- Exact Euler fusion is a smaller compile-oriented factor; the isolated steady + improvement was only `1.0042x`. +- Diffrax `dt0=None` was neutral (`0.12%`) and was removed. +- TensorCircuit BCOO Hamiltonian actions were `3.4–3.5x` slower and were never + integrated. + +No independent percentage is assigned to whole-training scan because it is not +part of the promoted implementation. The consolidated PR-facing report is +`IMPLEMENTATION_COMPARISON.md`. diff --git a/optimized_solutions/challenge-06/research/SURVEY.md b/optimized_solutions/challenge-06/research/SURVEY.md new file mode 100644 index 0000000..f273e66 --- /dev/null +++ b/optimized_solutions/challenge-06/research/SURVEY.md @@ -0,0 +1,160 @@ +# ORBIT-Q Task 06 Runtime Optimization Survey + +**Status: READY** + +Campaign task: `task-06` + +Survey freeze: `2026-07-29T01:36:02Z` + +Reference commit: `5af98f27b9404c513df8eee0f4568b1512edee19` + +This campaign covers only Task 06. The immutable expert, public canonical +workload, semantic constraints, hypotheses, and measurement rule are frozen +before the first candidate edit. + +## Evidence and claim boundary + +The immutable human expert is `references/task-06/solution_6.py` +(`sha256:0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1`). +The public contract and evaluator are `tasks/task-06/problem.md` +(`sha256:e3e8a8044c322027327b6e694dbb476f67dbc09465ea80dd4f20aebf8c64c8a7`) +and `tasks/task-06/evaluator/evaluate_6.py` +(`sha256:0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998`). + +The old bootstrap did not produce a Task 06 runtime because its then-installed +framework lacked the required raw-mode ODE API. The current latest +TensorCircuit-NG image runs the immutable expert successfully. Six complete +fresh-process baselines are `43.976600`, `45.097434`, `44.415753`, +`44.864424`, `45.481100`, and `46.387673` seconds: mean `45.037164` seconds, +median `44.980929` seconds, and standard error `0.344740` seconds. + +No external result uses this exact evaluator, seeded initialization, optimizer +trajectory, ODE tolerances, container, and hardware allocation. This campaign +may claim only a paired gain over the bundled expert and a repository/campaign +best, not a global hardware-independent SOTA result. + +At `2026-07-29T01:26Z`, the upstream repository had no open pull request +matching Task 06. The campaign therefore does not duplicate an active Task 06 +optimization. + +## Framework and environment + +Measurements use Docker image +`sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833` +with six CPUs, 7 GiB memory, no network, and a fresh evaluator process for +every cell. The tracked lock is +`envs/tensorcircuit-py311/requirements.lock` +(`sha256:cd5ac5cb2102ea7b40bd46dc81320cc59e0ce0671ab88c597f81d82b384a824b`). +Per maintainer direction, no TensorCircuit downgrade is used. + +| Component | Version | Inspected source | +| --- | --- | --- | +| TensorCircuit-NG | `1.8.0.dev20260726` | `quantum.py` (`sha256:fcaee21ba5ccde1b89c46e2f5424c48d342e3bfaedf72adba672ab6bd4ded703`), `timeevol.py` (`sha256:64013d6bed57c842f00df254ce84d35c70b25c2a01f5d774b8d503d2e7a097d7`), and `circuit.py` (`sha256:5c4d569325369d957dc60bbeca8a581508549ff9813a7a163de61a6294864662`) | +| JAX / JAXLIB | `0.10.0` / `0.10.0` | TensorCircuit JAX backend (`sha256:88657aebf8e5d566ac4e653abe327083da0253f02a3a297a134b871ffe4baab9`) | +| Diffrax | `0.7.2` | called through `tc.timeevol.ode_evol_global` with `Tsit5`, PID tolerance control, and `max_steps=16` | +| Optax | `0.2.8` | exactly 100 Adam updates at learning rate `0.12` | + +TensorCircuit's ODE documentation describes full-system sparse Hamiltonians as +the intended efficient input to global ODE evolution: +. +The installed `ode_evol_global` source confirms that raw mode delegates to +Diffrax and preserves the configured `rtol`, `atol`, and `max_steps`. +Diffrax documents `diffeqsolve`, adaptive step-size control, maximum steps, +and reverse-mode checkpointing: + and +. +JAX documents that `lax.scan` lowers a fixed loop to one WhileOp and that +host conversion synchronizes asynchronous computation: + and +. + +## Task 06: digital-analog hybrid VQE + +The expert prepares the 14-qubit Neel state and applies four hybrid blocks. +Each block performs an actual differentiable continuous-time ODE evolution +under + +`J_l * sum_i (X_i X_(i+1) + Y_i Y_(i+1)) + Delta_l * sum_i (-1)^i Z_i` + +with trainable bounded time, coupling, and detuning, followed by independent +`RZ -> RY -> RZ` rotations on all 14 qubits. The loss is the energy density of +the specified 53-term target Hamiltonian. The expert differentiates this +four-block computation and performs exactly 100 sequential Adam updates, +recording every pre-update energy. + +Every viable candidate must preserve: + +- all 14 qubits, four analog ODE solves per loss, and the exact Neel state; +- actual continuous-time ODE integration through TensorCircuit with + `rtol=atol=1e-6` and `max_steps=16`, never a Trotter/product formula; +- all 180 trainable float32 values: 4 times, 4 couplings, 4 detunings, and + `4 * 14 * 3 = 168` independent digital rotation angles; +- the `sigmoid`/`tanh` parameter maps, seed 2026 initialization, target + Hamiltonian, complex64 computation, 100 Adam updates, and pre-update history; +- all four required NumPy outputs with their original meanings and shapes. + +## Source-supported bottleneck + +Each Diffrax vector-field evaluation calls two separate +`PauliStringSum2MVP` closures. In TensorCircuit-NG 1.8, that helper implements +every Pauli term as a reshape, broadcast mask, slice/flip, multiply, and +accumulate. The XY operator has 26 terms and the field has 14 terms, so each +adaptive Runge-Kutta stage executes 40 termwise full-state transforms; reverse +mode differentiates through the same work. Four ODE solves occur per loss and +100 loss/gradient/update steps are required. + +The framework's `PauliStringSum2COO` instead constructs a native JAX sparse +operator, and the JAX backend exposes `sparse_dense_matmul`. The installed +TensorCircuit ODE docstring explicitly recommends a sparse full-system +Hamiltonian for efficiency. This is the primary hypothesis. + +The 168 digital gates are a secondary trace/compile and execution cost. Each +qubit's exact Euler sequence can be represented by one differentiable 2x2 +TensorCircuit gate without tying or removing any angle. The Python host loop +dispatches one jitted optimizer step 100 times and is a lower-risk secondary +target. + +## Frozen experiments + +Each experiment starts from the latest accepted candidate and must pass a +public reduced screen before canonical promotion. + +1. **Native sparse Hamiltonian action.** Build the analog and target + Hamiltonians with TensorCircuit `PauliStringSum2COO`, apply them with the + TensorCircuit JAX backend's sparse-dense multiplication, and keep + `ode_evol_global(..., mode="raw", ode_backend="diffrax")`. Retain only if + a canonical run passes and improves on the `45.037164`-second reference + mean. +2. **Exact digital Euler fusion.** Form one differentiable 2x2 gate per qubit + equal to the expert's ordered `RZ -> RY -> RZ` sequence and apply it through + TensorCircuit. Require initial-energy and gradient agreement at complex64 + tolerance before runtime promotion. +3. **Whole-training TensorCircuit scan.** Carry parameters and Optax state + through `K.jaxy_scan` for exactly 100 updates and return all pre-update + energies. Retain only if canonical runtime improves over the accepted + predecessor. +4. **ODE solver selection.** Compare TensorCircuit's available `Tsit5`, + `Dopri5`, and `Dopri8` only after higher-value structural changes. All + candidates must retain the same tolerance and step bound and pass the + canonical energy/output contract. +5. **Parameter-tree simplification.** Flatten the four-leaf parameter PyTree + only if profiling shows optimizer/control overhead remains material. +6. **Direct algebraic or free-fermion evolution.** Reject for this campaign: + although the analog Hamiltonian is quadratic, replacing the required ODE + with a closed-form exponential, matchgate decomposition, or handwritten + simulator would change the requested method/framework fidelity. + +## Correctness and measurement rule + +For numerical audits, compare reference and candidate initial energy, +gradient leaves, one Adam update, and short histories. Frozen complex64 +tolerances are `5e-5` for initial energy, `5e-4` for maximum gradient element, +and `2e-3` for short physical energy history unless a candidate is algebraically +bit-equivalent. + +Final evidence is six counterbalanced canonical pairs in one no-network +container. Odd pairs run reference then candidate; even pairs reverse order. +Every cell is a fresh evaluator process with a 300-second cap. Promotion +requires all 12 cells to pass, candidate wins in at least five of six pairs, +lower candidate mean and median, and a two-sided 95% Student-t lower bound on +mean pairwise speedup above `1.0`. diff --git a/optimized_solutions/challenge-06/research/figures/factor-ablation.svg b/optimized_solutions/challenge-06/research/figures/factor-ablation.svg new file mode 100644 index 0000000..4538643 --- /dev/null +++ b/optimized_solutions/challenge-06/research/figures/factor-ablation.svg @@ -0,0 +1,2869 @@ + + + + + + + + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/optimized_solutions/challenge-06/research/plot_factor_ablation.py b/optimized_solutions/challenge-06/research/plot_factor_ablation.py new file mode 100644 index 0000000..f9c3fc3 --- /dev/null +++ b/optimized_solutions/challenge-06/research/plot_factor_ablation.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +"""Render the Task 06 factor-ablation summary from frozen campaign data.""" + +from pathlib import Path + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt + + +OUT = Path(__file__).with_name("figures") / "factor-ablation.svg" + + +def label_bars(ax, bars, fmt="{:.2f}"): + for bar in bars: + value = bar.get_height() + ax.text( + bar.get_x() + bar.get_width() / 2, + value, + fmt.format(value), + ha="center", + va="bottom", + fontsize=8, + ) + + +def main(): + plt.style.use("seaborn-v0_8-whitegrid") + plt.rcParams["svg.hashsalt"] = "task-06-factor-ablation" + fig, axes = plt.subplots(1, 3, figsize=(13.2, 4.2)) + blue, orange, red = "#4472C4", "#ED7D31", "#C44E52" + + labels = ["Expert", "+ Euler fusion", "+ dt0=None", "+ jaxode"] + runtimes = [45.037164, 42.412637, 42.361953, 27.747994] + bars = axes[0].bar(labels, runtimes, color=[blue, orange, "#A5A5A5", blue]) + label_bars(axes[0], bars, "{:.1f}s") + axes[0].set_ylabel("Canonical runtime (s)") + axes[0].set_title("Cumulative screens (jaxode: −34.6% vs fused)") + axes[0].tick_params(axis="x", rotation=24) + axes[0].set_ylim(0, 51) + + cold = [2.5819, 2.2421] + bars = axes[1].bar(["Unfused", "Euler fused"], cold, color=[red, blue]) + label_bars(axes[1], bars, "{:.3f}s") + axes[1].set_ylabel("Compile + first execution (s)") + axes[1].set_title("Euler fusion (cold −13.2%)") + axes[1].set_ylim(0, 3.05) + axes[1].text( + 0.5, + 0.82, + "steady execution: 1.0042×", + transform=axes[1].transAxes, + ha="center", + fontsize=9, + ) + + slowdowns = [1 / 0.293381, 1 / 0.284729] + bars = axes[2].bar(["Analog action", "Target action"], slowdowns, color=red) + label_bars(axes[2], bars, "{:.2f}×") + axes[2].axhline(1, color="black", linewidth=0.8) + axes[2].set_ylabel("BCOO / termwise runtime") + axes[2].set_title("Sparse BCOO screen (rejected)") + axes[2].set_ylim(0, 4.05) + axes[2].text( + 0.5, + 0.82, + ">1 is slower; rejected", + transform=axes[2].transAxes, + ha="center", + fontsize=9, + ) + + fig.suptitle( + "Task 06 factor attribution — jaxode dominates; other factors are small or negative", + fontsize=12, + fontweight="bold", + ) + fig.tight_layout() + OUT.parent.mkdir(parents=True, exist_ok=True) + fig.savefig(OUT, bbox_inches="tight", metadata={"Date": None}) + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/research/profile_digital_fusion.py b/optimized_solutions/challenge-06/research/profile_digital_fusion.py new file mode 100644 index 0000000..43a6ca9 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profile_digital_fusion.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 +"""Audit and profile exact Task 06 digital Euler-gate fusion.""" + +from __future__ import annotations + +import argparse +import json +import statistics +import time +from pathlib import Path +from typing import Any, Callable + +import jax +import numpy as np +import tensorcircuit as tc + +from profile_reference import CONFIG, load_reference, ready + + +K = tc.set_backend("jax") +tc.set_dtype("complex64") + + +def current_state(psi: Any, rotations: Any) -> Any: + circuit = tc.Circuit(CONFIG["n_qubits"], inputs=psi) + for i in range(CONFIG["n_qubits"]): + circuit.rz(i, theta=rotations[i, 0]) + circuit.ry(i, theta=rotations[i, 1]) + circuit.rz(i, theta=rotations[i, 2]) + return circuit.state() + + +def fused_state(psi: Any, rotations: Any) -> Any: + circuit = tc.Circuit(CONFIG["n_qubits"], inputs=psi) + for i in range(CONFIG["n_qubits"]): + alpha, beta, gamma = rotations[i] + phase = K.exp(-0.5j * K.cast(alpha + gamma, tc.dtypestr)) + unitary = phase * tc.gates.u_gate( + theta=beta, phi=gamma, lbd=alpha + ).tensor + circuit.any(i, unitary=unitary) + return circuit.state() + + +def measure( + function: Callable[[Any], Any], argument: Any, repeats: int +) -> tuple[Any, dict[str, Any]]: + compiled = jax.jit(function) + started = time.perf_counter() + value = ready(compiled(argument)) + first_sec = time.perf_counter() - started + samples = [] + for _ in range(repeats): + started = time.perf_counter() + value = ready(compiled(argument)) + samples.append(time.perf_counter() - started) + return value, { + "first_compile_and_exec_sec": first_sec, + "steady_runtime_sec": samples, + "steady_mean_sec": statistics.mean(samples), + "steady_median_sec": statistics.median(samples), + } + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--reference", + type=Path, + default=Path("/workspace/references/task-06/solution_6.py"), + ) + parser.add_argument("--repeats", type=int, default=20) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + + reference = load_reference(args.reference) + psi = reference.initial_state(CONFIG) + rotations = reference.initial_parameters(CONFIG)["rot"][0] + _, _, htarget = reference.build_hamiltonians(CONFIG) + + current_value, current = measure( + lambda r: current_state(psi, r), rotations, args.repeats + ) + fused_value, fused = measure( + lambda r: fused_state(psi, r), rotations, args.repeats + ) + + def energy(state_function: Callable[[Any, Any], Any], r: Any) -> Any: + state = state_function(psi, r) + return K.real(K.tensordot(K.conj(state), htarget(state), 1)) + + current_energy_grad, current_grad_profile = measure( + jax.value_and_grad(lambda r: energy(current_state, r)), + rotations, + args.repeats, + ) + fused_energy_grad, fused_grad_profile = measure( + jax.value_and_grad(lambda r: energy(fused_state, r)), + rotations, + args.repeats, + ) + current_energy, current_grad = current_energy_grad + fused_energy, fused_grad = fused_energy_grad + + report = { + "schema_version": 1, + "task_id": "06", + "jax_version": jax.__version__, + "jaxlib_version": jax.lib.__version__, + "state_max_abs_error": float( + np.max(np.abs(np.asarray(current_value) - np.asarray(fused_value))) + ), + "energy_abs_error": float( + abs(float(current_energy) - float(fused_energy)) + ), + "gradient_max_abs_error": float( + np.max(np.abs(np.asarray(current_grad) - np.asarray(fused_grad))) + ), + "state_current": current, + "state_fused": fused, + "state_steady_speedup": ( + current["steady_mean_sec"] / fused["steady_mean_sec"] + ), + "energy_gradient_current": current_grad_profile, + "energy_gradient_fused": fused_grad_profile, + "energy_gradient_steady_speedup": ( + current_grad_profile["steady_mean_sec"] + / fused_grad_profile["steady_mean_sec"] + ), + } + rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" + if args.output is not None: + args.output.write_text(rendered, encoding="utf-8") + print(rendered, end="") + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py b/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py new file mode 100644 index 0000000..ed196c0 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +"""Compare Task 06 termwise and TensorCircuit-native sparse actions.""" + +from __future__ import annotations + +import argparse +import json +import statistics +import time +from pathlib import Path +from typing import Any, Callable + +import jax +import numpy as np +import tensorcircuit as tc + +from profile_reference import CONFIG, load_reference, ready + + +K = tc.set_backend("jax") +tc.set_dtype("complex64") + + +def pauli_terms(n: int) -> tuple[list[list[int]], list[float], list[list[int]], list[float], list[list[int]], list[float]]: + xy_ls, xy_w = [], [] + for i in range(n - 1): + for p in (1, 2): + s = [0] * n + s[i] = p + s[i + 1] = p + xy_ls.append(s) + xy_w.append(1.0) + + field_ls, field_w = [], [] + for i in range(n): + s = [0] * n + s[i] = 3 + field_ls.append(s) + field_w.append((-1.0) ** i) + + target_ls, target_w = [], [] + for i in range(n - 1): + for p, coefficient in ((1, 0.7), (2, 0.7), (3, 1.1)): + s = [0] * n + s[i] = p + s[i + 1] = p + target_ls.append(s) + target_w.append(coefficient) + for i in range(n): + s = [0] * n + s[i] = 3 + target_ls.append(s) + target_w.append(0.25 * ((-1.0) ** i)) + return xy_ls, xy_w, field_ls, field_w, target_ls, target_w + + +def measure( + function: Callable[[Any], Any], + state: Any, + repeats: int, +) -> tuple[Any, dict[str, Any]]: + compiled = jax.jit(function) + started = time.perf_counter() + value = ready(compiled(state)) + first_sec = time.perf_counter() - started + samples = [] + for _ in range(repeats): + started = time.perf_counter() + value = ready(compiled(state)) + samples.append(time.perf_counter() - started) + return value, { + "first_compile_and_exec_sec": first_sec, + "steady_runtime_sec": samples, + "steady_mean_sec": statistics.mean(samples), + "steady_median_sec": statistics.median(samples), + } + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--reference", + type=Path, + default=Path("/workspace/references/task-06/solution_6.py"), + ) + parser.add_argument("--repeats", type=int, default=20) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + + reference = load_reference(args.reference) + hxy_mvp, hfield_mvp, htarget_mvp = reference.build_hamiltonians(CONFIG) + state = reference.initial_state(CONFIG) + terms = pauli_terms(CONFIG["n_qubits"]) + xy_ls, xy_w, field_ls, field_w, target_ls, target_w = terms + + started = time.perf_counter() + hxy_coo = tc.quantum.PauliStringSum2COO(xy_ls, xy_w, numpy=True) + hfield_coo = tc.quantum.PauliStringSum2COO( + field_ls, field_w, numpy=True + ) + htarget_coo = tc.quantum.PauliStringSum2COO( + target_ls, target_w, numpy=True + ) + scipy_build_sec = time.perf_counter() - started + started = time.perf_counter() + hxy_sparse = K.coo_sparse_matrix_from_numpy(hxy_coo) + hfield_sparse = K.coo_sparse_matrix_from_numpy(hfield_coo) + htarget_sparse = K.coo_sparse_matrix_from_numpy(htarget_coo) + backend_convert_sec = time.perf_counter() - started + + j_value = K.cast(K.tanh(K.convert_to_tensor(0.1)), tc.dtypestr) + d_value = K.cast(K.tanh(K.convert_to_tensor(0.1)), tc.dtypestr) + + def termwise_analog(y: Any) -> Any: + return j_value * hxy_mvp(y) + d_value * hfield_mvp(y) + + def sparse_analog(y: Any) -> Any: + return j_value * K.sparse_dense_matmul( + hxy_sparse, y + ) + d_value * K.sparse_dense_matmul(hfield_sparse, y) + + termwise_value, termwise = measure(termwise_analog, state, args.repeats) + sparse_value, sparse = measure(sparse_analog, state, args.repeats) + target_termwise_value, target_termwise = measure( + htarget_mvp, state, args.repeats + ) + target_sparse_value, target_sparse = measure( + lambda y: K.sparse_dense_matmul(htarget_sparse, y), + state, + args.repeats, + ) + + report = { + "schema_version": 1, + "task_id": "06", + "jax_version": jax.__version__, + "jaxlib_version": jax.lib.__version__, + "state_shape": list(state.shape), + "construction": { + "tensorcircuit_coo_numpy_sec": scipy_build_sec, + "backend_sparse_convert_sec": backend_convert_sec, + "xy_nnz": int(hxy_coo.nnz), + "field_nnz": int(hfield_coo.nnz), + "target_nnz": int(htarget_coo.nnz), + }, + "analog_termwise": termwise, + "analog_sparse": sparse, + "analog_max_abs_error": float( + np.max(np.abs(np.asarray(termwise_value) - np.asarray(sparse_value))) + ), + "analog_steady_speedup": ( + termwise["steady_mean_sec"] / sparse["steady_mean_sec"] + ), + "target_termwise": target_termwise, + "target_sparse": target_sparse, + "target_max_abs_error": float( + np.max( + np.abs( + np.asarray(target_termwise_value) + - np.asarray(target_sparse_value) + ) + ) + ), + "target_steady_speedup": ( + target_termwise["steady_mean_sec"] / target_sparse["steady_mean_sec"] + ), + } + rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" + if args.output is not None: + args.output.write_text(rendered, encoding="utf-8") + print(rendered, end="") + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/research/profile_reference.py b/optimized_solutions/challenge-06/research/profile_reference.py new file mode 100644 index 0000000..d141656 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profile_reference.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +"""Profile the immutable Task 06 expert without changing its semantics.""" + +from __future__ import annotations + +import argparse +import importlib.util +import json +import math +import statistics +import time +from pathlib import Path +from typing import Any + +import jax +import optax + + +CONFIG = { + "n_qubits": 14, + "n_blocks": 4, + "t_min": 0.05, + "t_max": 0.50, + "ode_rtol": 1e-6, + "ode_atol": 1e-6, + "ode_max_steps": 16, + "max_steps": 100, + "learning_rate": 0.12, + "maximum_energy_density_gap": 1.0, +} + + +def load_reference(path: Path) -> Any: + spec = importlib.util.spec_from_file_location("task06_immutable_reference", path) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot import immutable reference: {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def ready(value: Any) -> Any: + return jax.tree.map( + lambda leaf: leaf.block_until_ready() + if hasattr(leaf, "block_until_ready") + else leaf, + value, + ) + + +def numeric_mapping(value: Any) -> dict[str, float | int | str]: + if not isinstance(value, dict): + return {"repr": str(value)} + result: dict[str, float | int | str] = {} + for key, item in value.items(): + if str(key) not in {"flops", "transcendentals", "bytes accessed"}: + continue + if isinstance(item, bool): + result[str(key)] = int(item) + elif isinstance(item, (int, float)) and math.isfinite(float(item)): + result[str(key)] = item + else: + result[str(key)] = str(item) + return result + + +def memory_mapping(value: Any) -> dict[str, int | str]: + if value is None: + return {} + result: dict[str, int | str] = {} + for name in dir(value): + if name.startswith("_"): + continue + item = getattr(value, name) + if isinstance(item, (int, float, str)): + result[name] = int(item) if isinstance(item, float) else item + return result or {"repr": str(value)} + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--reference", + type=Path, + default=Path("/workspace/references/task-06/solution_6.py"), + ) + parser.add_argument("--steady-steps", type=int, default=8) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + + started = time.perf_counter() + reference = load_reference(args.reference) + hxy, hfield, htarget = reference.build_hamiltonians(CONFIG) + psi0 = reference.initial_state(CONFIG) + params = reference.initial_parameters(CONFIG) + optimizer = optax.adam(CONFIG["learning_rate"]) + opt_state = optimizer.init(params) + setup_sec = time.perf_counter() - started + + def loss_fn(p: Any) -> Any: + return reference.forward(p, psi0, hxy, hfield, htarget, CONFIG) + + def train_step(p: Any, state: Any) -> tuple[Any, Any, Any]: + energy, grads = reference.K.value_and_grad(loss_fn)(p) + updates, state = optimizer.update(grads, state, p) + return optax.apply_updates(p, updates), state, energy + + analysis_step = reference.K.jit(train_step) + started = time.perf_counter() + lowered = analysis_step.lower(params, opt_state) + lower_sec = time.perf_counter() - started + started = time.perf_counter() + compiled = lowered.compile() + compile_sec = time.perf_counter() - started + + execution_step = reference.K.jit(train_step) + started = time.perf_counter() + params, opt_state, first_energy = ready(execution_step(params, opt_state)) + first_call_sec = time.perf_counter() - started + + steady: list[float] = [] + energies: list[float] = [] + for _ in range(args.steady_steps): + started = time.perf_counter() + params, opt_state, energy = ready(execution_step(params, opt_state)) + steady.append(time.perf_counter() - started) + energies.append(float(energy)) + + report = { + "schema_version": 1, + "task_id": "06", + "reference_path": str(args.reference), + "config": CONFIG, + "jax_version": jax.__version__, + "jaxlib_version": jax.lib.__version__, + "backend": jax.default_backend(), + "devices": [str(device) for device in jax.devices()], + "setup_sec": setup_sec, + "train_step": { + "lower_sec": lower_sec, + "compile_sec": compile_sec, + "first_call_compile_and_exec_sec": first_call_sec, + "first_energy_density": float(first_energy), + "steady_measurements": len(steady), + "steady_runtime_sec": steady, + "steady_mean_runtime_sec": statistics.mean(steady), + "steady_median_runtime_sec": statistics.median(steady), + "steady_stdev_runtime_sec": statistics.stdev(steady) + if len(steady) > 1 + else 0.0, + "projected_100_exec_sec": 100 * statistics.mean(steady), + "last_profile_energy_density": energies[-1], + "cost_analysis": numeric_mapping(compiled.cost_analysis()), + "memory_analysis": memory_mapping(compiled.memory_analysis()), + }, + } + rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" + if args.output is not None: + args.output.write_text(rendered, encoding="utf-8") + print(rendered, end="") + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json b/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json new file mode 100644 index 0000000..25bd7d2 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json @@ -0,0 +1,119 @@ +{ + "energy_abs_error": 9.5367431640625e-07, + "energy_gradient_current": { + "first_compile_and_exec_sec": 2.5818883830070263, + "steady_mean_sec": 0.0028042699981597253, + "steady_median_sec": 0.002786983495752793, + "steady_runtime_sec": [ + 0.0032408120023319498, + 0.0028979140042793006, + 0.0027680060011334717, + 0.002777129993773997, + 0.0028117949987063184, + 0.002841833993443288, + 0.002651470000273548, + 0.0027579229936236516, + 0.0027374240016797557, + 0.0027592559927143157, + 0.002817586006131023, + 0.0028222099936101586, + 0.0028002119943266734, + 0.0027968369977315888, + 0.0027248830010648817, + 0.0027986290078843012, + 0.0027597969892667606, + 0.002737131988396868, + 0.0028167529962956905, + 0.002767797006526962 + ] + }, + "energy_gradient_fused": { + "first_compile_and_exec_sec": 2.242138981993776, + "steady_mean_sec": 0.002792609501921106, + "steady_median_sec": 0.002764053009741474, + "steady_runtime_sec": [ + 0.0027992169925710186, + 0.002852089994121343, + 0.0027409290050854906, + 0.002958791999844834, + 0.0029233780078357086, + 0.0027565940108615905, + 0.002754344997811131, + 0.0027691360010067, + 0.0027502619923325256, + 0.0028245490102563053, + 0.002767595011391677, + 0.002734346009674482, + 0.002760511008091271, + 0.002830423996783793, + 0.0027319289947627112, + 0.0028684639983111992, + 0.0028882539918413386, + 0.002754428001935594, + 0.0027409710019128397, + 0.0026459760119905695 + ] + }, + "energy_gradient_steady_speedup": 1.004175483980341, + "gradient_max_abs_error": 9.653085726313293e-07, + "jax_version": "0.10.0", + "jaxlib_version": "0.10.0", + "schema_version": 1, + "state_current": { + "first_compile_and_exec_sec": 0.4338194299925817, + "steady_mean_sec": 0.0006850948993815109, + "steady_median_sec": 0.0006453139940276742, + "steady_runtime_sec": [ + 0.0012672960001509637, + 0.0007143719994928688, + 0.0006452929956139997, + 0.0006379190017469227, + 0.0006916650017956272, + 0.0006989149987930432, + 0.0007329130021389574, + 0.0006453349924413487, + 0.0007069979910738766, + 0.0006307110015768558, + 0.0006171279965201393, + 0.0006374190124915913, + 0.0006193779991008341, + 0.0006167949904920533, + 0.0006572090060217306, + 0.0006267519929679111, + 0.0006608340045204386, + 0.0006484180048573762, + 0.0006112959963502362, + 0.0006352519994834438 + ] + }, + "state_fused": { + "first_compile_and_exec_sec": 0.44715598500624765, + "steady_mean_sec": 0.0006617616993025877, + "steady_median_sec": 0.0006494810004369356, + "steady_runtime_sec": [ + 0.0006994580035097897, + 0.0006269619916565716, + 0.0006670839939033613, + 0.0007521209918195382, + 0.0006388780020643026, + 0.0006632510048802942, + 0.0006493349937954918, + 0.0008115750097204, + 0.0006499190058093518, + 0.0006379200058290735, + 0.0006113380077295005, + 0.0006253359897527844, + 0.0006063379987608641, + 0.0006228779966477305, + 0.000664334002067335, + 0.0006251279992284253, + 0.0006391279894160107, + 0.0006893749959999695, + 0.0007052489963825792, + 0.0006496270070783794 + ] + }, + "state_max_abs_error": 8.940696716308594e-08, + "state_steady_speedup": 1.035259218089402, + "task_id": "06" +} diff --git a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json new file mode 100644 index 0000000..c467589 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:46:06.470360+00:00", + "finished_at_utc": "2026-07-29T01:46:29.130306+00:00", + "session_wall_sec": 22.659780916001182, + "configuration": { + "repeat": 1, + "max_steps": 10, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 10, + "runtime_sec": 10.912746, + "wall_sec": 12.421574042004067, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", + "container_name": "orbit-task06-matrix-1678675a15", + "shared_container_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", + "shared_container_name": "orbit-task06-matrix-1678675a15", + "shared_session_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-1678675a15", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-y8o0zxpr,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-1678675a15", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "10" + ], + "source_sha256": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "9bca6e59017ae36a8ad4682e7628b1a2516c859746b66d3749145d7517544327", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 10.912746, + "median": 10.912746, + "sample_stdev": null, + "stderr": null, + "min": 10.912746, + "max": 10.912746 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json new file mode 100644 index 0000000..a53c5ee --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:46:45.206152+00:00", + "finished_at_utc": "2026-07-29T01:47:39.521547+00:00", + "session_wall_sec": 54.31520862499019, + "configuration": { + "repeat": 1, + "max_steps": 100, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 100, + "runtime_sec": 42.412637, + "wall_sec": 44.00417716699303, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", + "container_name": "orbit-task06-matrix-555a9004bd", + "shared_container_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", + "shared_container_name": "orbit-task06-matrix-555a9004bd", + "shared_session_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-555a9004bd", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-gqr53rrw,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-555a9004bd", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "100" + ], + "source_sha256": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "ac98e83525a787b1b643f40128cf1b3ebfc4fbcd026b89e2ede379c3fd8a7db0", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 42.412637, + "median": 42.412637, + "sample_stdev": null, + "stderr": null, + "min": 42.412637, + "max": 42.412637 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json new file mode 100644 index 0000000..1198f7d --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:48:47.720756+00:00", + "finished_at_utc": "2026-07-29T01:49:09.691268+00:00", + "session_wall_sec": 21.970367166009964, + "configuration": { + "repeat": 1, + "max_steps": 10, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 10, + "runtime_sec": 10.402433, + "wall_sec": 11.776270124973962, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", + "container_name": "orbit-task06-matrix-8653aabf4f", + "shared_container_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", + "shared_container_name": "orbit-task06-matrix-8653aabf4f", + "shared_session_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-8653aabf4f", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-p3j07258,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-8653aabf4f", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "10" + ], + "source_sha256": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "4d0f501b6a6bf69a6141ab7de8037c4c6e3a49f040db86aa6eb6937767199424", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 10.402433, + "median": 10.402433, + "sample_stdev": null, + "stderr": null, + "min": 10.402433, + "max": 10.402433 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json new file mode 100644 index 0000000..a61512a --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:49:21.738837+00:00", + "finished_at_utc": "2026-07-29T01:50:15.782750+00:00", + "session_wall_sec": 54.043716875021346, + "configuration": { + "repeat": 1, + "max_steps": 100, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 100, + "runtime_sec": 42.361953, + "wall_sec": 43.83974287498859, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", + "container_name": "orbit-task06-matrix-1025121759", + "shared_container_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", + "shared_container_name": "orbit-task06-matrix-1025121759", + "shared_session_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-1025121759", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lxykqd57,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-1025121759", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "100" + ], + "source_sha256": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "5a25cb9d6cdab4f5050535db7374843b6aa6ee0ea1e6f68e4bf5d88e725a545e", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 42.361953, + "median": 42.361953, + "sample_stdev": null, + "stderr": null, + "min": 42.361953, + "max": 42.361953 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json b/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json new file mode 100644 index 0000000..b52a762 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json @@ -0,0 +1,64 @@ +{ + "schema_version": 1, + "task_id": "06", + "recorded_at_utc": "2026-07-29T05:13:09.636685+00:00", + "purpose": "Final five-pair canonical reference-versus-e03 benchmark", + "configuration": { + "repeat": 5, + "max_steps": 100, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true, + "network": "none" + }, + "provenance": { + "image_id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "reference_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "raw_results_sha256": "a7488be88dd1faae070fb7b3efc51564f86fc9a55b51e835a71e9b029fe77a82" + }, + "reference_runtime_sec": [ + 41.389616, + 41.389259, + 41.441489, + 41.58251, + 41.326743 + ], + "candidate_runtime_sec": [ + 27.290641, + 27.643293, + 27.625098, + 27.380896, + 27.743136 + ], + "paired_speedup": [ + 1.516623079685083, + 1.4972622473017236, + 1.5001390764297016, + 1.5186687097456562, + 1.489620459633691 + ], + "summary": { + "reference_mean_sec": 41.4259234, + "reference_stderr_sec": 0.0431630129, + "candidate_mean_sec": 27.5366128, + "candidate_stderr_sec": 0.0856188716, + "ratio_of_means": 1.5043943023, + "mean_paired_speedup": 1.5044627146, + "paired_speedup_stderr": 0.0056591425, + "paired_speedup_95pct_t_ci": [ + 1.488750416, + 1.5201750132 + ], + "runtime_reduction_pct": 33.528065, + "candidate_wins": 5, + "pairs": 5, + "reference_passes": 5, + "candidate_passes": 5 + }, + "runner_note": "The campaign runner's legacy promotion booleans require a six-run known-hash gate. They are inapplicable to this user-requested five-pair comparison; all ten functional benchmark cells passed." +} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json new file mode 100644 index 0000000..420b046 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:51:29.233361+00:00", + "finished_at_utc": "2026-07-29T01:51:47.822468+00:00", + "session_wall_sec": 18.588953124999534, + "configuration": { + "repeat": 1, + "max_steps": 10, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 10, + "runtime_sec": 6.866093, + "wall_sec": 8.333335624978645, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", + "container_name": "orbit-task06-matrix-d3469ba8f8", + "shared_container_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", + "shared_container_name": "orbit-task06-matrix-d3469ba8f8", + "shared_session_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-d3469ba8f8", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-yw5yu1ly,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-d3469ba8f8", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "10" + ], + "source_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "4da24031dcf2d6ee85ee9c90058d2084228bd276dee626ffbdc774bac6c49ede", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 6.866093, + "median": 6.866093, + "sample_stdev": null, + "stderr": null, + "min": 6.866093, + "max": 6.866093 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json new file mode 100644 index 0000000..9998fc2 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json @@ -0,0 +1,177 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:51:59.361264+00:00", + "finished_at_utc": "2026-07-29T01:52:38.828867+00:00", + "session_wall_sec": 39.46743862499716, + "configuration": { + "repeat": 1, + "max_steps": 100, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "candidate", + "task_id": "06", + "solution": "candidate", + "repeat": 1, + "repeat_index": 1, + "planned_repeats": 1, + "max_steps": 100, + "runtime_sec": 27.747994, + "wall_sec": 29.234428791998653, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", + "container_name": "orbit-task06-matrix-47927c0928", + "shared_container_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", + "shared_container_name": "orbit-task06-matrix-47927c0928", + "shared_session_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-47927c0928", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-tkhc19qz,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-47927c0928", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_candidate", + "--max-steps", + "100" + ], + "source_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-candidate.stdout.txt", + "stderr_path": "logs/cell-01-candidate.stderr.txt", + "stdout_sha256": "b65485324870eafe60699c5dedc2ce6e46f3c36130ede8bdbf70b15b34e27854", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "candidate": { + "n": 1, + "mean": 27.747994, + "median": 27.747994, + "sample_stdev": null, + "stderr": null, + "min": 27.747994, + "max": 27.747994 + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": false, + "candidate_screen_rule_passed": true + } +} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json new file mode 100644 index 0000000..4b5aa3b --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json @@ -0,0 +1,27 @@ +{ + "candidate": "/workspace/src/solutions/task-06/solution_6.py", + "gradient_max_abs_error": { + "tolerance": 0.0005, + "value": 3.3795833587646484e-05 + }, + "initial_energy": { + "abs_error": 7.3909759521484375e-06, + "candidate": -0.5182192325592041, + "reference": -0.5182266235351562, + "tolerance": 5e-05 + }, + "initial_parameter_max_abs_error": 0.0, + "jax_version": "0.10.0", + "jaxlib_version": "0.10.0", + "passed": true, + "post_update_energy": { + "abs_error": 4.76837158203125e-07, + "candidate": -0.5604710578918457, + "reference": -0.5604715347290039, + "tolerance": 0.002 + }, + "post_update_parameter_max_abs_error": 2.9802322387695312e-08, + "reference": "/workspace/references/task-06/solution_6.py", + "schema_version": 1, + "task_id": "06" +} diff --git a/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json b/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json new file mode 100644 index 0000000..5610480 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json @@ -0,0 +1,128 @@ +{ + "analog_max_abs_error": 8.713252341863154e-09, + "analog_sparse": { + "first_compile_and_exec_sec": 0.08943686699785758, + "steady_mean_sec": 0.0008518971015291754, + "steady_median_sec": 0.0008482765042572282, + "steady_runtime_sec": [ + 0.0008858420042088255, + 0.0008393379976041615, + 0.0008360450010513887, + 0.000844755006255582, + 0.0008725490042706951, + 0.0008274620049633086, + 0.000855839010910131, + 0.0008237099973484874, + 0.0008112089999485761, + 0.0008252120023826137, + 0.0008550060010747984, + 0.0008262940100394189, + 0.0008593389939051121, + 0.0009520580060780048, + 0.0008142509905155748, + 0.0008607979980297387, + 0.0009232209995388985, + 0.0008520889969076961, + 0.0008517980022588745, + 0.0008211270032916218 + ] + }, + "analog_steady_speedup": 0.29338073819903326, + "analog_termwise": { + "first_compile_and_exec_sec": 0.17884002199571114, + "steady_mean_sec": 0.0002499302005162463, + "steady_median_sec": 0.00024769250012468547, + "steady_runtime_sec": [ + 0.00027211201086174697, + 0.00025540099886711687, + 0.00027344500995241106, + 0.00024927599588409066, + 0.00024569300876464695, + 0.00023527500161435455, + 0.0002456090005580336, + 0.00024610898981336504, + 0.00023514899658039212, + 0.00025477699819020927, + 0.0002434419875498861, + 0.0002498179965186864, + 0.0002512759965611622, + 0.0002601100131869316, + 0.00023652399249840528, + 0.0002437759976601228, + 0.0002396500058239326, + 0.00025940200430341065, + 0.00024610900436528027, + 0.0002556510007707402 + ] + }, + "construction": { + "backend_sparse_convert_sec": 0.0016592979955021292, + "field_nnz": 12952, + "target_nnz": 229376, + "tensorcircuit_coo_numpy_sec": 0.4132378780050203, + "xy_nnz": 212992 + }, + "jax_version": "0.10.0", + "jaxlib_version": "0.10.0", + "schema_version": 1, + "state_shape": [ + 16384 + ], + "target_max_abs_error": 1.9073486328125e-06, + "target_sparse": { + "first_compile_and_exec_sec": 0.07549469900550321, + "steady_mean_sec": 0.001209446798748104, + "steady_median_sec": 0.0011963539946009405, + "steady_runtime_sec": [ + 0.0013805189955746755, + 0.0012033749953843653, + 0.001289592997636646, + 0.0011987079924438149, + 0.0011907490115845576, + 0.0011937499948544428, + 0.0012134599965065718, + 0.0011802899971371517, + 0.001178746999357827, + 0.0011966249876422808, + 0.0011960830015596002, + 0.0012055010010953993, + 0.001218627003254369, + 0.001236128999153152, + 0.0011803310044342652, + 0.0012083759938832372, + 0.0011735389998648316, + 0.0011857479985337704, + 0.0011812890006694943, + 0.0011774970043916255 + ] + }, + "target_steady_speedup": 0.28472947313686203, + "target_termwise": { + "first_compile_and_exec_sec": 0.18091756899957545, + "steady_mean_sec": 0.00034436514979461206, + "steady_median_sec": 0.00034241149842273444, + "steady_runtime_sec": [ + 0.00036133000685367733, + 0.0003928320074919611, + 0.00034616100310813636, + 0.0003495779965305701, + 0.00035653699887916446, + 0.00032990999170579016, + 0.00033732700103428215, + 0.0003459529980318621, + 0.0003472440002951771, + 0.00033341000380460173, + 0.00034107700048480183, + 0.0003434529935475439, + 0.00034145299287047237, + 0.00035295300767757, + 0.00033670099219307303, + 0.0003222840023227036, + 0.0003433700039749965, + 0.000333075993694365, + 0.000333243006025441, + 0.0003394109953660518 + ] + }, + "task_id": "06" +} diff --git a/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json b/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json new file mode 100644 index 0000000..85505a7 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json @@ -0,0 +1,637 @@ +{ + "schema_version": 1, + "task_id": "06", + "started_at_utc": "2026-07-29T01:29:10.211307+00:00", + "finished_at_utc": "2026-07-29T01:34:01.556945+00:00", + "session_wall_sec": 291.34517045799294, + "configuration": { + "repeat": 6, + "max_steps": 100, + "timeout_sec": 300.0, + "cpus": 6.0, + "memory": "7g", + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": true, + "single_container": true + }, + "host": { + "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", + "cpu": "Apple M2", + "physical_memory": "17179869184", + "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" + }, + "image": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "snapshot": { + "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "candidate": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" + }, + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "results": [ + { + "cell_id": "task06-01", + "pair": 1, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 1, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 43.9766, + "wall_sec": 45.8386168750003, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-01-reference.stdout.txt", + "stderr_path": "logs/cell-01-reference.stderr.txt", + "stdout_sha256": "46ecdcb6d91fea140065df6933b0baf5767f445028b51460ac596a6dc2259148", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 1, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + }, + { + "cell_id": "task06-02", + "pair": 2, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 2, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 45.097434, + "wall_sec": 46.916985250019934, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-02-reference.stdout.txt", + "stderr_path": "logs/cell-02-reference.stderr.txt", + "stdout_sha256": "2d569f1ecc51e83d7cc30396a3cac12f44b9bef149affd6a8d6d6344cab60629", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 2, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + }, + { + "cell_id": "task06-03", + "pair": 3, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 3, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 44.415753, + "wall_sec": 46.19435454098857, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-03-reference.stdout.txt", + "stderr_path": "logs/cell-03-reference.stderr.txt", + "stdout_sha256": "18b7f74580a7cecba355cee577ecd7a317894cff6748c50ab0c8ef5d1a1db98d", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 3, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + }, + { + "cell_id": "task06-04", + "pair": 4, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 4, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 44.864424, + "wall_sec": 46.61729741698946, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-04-reference.stdout.txt", + "stderr_path": "logs/cell-04-reference.stderr.txt", + "stdout_sha256": "b3540a887487f023ccb9efcdf0b0b91868fa6d05517dba88d3c62981d221841d", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 4, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + }, + { + "cell_id": "task06-05", + "pair": 5, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 5, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 45.4811, + "wall_sec": 47.27104333299212, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-05-reference.stdout.txt", + "stderr_path": "logs/cell-05-reference.stderr.txt", + "stdout_sha256": "badeda14bfce7660b4e609e8e7ce8f278aef28a7498608e1a7761c8c0abd2205", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 5, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + }, + { + "cell_id": "task06-06", + "pair": 6, + "position": 1, + "order": "reference", + "task_id": "06", + "solution": "reference", + "repeat_index": 6, + "planned_repeats": 6, + "max_steps": 100, + "runtime_sec": 46.387673, + "wall_sec": 48.185412082995754, + "passed": true, + "timed_out": false, + "terminal_status": "SUCCESS", + "returncode": 0, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": { + "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "repo_digests": [ + "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", + "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" + ], + "created": "2026-07-27T22:15:05.362478611+08:00", + "architecture": "arm64", + "os": "linux" + }, + "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "container_name": "orbit-task06-matrix-07a53e9280", + "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_name": "orbit-task06-matrix-07a53e9280", + "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", + "shared_container_start_command": [ + "docker", + "run", + "--detach", + "--rm", + "--name", + "orbit-task06-matrix-07a53e9280", + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + "6.0", + "--memory", + "7g", + "orbitbreakers-expert-benchmarks:tensorcircuit-py311", + "tail", + "-f", + "/dev/null" + ], + "cpu_limit": "6.0", + "memory_limit": "7g", + "timeout_sec": 300.0, + "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", + "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", + "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", + "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", + "stdout_path": "logs/cell-06-reference.stdout.txt", + "stderr_path": "logs/cell-06-reference.stderr.txt", + "stdout_sha256": "35161dd3fcb325d66ea4d882fff072eb107b19ea814dd4b5d5e08b2e31f47267", + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "repeat": 6, + "command": [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "orbit-task06-matrix-07a53e9280", + "python", + "/session/evaluate_6.py", + "--solution", + "solution_6_reference", + "--max-steps", + "100" + ] + } + ], + "pairs": [], + "summary": { + "all_cells_passed": true, + "reference": { + "n": 6, + "mean": 45.037164, + "median": 44.980929, + "sample_stdev": 0.8444374388542941, + "stderr": 0.34474014081594845, + "min": 43.9766, + "max": 46.387673 + }, + "candidate": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "ratio_of_means_speedup": null, + "ratio_of_means_improvement_pct": null, + "paired_speedup": { + "n": 0, + "mean": null, + "median": null, + "sample_stdev": null, + "stderr": null, + "min": null, + "max": null + }, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": null, + "high": null + }, + "candidate_wins": 0, + "promotion_rule_passed": false, + "reference_baseline_rule_passed": true + }, + "recovery_note": "The runner omitted the repeat alias and exact docker-exec command from serialized rows; both fields were deterministically reconstructed from the unmodified checkpoint rows after all six raw logs and measurements completed. No runtime, status, hash, order, or output value changed." +} diff --git a/optimized_solutions/challenge-06/research/profiles/reference-profile.json b/optimized_solutions/challenge-06/research/profiles/reference-profile.json new file mode 100644 index 0000000..803c929 --- /dev/null +++ b/optimized_solutions/challenge-06/research/profiles/reference-profile.json @@ -0,0 +1,64 @@ +{ + "backend": "cpu", + "config": { + "learning_rate": 0.12, + "max_steps": 100, + "maximum_energy_density_gap": 1.0, + "n_blocks": 4, + "n_qubits": 14, + "ode_atol": 1e-06, + "ode_max_steps": 16, + "ode_rtol": 1e-06, + "t_max": 0.5, + "t_min": 0.05 + }, + "devices": [ + "cpu:0" + ], + "jax_version": "0.10.0", + "jaxlib_version": "0.10.0", + "reference_path": "/workspace/references/task-06/solution_6.py", + "schema_version": 1, + "setup_sec": 0.25592545000836253, + "task_id": "06", + "train_step": { + "compile_sec": 3.194720548999612, + "cost_analysis": { + "bytes accessed": 101158672.0, + "flops": 23524274.0, + "transcendentals": 525.0 + }, + "first_call_compile_and_exec_sec": 0.2790715420123888, + "first_energy_density": -0.5182266235351562, + "last_profile_energy_density": -1.1060307025909424, + "lower_sec": 2.851042841997696, + "memory_analysis": { + "alias_size_in_bytes": 0, + "argument_size_in_bytes": 2164, + "generated_code_size_in_bytes": 0, + "host_alias_size_in_bytes": 0, + "host_argument_size_in_bytes": 0, + "host_generated_code_size_in_bytes": 0, + "host_output_size_in_bytes": 0, + "host_temp_size_in_bytes": 0, + "output_size_in_bytes": 2280, + "peak_memory_in_bytes": 137809, + "temp_size_in_bytes": 18776480 + }, + "projected_100_exec_sec": 28.050100437576475, + "steady_mean_runtime_sec": 0.28050100437576475, + "steady_measurements": 8, + "steady_median_runtime_sec": 0.27417020649590995, + "steady_runtime_sec": [ + 0.2754821550042834, + 0.2717890040075872, + 0.2721566330001224, + 0.2728582579875365, + 0.27139141800580546, + 0.2921714349940885, + 0.2921290020021843, + 0.2960301300045103 + ], + "steady_stdev_runtime_sec": 0.010854067648848095 + } +} diff --git a/optimized_solutions/challenge-06/research/run_docker_matrix.py b/optimized_solutions/challenge-06/research/run_docker_matrix.py new file mode 100644 index 0000000..5a62592 --- /dev/null +++ b/optimized_solutions/challenge-06/research/run_docker_matrix.py @@ -0,0 +1,463 @@ +#!/usr/bin/env python3 +"""Run Task 06 reference baselines or counterbalanced pairs in one container.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import re +import shutil +import statistics +import subprocess +import tempfile +import time +import uuid +from datetime import datetime, timezone +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[2] +RUNTIME_RE = re.compile(r"End-to-end solution time:\s*([0-9.]+)s") +T_CRITICAL_95 = { + 4: 2.7764451052, + 5: 2.5705818366, +} + + +def sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def utc_now() -> str: + return datetime.now(timezone.utc).isoformat() + + +def run(command: list[str], timeout: float = 30) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + check=False, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + timeout=timeout, + ) + + +def stats(values: list[float]) -> dict[str, float | int | None]: + stdev = statistics.stdev(values) if len(values) > 1 else None + return { + "n": len(values), + "mean": statistics.mean(values) if values else None, + "median": statistics.median(values) if values else None, + "sample_stdev": stdev, + "stderr": stdev / math.sqrt(len(values)) if stdev is not None else None, + "min": min(values) if values else None, + "max": max(values) if values else None, + } + + +def host_record() -> dict[str, object]: + commands = { + "uname": ["uname", "-a"], + "cpu": ["sysctl", "-n", "machdep.cpu.brand_string"], + "physical_memory": ["sysctl", "-n", "hw.memsize"], + } + record: dict[str, object] = {} + for key, command in commands.items(): + try: + result = run(command) + record[key] = result.stdout.strip() if result.returncode == 0 else None + except (OSError, subprocess.TimeoutExpired): + record[key] = None + record["fingerprint_sha256"] = hashlib.sha256( + json.dumps(record, sort_keys=True).encode() + ).hexdigest() + return record + + +def image_record(reference: str) -> dict[str, object]: + result = run(["docker", "image", "inspect", reference]) + if result.returncode: + raise RuntimeError(result.stderr.strip() or f"cannot inspect {reference}") + raw = json.loads(result.stdout)[0] + return { + "reference": reference, + "id": raw.get("Id"), + "repo_digests": raw.get("RepoDigests") or [], + "created": raw.get("Created"), + "architecture": raw.get("Architecture"), + "os": raw.get("Os"), + } + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument("--repeat", type=int, default=6) + parser.add_argument("--max-steps", type=int, default=100) + parser.add_argument("--timeout", type=float, default=300.0) + parser.add_argument("--cpus", type=float, default=6.0) + parser.add_argument("--memory", default="7g") + parser.add_argument( + "--reference-only", + action="store_true", + help="Run only the immutable expert; useful for the six-run baseline gate.", + ) + parser.add_argument( + "--candidate-only", + action="store_true", + help="Run only the editable candidate for reduced or canonical screening.", + ) + parser.add_argument( + "--image", + default="orbitbreakers-expert-benchmarks:tensorcircuit-py311", + ) + parser.add_argument("--output", type=Path, required=True) + return parser.parse_args() + + +def main() -> None: + args = parse_args() + if args.repeat <= 0 or args.max_steps <= 0: + raise SystemExit("repeat and max-steps must be positive") + if args.reference_only and args.candidate_only: + raise SystemExit("reference-only and candidate-only are mutually exclusive") + timeout = min(args.timeout, 300.0) + output = args.output.expanduser().resolve() + logs = output / "logs" + logs.mkdir(parents=True, exist_ok=True) + + sources = { + "reference": ROOT / "references/task-06/solution_6.py", + "candidate": ROOT / "src/solutions/task-06/solution_6.py", + } + evaluator = ROOT / "tasks/task-06/evaluator/evaluate_6.py" + sitecustomize = ROOT / "envs/tensorcircuit-py311/sitecustomize.py" + for path in [*sources.values(), evaluator, sitecustomize]: + if not path.is_file(): + raise SystemExit(f"missing required file: {path}") + + image = image_record(args.image) + host = host_record() + container_name = f"orbit-task06-matrix-{uuid.uuid4().hex[:10]}" + started_at = utc_now() + session_started = time.perf_counter() + rows: list[dict[str, object]] = [] + + staging_root = ROOT / ".tmp" + staging_root.mkdir(exist_ok=True) + with tempfile.TemporaryDirectory(prefix="task06-matrix-", dir=staging_root) as tmp: + staging = Path(tmp) + shutil.copy2(evaluator, staging / "evaluate_6.py") + environment = staging / "environment" + environment.mkdir() + shutil.copy2(sitecustomize, environment / "sitecustomize.py") + modules: dict[str, str] = {} + snapshot: dict[str, str] = {} + for role, source in sources.items(): + module = f"solution_6_{role}" + modules[role] = module + target = staging / f"{module}.py" + shutil.copy2(source, target) + snapshot[role] = sha256(target) + snapshot["evaluator"] = sha256(staging / "evaluate_6.py") + snapshot["sitecustomize"] = sha256(environment / "sitecustomize.py") + snapshot_sha256 = hashlib.sha256( + json.dumps(snapshot, sort_keys=True).encode() + ).hexdigest() + + start_command = [ + "docker", + "run", + "--detach", + "--rm", + "--name", + container_name, + "--network", + "none", + "--tmpfs", + "/tmp:rw,noexec,nosuid,size=1g", + "--mount", + f"type=bind,src={staging.resolve()},dst=/session,readonly", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + "--cpus", + str(args.cpus), + "--memory", + args.memory, + args.image, + "tail", + "-f", + "/dev/null", + ] + started = run(start_command, timeout=60) + if started.returncode: + raise SystemExit(started.stderr.strip() or "container start failed") + container_id = started.stdout.strip() + + plan: list[tuple[int, int, str, str]] = [] + for pair in range(1, args.repeat + 1): + if args.reference_only: + roles = ("reference",) + elif args.candidate_only: + roles = ("candidate",) + else: + roles = ( + ("reference", "candidate") + if pair % 2 + else ("candidate", "reference") + ) + order = "->".join(roles) + for position, role in enumerate(roles, start=1): + plan.append((pair, position, role, order)) + + try: + for cell, (pair, position, role, order) in enumerate(plan, start=1): + command = [ + "docker", + "exec", + "--workdir", + "/session", + "--env", + "NUMBA_DISABLE_JIT=1", + "--env", + "PYTHONPATH=/session:/session/environment", + container_name, + "python", + "/session/evaluate_6.py", + "--solution", + modules[role], + "--max-steps", + str(args.max_steps), + ] + wall_started = time.perf_counter() + timed_out = False + try: + result = run(command, timeout=timeout) + stdout, stderr, returncode = ( + result.stdout, + result.stderr, + result.returncode, + ) + except subprocess.TimeoutExpired as exc: + timed_out = True + stdout = exc.stdout or "" + stderr = exc.stderr or "" + returncode = None + wall_sec = time.perf_counter() - wall_started + stdout_path = logs / f"cell-{cell:02d}-{role}.stdout.txt" + stderr_path = logs / f"cell-{cell:02d}-{role}.stderr.txt" + stdout_path.write_text(stdout, encoding="utf-8") + stderr_path.write_text(stderr, encoding="utf-8") + match = RUNTIME_RE.search(stdout) + runtime = float(match.group(1)) if match else None + passed = ( + not timed_out + and returncode == 0 + and runtime is not None + and "Overall: PASS" in stdout + ) + row = { + "cell_id": f"task06-{cell:02d}", + "pair": pair, + "position": position, + "order": order, + "task_id": "06", + "solution": role, + "repeat": pair, + "repeat_index": pair, + "planned_repeats": args.repeat, + "max_steps": args.max_steps, + "runtime_sec": runtime, + "wall_sec": wall_sec, + "passed": passed, + "timed_out": timed_out, + "terminal_status": "SUCCESS" if passed else "FAILED", + "returncode": returncode, + "engine": "docker", + "environment": "tensorcircuit-py311", + "environment_image_provenance": image, + "container_id": container_id, + "container_name": container_name, + "shared_container_id": container_id, + "shared_container_name": container_name, + "shared_session_id": container_id, + "shared_container_start_command": start_command, + "cpu_limit": str(args.cpus), + "memory_limit": args.memory, + "timeout_sec": timeout, + "command": command, + "source_sha256": snapshot[role], + "evaluator_sha256": snapshot["evaluator"], + "staging_snapshot_sha256": snapshot_sha256, + "compatibility_sha256": snapshot["sitecustomize"], + "stdout_path": str(stdout_path.relative_to(output)), + "stderr_path": str(stderr_path.relative_to(output)), + "stdout_sha256": sha256(stdout_path), + "stderr_sha256": sha256(stderr_path), + } + rows.append(row) + (output / "checkpoint.json").write_text( + json.dumps( + { + "schema_version": 1, + "task_id": "06", + "configuration": { + "repeat": args.repeat, + "max_steps": args.max_steps, + "cpus": args.cpus, + "memory": args.memory, + }, + "host": host, + "image": image, + "snapshot": snapshot, + "staging_snapshot_sha256": snapshot_sha256, + "results": rows, + }, + indent=2, + ) + + "\n", + encoding="utf-8", + ) + print( + f"cell {cell:02d}/{len(plan)} pair={pair} role={role} " + f"runtime={runtime} passed={passed}", + flush=True, + ) + finally: + run(["docker", "stop", container_name], timeout=60) + + reference = [ + float(row["runtime_sec"]) + for row in rows + if row["solution"] == "reference" and row["passed"] + ] + candidate = [ + float(row["runtime_sec"]) + for row in rows + if row["solution"] == "candidate" and row["passed"] + ] + by_pair: dict[int, dict[str, float]] = {} + for row in rows: + if row["passed"]: + by_pair.setdefault(int(row["pair"]), {})[str(row["solution"])] = float( + row["runtime_sec"] + ) + pair_rows = [] + speedups = [] + for pair in sorted(by_pair): + values = by_pair[pair] + if set(values) == {"reference", "candidate"}: + speedup = values["reference"] / values["candidate"] + speedups.append(speedup) + pair_rows.append( + { + "pair": pair, + "reference_runtime_sec": values["reference"], + "candidate_runtime_sec": values["candidate"], + "speedup": speedup, + "candidate_won": values["candidate"] < values["reference"], + } + ) + + speedup_stats = stats(speedups) + ci_low = ci_high = None + if len(speedups) > 1: + critical = T_CRITICAL_95.get(len(speedups) - 1) + if critical is not None: + radius = critical * float(speedup_stats["stderr"]) + ci_low = float(speedup_stats["mean"]) - radius + ci_high = float(speedup_stats["mean"]) + radius + ref_stats, cand_stats = stats(reference), stats(candidate) + single_role = args.reference_only or args.candidate_only + expected_cells = args.repeat if single_role else 2 * args.repeat + all_passed = len(rows) == expected_cells and all(row["passed"] for row in rows) + promotion = ( + not single_role + and all_passed + and len(speedups) == args.repeat + and float(cand_stats["mean"]) < float(ref_stats["mean"]) + and float(cand_stats["median"]) < float(ref_stats["median"]) + and sum(row["candidate_won"] for row in pair_rows) + >= math.ceil(0.8 * args.repeat) + and ci_low is not None + and ci_low > 1.0 + ) + report = { + "schema_version": 1, + "task_id": "06", + "started_at_utc": started_at, + "finished_at_utc": utc_now(), + "session_wall_sec": time.perf_counter() - session_started, + "configuration": { + "repeat": args.repeat, + "max_steps": args.max_steps, + "timeout_sec": timeout, + "cpus": args.cpus, + "memory": args.memory, + "pair_order": "odd reference->candidate; even candidate->reference", + "fresh_evaluator_process_per_cell": True, + "single_container": True, + }, + "host": host, + "image": image, + "snapshot": snapshot, + "staging_snapshot_sha256": snapshot_sha256, + "results": rows, + "pairs": pair_rows, + "summary": { + "all_cells_passed": all_passed, + "reference": ref_stats, + "candidate": cand_stats, + "ratio_of_means_speedup": ( + float(ref_stats["mean"]) / float(cand_stats["mean"]) + if reference and candidate + else None + ), + "ratio_of_means_improvement_pct": ( + 100 + * (float(ref_stats["mean"]) - float(cand_stats["mean"])) + / float(ref_stats["mean"]) + if reference and candidate + else None + ), + "paired_speedup": speedup_stats, + "paired_speedup_ci_95": { + "method": "two-sided Student-t interval on mean pairwise speedup", + "low": ci_low, + "high": ci_high, + }, + "candidate_wins": sum(row["candidate_won"] for row in pair_rows), + "promotion_rule_passed": promotion, + "reference_baseline_rule_passed": ( + args.reference_only + and all_passed + and len(reference) == args.repeat + and args.repeat >= 6 + ), + "candidate_screen_rule_passed": ( + args.candidate_only and all_passed and len(candidate) == args.repeat + ), + }, + } + (output / "results.json").write_text( + json.dumps(report, indent=2) + "\n", encoding="utf-8" + ) + print(json.dumps(report["summary"], indent=2), flush=True) + if args.reference_only: + if not report["summary"]["reference_baseline_rule_passed"]: + raise SystemExit(1) + elif args.candidate_only: + if not report["summary"]["candidate_screen_rule_passed"]: + raise SystemExit(1) + elif not promotion: + raise SystemExit(1) + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py b/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py new file mode 100644 index 0000000..f267864 --- /dev/null +++ b/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Compare Task 06 reference/candidate energy, gradient, and one Adam update.""" + +from __future__ import annotations + +import argparse +import importlib.util +import json +from pathlib import Path +from typing import Any + +import jax +import numpy as np +import optax + +from profile_reference import CONFIG, ready + + +def load_module(name: str, path: Path) -> Any: + spec = importlib.util.spec_from_file_location(name, path) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot import {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def loss_factory(module: Any) -> tuple[Any, Any]: + hxy, hfield, htarget = module.build_hamiltonians(CONFIG) + psi0 = module.initial_state(CONFIG) + params = module.initial_parameters(CONFIG) + + def loss(p: Any) -> Any: + return module.forward(p, psi0, hxy, hfield, htarget, CONFIG) + + return params, loss + + +def tree_max_abs_difference(left: Any, right: Any) -> float: + differences = [ + np.max(np.abs(np.asarray(a) - np.asarray(b))) + for a, b in zip(jax.tree.leaves(left), jax.tree.leaves(right)) + ] + return float(max(differences, default=0.0)) + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--reference", + type=Path, + default=Path("/workspace/references/task-06/solution_6.py"), + ) + parser.add_argument( + "--candidate", + type=Path, + default=Path("/workspace/src/solutions/task-06/solution_6.py"), + ) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + + reference = load_module("task06_reference_audit", args.reference) + candidate = load_module("task06_candidate_audit", args.candidate) + reference_params, reference_loss = loss_factory(reference) + candidate_params, candidate_loss = loss_factory(candidate) + + reference_energy, reference_grads = ready( + jax.jit(jax.value_and_grad(reference_loss))(reference_params) + ) + candidate_energy, candidate_grads = ready( + jax.jit(jax.value_and_grad(candidate_loss))(candidate_params) + ) + + optimizer = optax.adam(CONFIG["learning_rate"]) + reference_state = optimizer.init(reference_params) + candidate_state = optimizer.init(candidate_params) + reference_updates, reference_state = optimizer.update( + reference_grads, reference_state, reference_params + ) + candidate_updates, candidate_state = optimizer.update( + candidate_grads, candidate_state, candidate_params + ) + reference_post_params = optax.apply_updates( + reference_params, reference_updates + ) + candidate_post_params = optax.apply_updates( + candidate_params, candidate_updates + ) + reference_post_energy = ready(jax.jit(reference_loss)(reference_post_params)) + candidate_post_energy = ready(jax.jit(candidate_loss)(candidate_post_params)) + + report = { + "schema_version": 1, + "task_id": "06", + "reference": str(args.reference), + "candidate": str(args.candidate), + "jax_version": jax.__version__, + "jaxlib_version": jax.lib.__version__, + "initial_parameter_max_abs_error": tree_max_abs_difference( + reference_params, candidate_params + ), + "initial_energy": { + "reference": float(reference_energy), + "candidate": float(candidate_energy), + "abs_error": abs(float(reference_energy) - float(candidate_energy)), + "tolerance": 5e-5, + }, + "gradient_max_abs_error": { + "value": tree_max_abs_difference(reference_grads, candidate_grads), + "tolerance": 5e-4, + }, + "post_update_parameter_max_abs_error": tree_max_abs_difference( + reference_post_params, candidate_post_params + ), + "post_update_energy": { + "reference": float(reference_post_energy), + "candidate": float(candidate_post_energy), + "abs_error": abs( + float(reference_post_energy) - float(candidate_post_energy) + ), + "tolerance": 2e-3, + }, + } + report["passed"] = bool( + report["initial_parameter_max_abs_error"] == 0.0 + and report["initial_energy"]["abs_error"] + <= report["initial_energy"]["tolerance"] + and report["gradient_max_abs_error"]["value"] + <= report["gradient_max_abs_error"]["tolerance"] + and report["post_update_energy"]["abs_error"] + <= report["post_update_energy"]["tolerance"] + ) + rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" + if args.output is not None: + args.output.write_text(rendered, encoding="utf-8") + print(rendered, end="") + if not report["passed"]: + raise SystemExit(1) + + +if __name__ == "__main__": + main() diff --git a/optimized_solutions/challenge-06/solution_6_native_jaxode.py b/optimized_solutions/challenge-06/solution_6_native_jaxode.py new file mode 100644 index 0000000..3b2ed96 --- /dev/null +++ b/optimized_solutions/challenge-06/solution_6_native_jaxode.py @@ -0,0 +1,164 @@ +""" +Task Suite Problem 6: digital-analog hybrid VQE with trainable analog blocks. + +Each block evolves under a trainable sparse Hamiltonian via +tc.timeevol.ode_evol_global raw mode, then applies trainable local digital +rotations. The block loop uses jax.lax.scan for JIT-friendly staging. The +solution returns only NumPy values consumed by evaluate_6.py. +""" + +import jax +import numpy as np +import optax + +import tensorcircuit as tc +from tensorcircuit.quantum import PauliStringSum2MVP + +K = tc.set_backend("jax") +tc.set_dtype("complex64") + + +def build_hamiltonians(config): + n = config["n_qubits"] + xy_ls, xy_w = [], [] + for i in range(n - 1): + for p in (1, 2): + s = [0] * n + s[i] = p + s[i + 1] = p + xy_ls.append(s) + xy_w.append(1.0) + Hxy_mvp = PauliStringSum2MVP(xy_ls, xy_w) + + field_ls, field_w = [], [] + for i in range(n): + s = [0] * n + s[i] = 3 + field_ls.append(s) + field_w.append((-1.0) ** i) + Hfield_mvp = PauliStringSum2MVP(field_ls, field_w) + + target_ls, target_w = [], [] + for i in range(n - 1): + for p, c in ((1, 0.7), (2, 0.7), (3, 1.1)): + s = [0] * n + s[i] = p + s[i + 1] = p + target_ls.append(s) + target_w.append(c) + for i in range(n): + s = [0] * n + s[i] = 3 + target_ls.append(s) + target_w.append(0.25 * ((-1.0) ** i)) + Htarget_mvp = PauliStringSum2MVP(target_ls, target_w) + + return Hxy_mvp, Hfield_mvp, Htarget_mvp + + +def initial_state(config): + circuit = tc.Circuit(config["n_qubits"]) + for i in range(1, config["n_qubits"], 2): + circuit.x(i) + return circuit.state() + + +def initial_parameters(config): + rng = np.random.default_rng(2026) + n = config["n_qubits"] + nb = config["n_blocks"] + return { + "s": K.convert_to_tensor(np.zeros(nb, dtype=np.float32)), + "j": K.convert_to_tensor(0.1 * np.ones(nb, dtype=np.float32)), + "d": K.convert_to_tensor(0.1 * np.ones(nb, dtype=np.float32)), + "rot": K.convert_to_tensor( + rng.normal(scale=0.1, size=(nb, n, 3)).astype(np.float32) + ), + } + + +def forward(params, psi0, Hxy_mvp, Hfield_mvp, Htarget_mvp, config): + t_min = config["t_min"] + t_max = config["t_max"] + rtol = config["ode_rtol"] + atol = config["ode_atol"] + + def block_step(psi, block_params): + s_l, j_l, d_l, rot_l = block_params + t = t_min + (t_max - t_min) * K.sigmoid(s_l) + Jc = K.cast(K.tanh(j_l), tc.dtypestr) + Dc = K.cast(K.tanh(d_l), tc.dtypestr) + + def vf(y, tt): + return -1.0j * (Jc * Hxy_mvp(y) + Dc * Hfield_mvp(y)) + + times = K.stack([t * 0.0, t]) + psi = tc.timeevol.ode_evol_global( + vf, + psi, + times, + mode="raw", + ode_backend="jaxode", + rtol=rtol, + atol=atol, + max_steps=config["ode_max_steps"], + )[-1] + + circuit = tc.Circuit(config["n_qubits"], inputs=psi) + for i in range(config["n_qubits"]): + alpha, beta, gamma = rot_l[i] + phase = K.exp(-0.5j * K.cast(alpha + gamma, tc.dtypestr)) + unitary = phase * tc.gates.u_gate( + theta=beta, phi=gamma, lbd=alpha + ).tensor + circuit.any(i, unitary=unitary) + psi = circuit.state() + return psi, None + + block_xs = (params["s"], params["j"], params["d"], params["rot"]) + final_psi, _ = jax.lax.scan(block_step, psi0, block_xs) + + h_psi = Htarget_mvp(final_psi) + energy_density = ( + K.real(K.tensordot(K.conj(final_psi), h_psi, 1)) / config["n_qubits"] + ) + return energy_density + + +def run_solution(config): + Hxy_mvp, Hfield_mvp, Htarget_mvp = build_hamiltonians(config) + psi0 = initial_state(config) + params = initial_parameters(config) + optimizer = optax.adam(config["learning_rate"]) + opt_state = optimizer.init(params) + + def loss_fn(p): + return forward(p, psi0, Hxy_mvp, Hfield_mvp, Htarget_mvp, config) + + def train_step(p, state): + energy_density, grads = K.value_and_grad(loss_fn)(p) + updates, state = optimizer.update(grads, state, p) + p = optax.apply_updates(p, updates) + return p, state, energy_density + + train_step = K.jit(train_step) + + energy_density_history = [] + for _ in range(config["max_steps"]): + params, opt_state, energy_density = train_step(params, opt_state) + energy_density_history.append(energy_density) + + t_min = config["t_min"] + t_max = config["t_max"] + final_times = K.numpy(t_min + (t_max - t_min) * K.sigmoid(params["s"])).astype( + np.float32 + ) + final_couplings = K.numpy(K.tanh(params["j"])).astype(np.float32) + final_detunings = K.numpy(K.tanh(params["d"])).astype(np.float32) + + return { + "final_analog_times": final_times, + "final_analog_couplings": final_couplings, + "final_analog_detunings": final_detunings, + "energy_density_history": K.numpy(K.stack(energy_density_history)), + } From db310f1fd4b80118d8192815517ea94e42a76ae2 Mon Sep 17 00:00:00 2001 From: qingyunqian Date: Thu, 30 Jul 2026 11:57:10 +0800 Subject: [PATCH 2/3] Simplify Task 06 optimization evidence --- optimized_solutions/challenge-06/README.md | 44 +- .../figures => }/factor-ablation.svg | 0 .../research/IMPLEMENTATION_COMPARISON.md | 103 --- .../challenge-06/research/INSIGHTS.md | 92 --- .../challenge-06/research/LOG.md | 302 --------- .../challenge-06/research/SURVEY.md | 160 ----- .../research/plot_factor_ablation.py | 84 --- .../research/profile_digital_fusion.py | 138 ---- .../research/profile_hamiltonian_actions.py | 175 ----- .../research/profile_reference.py | 164 ----- .../profiles/digital-fusion-profile.json | 119 ---- .../profiles/e01-digital-fusion-10.json | 177 ----- .../profiles/e01-digital-fusion-100.json | 177 ----- .../research/profiles/e02-dt0-auto-10.json | 177 ----- .../research/profiles/e02-dt0-auto-100.json | 177 ----- .../profiles/e03-final-five-pair.json | 64 -- .../research/profiles/e03-jaxode-10.json | 177 ----- .../research/profiles/e03-jaxode-100.json | 177 ----- .../profiles/e03-jaxode-equivalence.json | 27 - .../profiles/hamiltonian-action-profile.json | 128 ---- .../profiles/reference-baseline-six.json | 637 ------------------ .../research/profiles/reference-profile.json | 64 -- .../research/run_docker_matrix.py | 463 ------------- .../validate_candidate_equivalence.py | 142 ---- 24 files changed, 30 insertions(+), 3938 deletions(-) rename optimized_solutions/challenge-06/{research/figures => }/factor-ablation.svg (100%) delete mode 100644 optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md delete mode 100644 optimized_solutions/challenge-06/research/INSIGHTS.md delete mode 100644 optimized_solutions/challenge-06/research/LOG.md delete mode 100644 optimized_solutions/challenge-06/research/SURVEY.md delete mode 100644 optimized_solutions/challenge-06/research/plot_factor_ablation.py delete mode 100644 optimized_solutions/challenge-06/research/profile_digital_fusion.py delete mode 100644 optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py delete mode 100644 optimized_solutions/challenge-06/research/profile_reference.py delete mode 100644 optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json delete mode 100644 optimized_solutions/challenge-06/research/profiles/reference-profile.json delete mode 100644 optimized_solutions/challenge-06/research/run_docker_matrix.py delete mode 100644 optimized_solutions/challenge-06/research/validate_candidate_equivalence.py diff --git a/optimized_solutions/challenge-06/README.md b/optimized_solutions/challenge-06/README.md index a972012..e70bc87 100644 --- a/optimized_solutions/challenge-06/README.md +++ b/optimized_solutions/challenge-06/README.md @@ -1,18 +1,34 @@ -# Challenge 06 optimized expert solution +# Task 06 — use TensorCircuit's native `jaxode` backend -This directory packages the final reviewed Task 06 campaign from Benchmark -PR [#12](https://github.com/hmyuuu/OrbitBreakersExpertBenchmarks/pull/12), -with the final tree taken from Benchmark `main` at `7e2298b`. +> **Take-home insight:** the acceleration comes from selecting TensorCircuit's +> native `jaxode` ODE backend for the unchanged adaptive evolution. Gate fusion +> is secondary; automatic `dt0` and sparse BCOO Hamiltonians do not help. -- `solution_6_native_jaxode.py` is the optimized TensorCircuit-NG variant. -- `research/IMPLEMENTATION_COMPARISON.md` is the final report. -- `research/profiles/`, `research/figures/`, and the validation/profiling - scripts preserve the factor ablations and five-pair result. +## Factor speedups -All five matched pairs passed. Mean runtime changed from `41.4259 s` to -`27.5366 s`; mean paired speedup was `1.50446x` with a 95% t-interval of -`[1.48875x, 1.52018x]`. +| Factor | Measured speedup | Decision | +|---|---:|---| +| TensorCircuit native `jaxode` | **1.529x** single-screen | Keep — dominant | +| Exact `RZ → RY → RZ` Euler fusion | 1.152x cold; 1.004x steady | Keep — secondary | +| Diffrax automatic `dt0` | 1.001x | Discard — neutral | +| BCOO Hamiltonian actions | 0.29x–0.30x | Discard — regression | -The canonical expert under `tasks/challenge-06/solution/` is intentionally -unchanged. Benchmark-harness reproduction commands in the research record -should be run in the Benchmark repository pinned above. +![Task 06 factor ablation](factor-ablation.svg) + +## What the factors mean + +- **Native `jaxode`:** run the same `tc.timeevol.ode_evol_global` problem + through TensorCircuit's faster native backend without changing the vector + field, tolerances, endpoints, or step bound. +- **Euler fusion:** replace each exact three-gate Euler sequence with one + phase-corrected TensorCircuit `U` gate while retaining all parameters. +- **Automatic `dt0`:** let the solver choose its initial step instead of using + the expert's explicit value. +- **BCOO actions:** replace the small termwise Hamiltonian products with sparse + matrix multiplication; this stack makes them substantially slower. + +## End-to-end result + +All five matched pairs passed. Mean runtime fell from `41.4259 s` to +`27.5366 s`, for a mean paired speedup of **1.50446x** (5/5 candidate wins). +These are same-container local-engine measurements. diff --git a/optimized_solutions/challenge-06/research/figures/factor-ablation.svg b/optimized_solutions/challenge-06/factor-ablation.svg similarity index 100% rename from optimized_solutions/challenge-06/research/figures/factor-ablation.svg rename to optimized_solutions/challenge-06/factor-ablation.svg diff --git a/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md b/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md deleted file mode 100644 index 10d83f6..0000000 --- a/optimized_solutions/challenge-06/research/IMPLEMENTATION_COMPARISON.md +++ /dev/null @@ -1,103 +0,0 @@ -# Task 06 Human-Expert Optimization and Factor Ablation - -## Result - -The optimized solution preserves the expert's continuous-time TensorCircuit -calculation and is **1.504x faster** on the final five-pair same-machine -benchmark. Mean end-to-end runtime fell from `41.4259 s` to `27.5366 s` -(`33.53%`), and the candidate won all five counterbalanced pairs. - -| Pair | Order | Expert (s) | Candidate (s) | Speedup | -|---:|---|---:|---:|---:| -| 1 | expert → candidate | 41.3896 | 27.2906 | 1.5166x | -| 2 | candidate → expert | 41.3893 | 27.6433 | 1.4973x | -| 3 | expert → candidate | 41.4415 | 27.6251 | 1.5001x | -| 4 | candidate → expert | 41.5825 | 27.3809 | 1.5187x | -| 5 | expert → candidate | 41.3267 | 27.7431 | 1.4896x | -| **Mean** | — | **41.4259** | **27.5366** | **1.5044x** | - -The mean paired speedup is `1.50446x ± 0.00566` standard error, with a -two-sided 95% t-interval of `[1.48875x, 1.52018x]`. - -## Optimized implementation - -Two accepted changes are present: - -1. Fuse each exact digital `RZ → RY → RZ` Euler sequence into one - phase-corrected TensorCircuit `U` gate while retaining all 168 independent - angles. -2. Select TensorCircuit's native `jaxode` backend for the same adaptive - `tc.timeevol.ode_evol_global` calls, with the original vector field, - endpoints, tolerances, and maximum-step bound. - -No Trotter approximation, static answer, dense replacement simulator, or -parameter removal is used. - -## Factor ablation - -The campaign changed one factor at a time. Canonical single screens establish -the cumulative direction; isolated profilers explain which phase is affected. -Only the final promoted candidate received the five-pair inference above, so -the single-screen percentages below are diagnostic rather than independent -confidence intervals. - -| Factor | Comparison | Evidence | Attribution | -|---|---|---|---| -| Exact Euler fusion | expert `45.0372 s` six-run historical mean → e01 `42.4126 s` single canonical screen | State, energy, and gradient equivalence passed. Isolated steady gradient speedup was only `1.0042x`, but compile-plus-first-execution fell from `2.5819 s` to `2.2421 s`. | Small compile-oriented contribution; the apparent 5.8% end-to-end delta is not claimed as a separately significant effect. | -| Diffrax automatic `dt0` | e01 `42.4126 s` → e02 `42.3620 s` | Only `0.12%`; displayed outputs unchanged. | Neutral; discarded. | -| TensorCircuit `jaxode` | e01 `42.4126 s` → e03 `27.7480 s` | Same canonical evaluator and fused circuit; `1.5285x` single-screen speedup. Energy, gradient, and one-update audit passed. | **Dominant positive factor.** | -| TensorCircuit BCOO Hamiltonians | termwise MVP versus BCOO microbench | BCOO was `3.4–3.5x` slower for both analog and target actions. | Negative; discarded before integration. | -| Whole-training scan | not integrated | ODE backend change already dominates; no unsupported percentage assigned. | Open follow-up, not part of the reported speedup. | - -The defensible conclusion is therefore narrower than “all edits helped”: -**the ODE backend accounts for the large gain**. Euler fusion is a smaller -compile-cost optimization, automatic initial-step selection contributes -nothing measurable, and sparse BCOO conversion is actively harmful on this -stack. - -![Task 06 factor-ablation plots](figures/factor-ablation.svg) - -The panels use the frozen canonical screens and isolated profiler values. -They are intentionally not multiplied together: the left panel is cumulative, -while the other two isolate compilation and Hamiltonian-action mechanisms. -Regenerate with -[`plot_factor_ablation.py`](plot_factor_ablation.py). - -## Correctness - -The candidate keeps the 14-qubit Néel state, four hybrid blocks, four true -adaptive ODE evolutions per loss, all analog variables, all digital angles, -seed 2026, complex64 TensorCircuit/JAX computation, target Hamiltonian, -exactly 100 Adam updates, and every pre-update energy. - -For the `jaxode` substitution, the frozen audit measured: - -```text -initial energy absolute error: 7.39e-6 <= 5e-5 -maximum gradient element error: 3.38e-5 <= 5e-4 -post-update parameter max error: 2.98e-8 -post-update energy absolute error: 4.77e-7 <= 2e-3 -``` - -All ten cells in the final paired benchmark passed the canonical evaluator. - -## Reproduction and provenance - -The final benchmark used one no-network container, a fresh evaluator process -per cell, counterbalanced order, six CPUs, 7 GiB memory, and a 300-second cell -cap. Image ID: -`sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833`. - -Run: - -```bash -python3 research/task-06/run_docker_matrix.py \ - --repeat 5 --max-steps 100 --timeout 300 \ - --cpus 6 --memory 7g \ - --output /private/tmp/task06-e03-five-pair -``` - -Machine-readable summary: -[`profiles/e03-final-five-pair.json`](profiles/e03-final-five-pair.json). -The full experimental chronology and rejected variants are in -[`LOG.md`](LOG.md). diff --git a/optimized_solutions/challenge-06/research/INSIGHTS.md b/optimized_solutions/challenge-06/research/INSIGHTS.md deleted file mode 100644 index 4796a04..0000000 --- a/optimized_solutions/challenge-06/research/INSIGHTS.md +++ /dev/null @@ -1,92 +0,0 @@ -# Task 06 Research Insights - -Task: `task-06` - -Last consolidated: `2026-07-29` - -Evidence ledger: [`LOG.md`](LOG.md) - -## Current best - -Experiment e03 is the current best. In the final five counterbalanced -same-container pairs, the immutable expert averaged `41.425923 s` and e03 -averaged `27.536613 s`. The ratio of means is `1.50439x`; mean paired speedup -is `1.50446x` with a 95% t-interval of `[1.48875x, 1.52018x]`. - -## Preserved semantics - -- 14-qubit Neel state and four hybrid blocks. -- Four true adaptive ODE evolutions per loss, with the original tolerances and - maximum-step bound. -- All analog time/coupling/detuning variables and all 168 independent digital - Euler angles. -- Seed 2026, complex64 TensorCircuit/JAX computation, target Hamiltonian, - exactly 100 Adam updates, and every pre-update energy. -- Original NumPy output keys, shapes, and physical meanings. - -## Confirmed bottlenecks - -Both compilation and differentiated ODE execution are material. Immutable -profiling measured `2.851 s` lowering, `3.195 s` compilation, and -`0.2805 s` per early optimizer update, projecting `28.05 s` for 100 compiled -executions against the `45.04 s` evaluator mean. - -The expected sparse-Hamiltonian shortcut is not viable on this CPU/JAX stack. -TensorCircuit BCOO multiplication was 3.4-3.5x slower than the installed -termwise MVP in isolated analog and target actions. XLA already fuses the -short reshape/slice/broadcast Pauli sums effectively. - -Exact digital Euler fusion primarily affects compilation: the isolated -energy-gradient first call improved by about `0.34 s`, while steady execution -changed by only `0.4%`. - -## What worked - -Exact fusion of every digital `RZ -> RY -> RZ` sequence into one -phase-corrected TensorCircuit `U` gate passed state/energy/gradient audits and -reduced the canonical single screen by about 5.8%. - -Switching the same TensorCircuit raw-mode continuous ODE from Diffrax to -TensorCircuit's `jaxode` backend reduced the accepted canonical screen by a -further 34.6%. Initial energy, gradient, one Adam update, the full 100-update -functional contract, tolerances, and maximum-step bound all pass. - -## What did not work - -The old bootstrap's raw-mode ODE API failure is obsolete in the current image -and should not be treated as a present blocker. - -Do not replace the current Hamiltonian actions with TensorCircuit/JAX BCOO -unchanged. Numerical equivalence passed, but isolated steady runtime regressed -by more than 3x. - -Diffrax `dt0=None` was neutral on the canonical screen (`0.12%` faster than -e01, far below noise) and produced the same displayed optimization result. -Keep the explicit framework default unless new step-count evidence explains a -reason to revisit it. - -## Factor attribution - -The native `jaxode` substitution is the dominant positive factor: its -one-change canonical screen was `1.5285x` faster than the accepted -digital-fusion candidate. Euler fusion is smaller and primarily lowers -compile-plus-first-execution cost. Diffrax `dt0=None` was neutral, while BCOO -Hamiltonian conversion was a clear regression. See -[`IMPLEMENTATION_COMPARISON.md`](IMPLEMENTATION_COMPARISON.md) for the -ablation table and final paired result. - -## Open hypotheses - -1. Whole-training `K.jaxy_scan`. -2. A direct five-pair removal test could quantify whether `jaxode` makes the - compile-oriented digital fusion redundant. -3. Parameter-tree simplification only if later profiling supports it. -4. Diffrax solver sweep is now low priority because the native `jaxode` path - is materially faster. - -## Evidence limits - -The benchmark covers one fixed public workload, one image, and one host -resource profile. It establishes neither cross-hardware performance nor global -SOTA. Factor screens other than the final promoted comparison are diagnostic -single runs or isolated microbenchmarks and are labeled accordingly. diff --git a/optimized_solutions/challenge-06/research/LOG.md b/optimized_solutions/challenge-06/research/LOG.md deleted file mode 100644 index 73b4284..0000000 --- a/optimized_solutions/challenge-06/research/LOG.md +++ /dev/null @@ -1,302 +0,0 @@ -# Task 06 Autoresearch Campaign - -Task: `task-06` - -Campaign branch: `codex/orbitbreakers/task-06/extreme-native` - -Insights: [`INSIGHTS.md`](INSIGHTS.md) - -## Campaign scope - -Optimize only the immutable Task 06 human-expert TensorCircuit-NG solution. -Preserve the four true continuous-time ODE blocks, all parameters, all 100 Adam -updates, and the complete output contract. Use the latest installed framework; -do not attribute host hardware differences to solution performance. - -At `2026-07-29T01:26Z`, the upstream repository returned zero open pull -requests matching `Task 06`. - -## Frozen provenance - -- Parent: `5af98f27b9404c513df8eee0f4568b1512edee19`. -- Reference: - `0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1`. -- Evaluator: - `0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998`. -- Image: - `sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833`. -- TensorCircuit-NG `1.8.0.dev20260726`; JAX/JAXLIB `0.10.0`; Diffrax - `0.7.2`; Optax `0.2.8`. -- Resource profile: six CPUs, 7 GiB, network disabled, 300-second cell cap. -- Pair order: odd `reference -> candidate`, even - `candidate -> reference`. -- Private or hidden evaluation used: no. - -## Append-only campaign events - -- `2026-07-29T01:27:26Z`: created the dedicated branch from current - `origin/main`. Reference and editable source were byte-identical. -- `2026-07-29T01:28Z`: latest-image one-update compatibility run completed in - `7.889008 s`. The ODE API is functional; the one-update evaluator - intentionally fails convergence thresholds and is diagnostic only. -- `2026-07-29T01:29:10Z` to `2026-07-29T01:34:01Z`: completed six immutable - canonical reference runs in one no-network container with a fresh evaluator - process per run. All six passed. Runtimes were `43.976600`, `45.097434`, - `44.415753`, `44.864424`, `45.481100`, and `46.387673` seconds. Mean - `45.037164 s`, median `44.980929 s`, standard error `0.344740 s`. - Report: `profiles/reference-baseline-six.json`; - SHA-256 - `bdb7b985d6a0fa6bd6e7044816f9764e90b285fa9be0e6f07b79aa2587e9ff35`. -- `2026-07-29T01:35Z`: the first runner version omitted the gate checker's - `repeat` alias and exact `docker exec` command from serialized rows. Both - metadata fields were reconstructed deterministically from the unmodified - checkpoint; no measurement, output, status, order, or hash changed. The - runner now records both fields directly. -- `2026-07-29T01:36:02Z`: froze the public canonical Task 06 workload and - source-backed survey. Candidate edits are allowed only after - `research/check_gates.py` reports `research_ready: true`. - -## Baseline interpretation - -The canonical expert passes with initial energy density `-0.5182266235`, final -history energy density `-1.5754342079`, and independently evaluated sparse -ground energy density about `-1.6025561094`. Its learned analog parameters are -well inside all bounds. The small `1.9%` max/min runtime spread makes the -baseline suitable for paired screening. - -## Append-only corrections - -Append later corrections here; do not rewrite any result after it informs a -candidate. - -## Profiling event: immutable compiled update - -Recorded at `2026-07-29T01:41Z`. - -Profiler: `profile_reference.py` -(`sha256:ba1a9072b8b76b439429ef7cbfb9325c4f525c531dedcc9153813d17f4f183fd`). -Report: `profiles/reference-profile.json` -(`sha256:b96624021fde8f5a5c374c1e60d1e0aa5c24c1e15d624a520f35d7c0dc243a4e`). - -Lowering and compilation took `2.851043 s` and `3.194721 s`. Eight early -post-compile optimizer updates averaged `0.280501 s` and projected -`28.050100 s` for 100 executions. XLA reported about `23.52 million` FLOPs, -`101.16 MB` bytes accessed, and `18.78 MB` temporary storage per update. -The canonical evaluator mean is `45.037164 s`, so both compilation and -steady differentiated ODE execution are material; Python-only cleanup cannot -produce a large gain. - -## Profiling event: Hamiltonian action - -Recorded at `2026-07-29T01:42Z`. - -Profiler: `profile_hamiltonian_actions.py` -(`sha256:fcc5914a4bb1feb50bd3b1ca2bbc89c3b706a17ce701e8dbafba29c1058b0e46`). -Report: `profiles/hamiltonian-action-profile.json` -(`sha256:6d864f1d3ff26ec1625edacb39347ed8ba3575d1a081d4f67aedd9c314584472`). - -The TensorCircuit COO operators agreed with the expert analog action to -`8.72e-9` maximum absolute error and with the target action to `1.91e-6`. -However, native BCOO multiplication was slower on this CPU/JAX stack: - -```text -analog termwise MVP: 0.249930 ms -analog sparse BCOO: 0.851897 ms -termwise/sparse: 0.293381x - -target termwise MVP: 0.344365 ms -target sparse BCOO: 1.209447 ms -termwise/sparse: 0.284729x -``` - -Decision: `discard before candidate integration`. The installed 1.8 -`PauliStringSum2MVP` implementation is already reshape/slice/broadcast based -and XLA fuses these short local Pauli sums effectively. A full sparse rewrite -has no source-independent reason to reverse a 3.4-3.5x isolated steady -regression. Do not repeat BCOO unchanged. - -## Profiling event: exact digital Euler fusion - -Recorded at `2026-07-29T01:44Z`. - -Profiler: `profile_digital_fusion.py` -(`sha256:681c4c55ba4550db5ca2dd0729ea7c4f0495252d375102aca48cd6c2369e1d39`). -Report: `profiles/digital-fusion-profile.json` -(`sha256:48185620664abf2da8857ed17d12a148b0ed7c8f685b5ba124c2a3b3df52c113`). - -Replacing each `RZ -> RY -> RZ` triple by the exactly phased TensorCircuit -`U` gate produced maximum state, energy, and gradient errors -`8.94e-8`, `9.54e-7`, and `9.65e-7`. The isolated energy-gradient steady -speedup was only `1.0042x`, but compile-plus-first-execution fell from -`2.5819 s` to `2.2421 s`. Decision: `test end to end`; this is a compile-cost -hypothesis, not a steady-execution claim. - -## Frozen follow-up ODE hypotheses - -Source inspection after the initial survey exposed two additional -TensorCircuit-native controls that preserve a true adaptive ODE: - -1. pass `dt0=None` so Diffrax chooses its initial step instead of forcing - `0.01` for every smooth time-independent block; -2. compare TensorCircuit's `ode_backend="jaxode"` with the current Diffrax - path, preserving `rtol`, `atol`, and `max_steps`. - -Each is isolated after the digital-fusion screen. A candidate must pass a -canonical 100-update evaluator; lower-step runs are diagnostics only. - -## Experiment `e01`: exact digital Euler fusion - -Candidate commit: `9484010`. - -Candidate SHA-256: -`b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90`. - -Pre-edit diff SHA-256: -`cd45478134866b89de5b704476fd03d6f8f480a60f795b9a85f89cbb3b495085`. - -The candidate replaces each block's 42 `RZ/RY/RZ` circuit nodes with 14 -exactly phased TensorCircuit `U` nodes. It retains all three independent -angles. The exact identity audit was already frozen in -`profiles/digital-fusion-profile.json`. - -```text -max_steps=10: 10.912746 s, PASS -max_steps=100: 42.412637 s, PASS -reference six-run mean: 45.037164 s -single-screen ratio: 1.06188x -``` - -The canonical initial energy differs from the reference baseline by -`3.58e-7`; final history energy differs by `1.17e-5`. All output shapes, -bounds, history length, energy gates, and NumPy checks pass. - -Reports: - -- `profiles/e01-digital-fusion-10.json` - (`sha256:fc0b5cc821d73025443618bf771ff076ec621021ecbfe035c2ce47cb68f0d072`); -- `profiles/e01-digital-fusion-100.json` - (`sha256:b926c0b8004e30fe62c6f65dfc80204c6cfdd849ffd11ec6066f87d1854d1f4a`). - -Decision: `keep provisionally`. The canonical screen is about 5.8% below the -immutable mean and the numerical audits pass. Continue from e01 to isolate -Diffrax automatic initial-step selection. - -## Experiment `e02`: Diffrax automatic initial step - -Candidate commit: `a76876b`; restore commit: `670364d`. - -Candidate SHA-256: -`b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582`. - -The only change from e01 was `dt0=None`, asking the same TensorCircuit Diffrax -path to choose its initial step automatically while preserving solver, -tolerances, and maximum steps. - -```text -max_steps=10: e01 10.912746 s, e02 10.402433 s, e02 PASS -max_steps=100: e01 42.412637 s, e02 42.361953 s, e02 PASS -canonical delta: 0.050684 s (0.12%) -``` - -The canonical energies and returned analog parameters were byte-for-display -identical to e01. Reports: - -- `profiles/e02-dt0-auto-10.json` - (`sha256:c0d534a50c3b0e2e36b979166309913858a004fdb552111b36d85576de079dbe`); -- `profiles/e02-dt0-auto-100.json` - (`sha256:d9f17e8f27e26f6c85d33c03ae7377d7b961902b6b6f877c12ab094c823962d6`). - -Decision: `discard`. The `0.12%` single-run canonical difference is far below -normal run noise and supplies no evidence that the automatic choice improves -the accepted e01 path. Restore the simpler expert default before the next -experiment. - -## Experiment `e03`: TensorCircuit `jaxode` - -Candidate commit: `a603df8`. - -Candidate SHA-256: -`158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1`. - -Pre-edit diff SHA-256: -`c78de3e12645fd9af2fa96026017a0f30cb86b04533531b614e5a5fc704fa79b`. - -The candidate changes only TensorCircuit's ODE backend selector from -`diffrax` to `jaxode`. It still calls `tc.timeevol.ode_evol_global` in raw -mode with the identical vector field, two endpoint times, `rtol=atol=1e-6`, -and `max_steps=16`. It does not introduce a Trotter approximation or direct -matrix exponential. - -```text -max_steps=10: e01 10.912746 s, e03 6.866093 s, e03 PASS -max_steps=100: reference mean 45.037164 s - e01 42.412637 s - e03 27.747994 s, e03 PASS -canonical single-screen vs reference mean: 1.62297x -canonical single-screen vs e01: 1.52850x -``` - -The frozen numerical audit passed: - -```text -initial energy absolute error: 7.39e-6 <= 5e-5 -maximum gradient element error: 3.38e-5 <= 5e-4 -post-update parameter max error: 2.98e-8 -post-update energy absolute error: 4.77e-7 <= 2e-3 -``` - -The canonical run passes all gates with initial/final history energy -`-0.5182192326 / -1.5775290728`. Reports: - -- `profiles/e03-jaxode-10.json` - (`sha256:dd9b3d4ffbf1d146f271287520d3f9103c907131815f15fcf42b944deae70450`); -- `profiles/e03-jaxode-100.json` - (`sha256:96777324be79271c79670acd126044e53e48f7a0550834ef6552a479a8b0bdde`); -- `profiles/e03-jaxode-equivalence.json` - (`sha256:b258da71dcd109c3bcb55a11da180a48db446b3d6a7b3e0805ef095d7a00fcf1`). - -Decision: `keep`. This is the first large end-to-end gain and remains wholly -inside TensorCircuit's supported continuous-time ODE API. Continue from e03 -to isolate whole-training scan. - -## Final five-pair comparison and attribution - -Recorded at `2026-07-29T05:13:09Z`. - -Five counterbalanced pairs were run in one no-network container, using a fresh -evaluator process for every cell, six CPUs, 7 GiB memory, and the canonical -100-update workload. All ten cells passed. - -```text -reference: 41.389616, 41.389259, 41.441489, 41.582510, 41.326743 s -candidate: 27.290641, 27.643293, 27.625098, 27.380896, 27.743136 s - -reference mean: 41.425923 s -candidate mean: 27.536613 s -ratio of means: 1.504394x -mean paired speedup: 1.504463x -paired standard error: 0.005659x -95% paired t-interval: [1.488750x, 1.520175x] -candidate wins: 5/5 -``` - -Report: `profiles/e03-final-five-pair.json`. - -The runner returned a nonzero process status only because its legacy promotion -booleans require a six-run known-baseline gate; that policy is inapplicable to -this explicitly requested five-pair comparison. It does not indicate a -functional failure. - -Attribution after reviewing all campaign evidence: - -- TensorCircuit `jaxode` is the dominant factor (`1.5285x` versus e01 in the - controlled one-change canonical screen). -- Exact Euler fusion is a smaller compile-oriented factor; the isolated steady - improvement was only `1.0042x`. -- Diffrax `dt0=None` was neutral (`0.12%`) and was removed. -- TensorCircuit BCOO Hamiltonian actions were `3.4–3.5x` slower and were never - integrated. - -No independent percentage is assigned to whole-training scan because it is not -part of the promoted implementation. The consolidated PR-facing report is -`IMPLEMENTATION_COMPARISON.md`. diff --git a/optimized_solutions/challenge-06/research/SURVEY.md b/optimized_solutions/challenge-06/research/SURVEY.md deleted file mode 100644 index f273e66..0000000 --- a/optimized_solutions/challenge-06/research/SURVEY.md +++ /dev/null @@ -1,160 +0,0 @@ -# ORBIT-Q Task 06 Runtime Optimization Survey - -**Status: READY** - -Campaign task: `task-06` - -Survey freeze: `2026-07-29T01:36:02Z` - -Reference commit: `5af98f27b9404c513df8eee0f4568b1512edee19` - -This campaign covers only Task 06. The immutable expert, public canonical -workload, semantic constraints, hypotheses, and measurement rule are frozen -before the first candidate edit. - -## Evidence and claim boundary - -The immutable human expert is `references/task-06/solution_6.py` -(`sha256:0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1`). -The public contract and evaluator are `tasks/task-06/problem.md` -(`sha256:e3e8a8044c322027327b6e694dbb476f67dbc09465ea80dd4f20aebf8c64c8a7`) -and `tasks/task-06/evaluator/evaluate_6.py` -(`sha256:0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998`). - -The old bootstrap did not produce a Task 06 runtime because its then-installed -framework lacked the required raw-mode ODE API. The current latest -TensorCircuit-NG image runs the immutable expert successfully. Six complete -fresh-process baselines are `43.976600`, `45.097434`, `44.415753`, -`44.864424`, `45.481100`, and `46.387673` seconds: mean `45.037164` seconds, -median `44.980929` seconds, and standard error `0.344740` seconds. - -No external result uses this exact evaluator, seeded initialization, optimizer -trajectory, ODE tolerances, container, and hardware allocation. This campaign -may claim only a paired gain over the bundled expert and a repository/campaign -best, not a global hardware-independent SOTA result. - -At `2026-07-29T01:26Z`, the upstream repository had no open pull request -matching Task 06. The campaign therefore does not duplicate an active Task 06 -optimization. - -## Framework and environment - -Measurements use Docker image -`sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833` -with six CPUs, 7 GiB memory, no network, and a fresh evaluator process for -every cell. The tracked lock is -`envs/tensorcircuit-py311/requirements.lock` -(`sha256:cd5ac5cb2102ea7b40bd46dc81320cc59e0ce0671ab88c597f81d82b384a824b`). -Per maintainer direction, no TensorCircuit downgrade is used. - -| Component | Version | Inspected source | -| --- | --- | --- | -| TensorCircuit-NG | `1.8.0.dev20260726` | `quantum.py` (`sha256:fcaee21ba5ccde1b89c46e2f5424c48d342e3bfaedf72adba672ab6bd4ded703`), `timeevol.py` (`sha256:64013d6bed57c842f00df254ce84d35c70b25c2a01f5d774b8d503d2e7a097d7`), and `circuit.py` (`sha256:5c4d569325369d957dc60bbeca8a581508549ff9813a7a163de61a6294864662`) | -| JAX / JAXLIB | `0.10.0` / `0.10.0` | TensorCircuit JAX backend (`sha256:88657aebf8e5d566ac4e653abe327083da0253f02a3a297a134b871ffe4baab9`) | -| Diffrax | `0.7.2` | called through `tc.timeevol.ode_evol_global` with `Tsit5`, PID tolerance control, and `max_steps=16` | -| Optax | `0.2.8` | exactly 100 Adam updates at learning rate `0.12` | - -TensorCircuit's ODE documentation describes full-system sparse Hamiltonians as -the intended efficient input to global ODE evolution: -. -The installed `ode_evol_global` source confirms that raw mode delegates to -Diffrax and preserves the configured `rtol`, `atol`, and `max_steps`. -Diffrax documents `diffeqsolve`, adaptive step-size control, maximum steps, -and reverse-mode checkpointing: - and -. -JAX documents that `lax.scan` lowers a fixed loop to one WhileOp and that -host conversion synchronizes asynchronous computation: - and -. - -## Task 06: digital-analog hybrid VQE - -The expert prepares the 14-qubit Neel state and applies four hybrid blocks. -Each block performs an actual differentiable continuous-time ODE evolution -under - -`J_l * sum_i (X_i X_(i+1) + Y_i Y_(i+1)) + Delta_l * sum_i (-1)^i Z_i` - -with trainable bounded time, coupling, and detuning, followed by independent -`RZ -> RY -> RZ` rotations on all 14 qubits. The loss is the energy density of -the specified 53-term target Hamiltonian. The expert differentiates this -four-block computation and performs exactly 100 sequential Adam updates, -recording every pre-update energy. - -Every viable candidate must preserve: - -- all 14 qubits, four analog ODE solves per loss, and the exact Neel state; -- actual continuous-time ODE integration through TensorCircuit with - `rtol=atol=1e-6` and `max_steps=16`, never a Trotter/product formula; -- all 180 trainable float32 values: 4 times, 4 couplings, 4 detunings, and - `4 * 14 * 3 = 168` independent digital rotation angles; -- the `sigmoid`/`tanh` parameter maps, seed 2026 initialization, target - Hamiltonian, complex64 computation, 100 Adam updates, and pre-update history; -- all four required NumPy outputs with their original meanings and shapes. - -## Source-supported bottleneck - -Each Diffrax vector-field evaluation calls two separate -`PauliStringSum2MVP` closures. In TensorCircuit-NG 1.8, that helper implements -every Pauli term as a reshape, broadcast mask, slice/flip, multiply, and -accumulate. The XY operator has 26 terms and the field has 14 terms, so each -adaptive Runge-Kutta stage executes 40 termwise full-state transforms; reverse -mode differentiates through the same work. Four ODE solves occur per loss and -100 loss/gradient/update steps are required. - -The framework's `PauliStringSum2COO` instead constructs a native JAX sparse -operator, and the JAX backend exposes `sparse_dense_matmul`. The installed -TensorCircuit ODE docstring explicitly recommends a sparse full-system -Hamiltonian for efficiency. This is the primary hypothesis. - -The 168 digital gates are a secondary trace/compile and execution cost. Each -qubit's exact Euler sequence can be represented by one differentiable 2x2 -TensorCircuit gate without tying or removing any angle. The Python host loop -dispatches one jitted optimizer step 100 times and is a lower-risk secondary -target. - -## Frozen experiments - -Each experiment starts from the latest accepted candidate and must pass a -public reduced screen before canonical promotion. - -1. **Native sparse Hamiltonian action.** Build the analog and target - Hamiltonians with TensorCircuit `PauliStringSum2COO`, apply them with the - TensorCircuit JAX backend's sparse-dense multiplication, and keep - `ode_evol_global(..., mode="raw", ode_backend="diffrax")`. Retain only if - a canonical run passes and improves on the `45.037164`-second reference - mean. -2. **Exact digital Euler fusion.** Form one differentiable 2x2 gate per qubit - equal to the expert's ordered `RZ -> RY -> RZ` sequence and apply it through - TensorCircuit. Require initial-energy and gradient agreement at complex64 - tolerance before runtime promotion. -3. **Whole-training TensorCircuit scan.** Carry parameters and Optax state - through `K.jaxy_scan` for exactly 100 updates and return all pre-update - energies. Retain only if canonical runtime improves over the accepted - predecessor. -4. **ODE solver selection.** Compare TensorCircuit's available `Tsit5`, - `Dopri5`, and `Dopri8` only after higher-value structural changes. All - candidates must retain the same tolerance and step bound and pass the - canonical energy/output contract. -5. **Parameter-tree simplification.** Flatten the four-leaf parameter PyTree - only if profiling shows optimizer/control overhead remains material. -6. **Direct algebraic or free-fermion evolution.** Reject for this campaign: - although the analog Hamiltonian is quadratic, replacing the required ODE - with a closed-form exponential, matchgate decomposition, or handwritten - simulator would change the requested method/framework fidelity. - -## Correctness and measurement rule - -For numerical audits, compare reference and candidate initial energy, -gradient leaves, one Adam update, and short histories. Frozen complex64 -tolerances are `5e-5` for initial energy, `5e-4` for maximum gradient element, -and `2e-3` for short physical energy history unless a candidate is algebraically -bit-equivalent. - -Final evidence is six counterbalanced canonical pairs in one no-network -container. Odd pairs run reference then candidate; even pairs reverse order. -Every cell is a fresh evaluator process with a 300-second cap. Promotion -requires all 12 cells to pass, candidate wins in at least five of six pairs, -lower candidate mean and median, and a two-sided 95% Student-t lower bound on -mean pairwise speedup above `1.0`. diff --git a/optimized_solutions/challenge-06/research/plot_factor_ablation.py b/optimized_solutions/challenge-06/research/plot_factor_ablation.py deleted file mode 100644 index f9c3fc3..0000000 --- a/optimized_solutions/challenge-06/research/plot_factor_ablation.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python3 -"""Render the Task 06 factor-ablation summary from frozen campaign data.""" - -from pathlib import Path - -import matplotlib -matplotlib.use("Agg") -import matplotlib.pyplot as plt - - -OUT = Path(__file__).with_name("figures") / "factor-ablation.svg" - - -def label_bars(ax, bars, fmt="{:.2f}"): - for bar in bars: - value = bar.get_height() - ax.text( - bar.get_x() + bar.get_width() / 2, - value, - fmt.format(value), - ha="center", - va="bottom", - fontsize=8, - ) - - -def main(): - plt.style.use("seaborn-v0_8-whitegrid") - plt.rcParams["svg.hashsalt"] = "task-06-factor-ablation" - fig, axes = plt.subplots(1, 3, figsize=(13.2, 4.2)) - blue, orange, red = "#4472C4", "#ED7D31", "#C44E52" - - labels = ["Expert", "+ Euler fusion", "+ dt0=None", "+ jaxode"] - runtimes = [45.037164, 42.412637, 42.361953, 27.747994] - bars = axes[0].bar(labels, runtimes, color=[blue, orange, "#A5A5A5", blue]) - label_bars(axes[0], bars, "{:.1f}s") - axes[0].set_ylabel("Canonical runtime (s)") - axes[0].set_title("Cumulative screens (jaxode: −34.6% vs fused)") - axes[0].tick_params(axis="x", rotation=24) - axes[0].set_ylim(0, 51) - - cold = [2.5819, 2.2421] - bars = axes[1].bar(["Unfused", "Euler fused"], cold, color=[red, blue]) - label_bars(axes[1], bars, "{:.3f}s") - axes[1].set_ylabel("Compile + first execution (s)") - axes[1].set_title("Euler fusion (cold −13.2%)") - axes[1].set_ylim(0, 3.05) - axes[1].text( - 0.5, - 0.82, - "steady execution: 1.0042×", - transform=axes[1].transAxes, - ha="center", - fontsize=9, - ) - - slowdowns = [1 / 0.293381, 1 / 0.284729] - bars = axes[2].bar(["Analog action", "Target action"], slowdowns, color=red) - label_bars(axes[2], bars, "{:.2f}×") - axes[2].axhline(1, color="black", linewidth=0.8) - axes[2].set_ylabel("BCOO / termwise runtime") - axes[2].set_title("Sparse BCOO screen (rejected)") - axes[2].set_ylim(0, 4.05) - axes[2].text( - 0.5, - 0.82, - ">1 is slower; rejected", - transform=axes[2].transAxes, - ha="center", - fontsize=9, - ) - - fig.suptitle( - "Task 06 factor attribution — jaxode dominates; other factors are small or negative", - fontsize=12, - fontweight="bold", - ) - fig.tight_layout() - OUT.parent.mkdir(parents=True, exist_ok=True) - fig.savefig(OUT, bbox_inches="tight", metadata={"Date": None}) - - -if __name__ == "__main__": - main() diff --git a/optimized_solutions/challenge-06/research/profile_digital_fusion.py b/optimized_solutions/challenge-06/research/profile_digital_fusion.py deleted file mode 100644 index 43a6ca9..0000000 --- a/optimized_solutions/challenge-06/research/profile_digital_fusion.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python3 -"""Audit and profile exact Task 06 digital Euler-gate fusion.""" - -from __future__ import annotations - -import argparse -import json -import statistics -import time -from pathlib import Path -from typing import Any, Callable - -import jax -import numpy as np -import tensorcircuit as tc - -from profile_reference import CONFIG, load_reference, ready - - -K = tc.set_backend("jax") -tc.set_dtype("complex64") - - -def current_state(psi: Any, rotations: Any) -> Any: - circuit = tc.Circuit(CONFIG["n_qubits"], inputs=psi) - for i in range(CONFIG["n_qubits"]): - circuit.rz(i, theta=rotations[i, 0]) - circuit.ry(i, theta=rotations[i, 1]) - circuit.rz(i, theta=rotations[i, 2]) - return circuit.state() - - -def fused_state(psi: Any, rotations: Any) -> Any: - circuit = tc.Circuit(CONFIG["n_qubits"], inputs=psi) - for i in range(CONFIG["n_qubits"]): - alpha, beta, gamma = rotations[i] - phase = K.exp(-0.5j * K.cast(alpha + gamma, tc.dtypestr)) - unitary = phase * tc.gates.u_gate( - theta=beta, phi=gamma, lbd=alpha - ).tensor - circuit.any(i, unitary=unitary) - return circuit.state() - - -def measure( - function: Callable[[Any], Any], argument: Any, repeats: int -) -> tuple[Any, dict[str, Any]]: - compiled = jax.jit(function) - started = time.perf_counter() - value = ready(compiled(argument)) - first_sec = time.perf_counter() - started - samples = [] - for _ in range(repeats): - started = time.perf_counter() - value = ready(compiled(argument)) - samples.append(time.perf_counter() - started) - return value, { - "first_compile_and_exec_sec": first_sec, - "steady_runtime_sec": samples, - "steady_mean_sec": statistics.mean(samples), - "steady_median_sec": statistics.median(samples), - } - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - "--reference", - type=Path, - default=Path("/workspace/references/task-06/solution_6.py"), - ) - parser.add_argument("--repeats", type=int, default=20) - parser.add_argument("--output", type=Path) - args = parser.parse_args() - - reference = load_reference(args.reference) - psi = reference.initial_state(CONFIG) - rotations = reference.initial_parameters(CONFIG)["rot"][0] - _, _, htarget = reference.build_hamiltonians(CONFIG) - - current_value, current = measure( - lambda r: current_state(psi, r), rotations, args.repeats - ) - fused_value, fused = measure( - lambda r: fused_state(psi, r), rotations, args.repeats - ) - - def energy(state_function: Callable[[Any, Any], Any], r: Any) -> Any: - state = state_function(psi, r) - return K.real(K.tensordot(K.conj(state), htarget(state), 1)) - - current_energy_grad, current_grad_profile = measure( - jax.value_and_grad(lambda r: energy(current_state, r)), - rotations, - args.repeats, - ) - fused_energy_grad, fused_grad_profile = measure( - jax.value_and_grad(lambda r: energy(fused_state, r)), - rotations, - args.repeats, - ) - current_energy, current_grad = current_energy_grad - fused_energy, fused_grad = fused_energy_grad - - report = { - "schema_version": 1, - "task_id": "06", - "jax_version": jax.__version__, - "jaxlib_version": jax.lib.__version__, - "state_max_abs_error": float( - np.max(np.abs(np.asarray(current_value) - np.asarray(fused_value))) - ), - "energy_abs_error": float( - abs(float(current_energy) - float(fused_energy)) - ), - "gradient_max_abs_error": float( - np.max(np.abs(np.asarray(current_grad) - np.asarray(fused_grad))) - ), - "state_current": current, - "state_fused": fused, - "state_steady_speedup": ( - current["steady_mean_sec"] / fused["steady_mean_sec"] - ), - "energy_gradient_current": current_grad_profile, - "energy_gradient_fused": fused_grad_profile, - "energy_gradient_steady_speedup": ( - current_grad_profile["steady_mean_sec"] - / fused_grad_profile["steady_mean_sec"] - ), - } - rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" - if args.output is not None: - args.output.write_text(rendered, encoding="utf-8") - print(rendered, end="") - - -if __name__ == "__main__": - main() diff --git a/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py b/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py deleted file mode 100644 index ed196c0..0000000 --- a/optimized_solutions/challenge-06/research/profile_hamiltonian_actions.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python3 -"""Compare Task 06 termwise and TensorCircuit-native sparse actions.""" - -from __future__ import annotations - -import argparse -import json -import statistics -import time -from pathlib import Path -from typing import Any, Callable - -import jax -import numpy as np -import tensorcircuit as tc - -from profile_reference import CONFIG, load_reference, ready - - -K = tc.set_backend("jax") -tc.set_dtype("complex64") - - -def pauli_terms(n: int) -> tuple[list[list[int]], list[float], list[list[int]], list[float], list[list[int]], list[float]]: - xy_ls, xy_w = [], [] - for i in range(n - 1): - for p in (1, 2): - s = [0] * n - s[i] = p - s[i + 1] = p - xy_ls.append(s) - xy_w.append(1.0) - - field_ls, field_w = [], [] - for i in range(n): - s = [0] * n - s[i] = 3 - field_ls.append(s) - field_w.append((-1.0) ** i) - - target_ls, target_w = [], [] - for i in range(n - 1): - for p, coefficient in ((1, 0.7), (2, 0.7), (3, 1.1)): - s = [0] * n - s[i] = p - s[i + 1] = p - target_ls.append(s) - target_w.append(coefficient) - for i in range(n): - s = [0] * n - s[i] = 3 - target_ls.append(s) - target_w.append(0.25 * ((-1.0) ** i)) - return xy_ls, xy_w, field_ls, field_w, target_ls, target_w - - -def measure( - function: Callable[[Any], Any], - state: Any, - repeats: int, -) -> tuple[Any, dict[str, Any]]: - compiled = jax.jit(function) - started = time.perf_counter() - value = ready(compiled(state)) - first_sec = time.perf_counter() - started - samples = [] - for _ in range(repeats): - started = time.perf_counter() - value = ready(compiled(state)) - samples.append(time.perf_counter() - started) - return value, { - "first_compile_and_exec_sec": first_sec, - "steady_runtime_sec": samples, - "steady_mean_sec": statistics.mean(samples), - "steady_median_sec": statistics.median(samples), - } - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - "--reference", - type=Path, - default=Path("/workspace/references/task-06/solution_6.py"), - ) - parser.add_argument("--repeats", type=int, default=20) - parser.add_argument("--output", type=Path) - args = parser.parse_args() - - reference = load_reference(args.reference) - hxy_mvp, hfield_mvp, htarget_mvp = reference.build_hamiltonians(CONFIG) - state = reference.initial_state(CONFIG) - terms = pauli_terms(CONFIG["n_qubits"]) - xy_ls, xy_w, field_ls, field_w, target_ls, target_w = terms - - started = time.perf_counter() - hxy_coo = tc.quantum.PauliStringSum2COO(xy_ls, xy_w, numpy=True) - hfield_coo = tc.quantum.PauliStringSum2COO( - field_ls, field_w, numpy=True - ) - htarget_coo = tc.quantum.PauliStringSum2COO( - target_ls, target_w, numpy=True - ) - scipy_build_sec = time.perf_counter() - started - started = time.perf_counter() - hxy_sparse = K.coo_sparse_matrix_from_numpy(hxy_coo) - hfield_sparse = K.coo_sparse_matrix_from_numpy(hfield_coo) - htarget_sparse = K.coo_sparse_matrix_from_numpy(htarget_coo) - backend_convert_sec = time.perf_counter() - started - - j_value = K.cast(K.tanh(K.convert_to_tensor(0.1)), tc.dtypestr) - d_value = K.cast(K.tanh(K.convert_to_tensor(0.1)), tc.dtypestr) - - def termwise_analog(y: Any) -> Any: - return j_value * hxy_mvp(y) + d_value * hfield_mvp(y) - - def sparse_analog(y: Any) -> Any: - return j_value * K.sparse_dense_matmul( - hxy_sparse, y - ) + d_value * K.sparse_dense_matmul(hfield_sparse, y) - - termwise_value, termwise = measure(termwise_analog, state, args.repeats) - sparse_value, sparse = measure(sparse_analog, state, args.repeats) - target_termwise_value, target_termwise = measure( - htarget_mvp, state, args.repeats - ) - target_sparse_value, target_sparse = measure( - lambda y: K.sparse_dense_matmul(htarget_sparse, y), - state, - args.repeats, - ) - - report = { - "schema_version": 1, - "task_id": "06", - "jax_version": jax.__version__, - "jaxlib_version": jax.lib.__version__, - "state_shape": list(state.shape), - "construction": { - "tensorcircuit_coo_numpy_sec": scipy_build_sec, - "backend_sparse_convert_sec": backend_convert_sec, - "xy_nnz": int(hxy_coo.nnz), - "field_nnz": int(hfield_coo.nnz), - "target_nnz": int(htarget_coo.nnz), - }, - "analog_termwise": termwise, - "analog_sparse": sparse, - "analog_max_abs_error": float( - np.max(np.abs(np.asarray(termwise_value) - np.asarray(sparse_value))) - ), - "analog_steady_speedup": ( - termwise["steady_mean_sec"] / sparse["steady_mean_sec"] - ), - "target_termwise": target_termwise, - "target_sparse": target_sparse, - "target_max_abs_error": float( - np.max( - np.abs( - np.asarray(target_termwise_value) - - np.asarray(target_sparse_value) - ) - ) - ), - "target_steady_speedup": ( - target_termwise["steady_mean_sec"] / target_sparse["steady_mean_sec"] - ), - } - rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" - if args.output is not None: - args.output.write_text(rendered, encoding="utf-8") - print(rendered, end="") - - -if __name__ == "__main__": - main() diff --git a/optimized_solutions/challenge-06/research/profile_reference.py b/optimized_solutions/challenge-06/research/profile_reference.py deleted file mode 100644 index d141656..0000000 --- a/optimized_solutions/challenge-06/research/profile_reference.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python3 -"""Profile the immutable Task 06 expert without changing its semantics.""" - -from __future__ import annotations - -import argparse -import importlib.util -import json -import math -import statistics -import time -from pathlib import Path -from typing import Any - -import jax -import optax - - -CONFIG = { - "n_qubits": 14, - "n_blocks": 4, - "t_min": 0.05, - "t_max": 0.50, - "ode_rtol": 1e-6, - "ode_atol": 1e-6, - "ode_max_steps": 16, - "max_steps": 100, - "learning_rate": 0.12, - "maximum_energy_density_gap": 1.0, -} - - -def load_reference(path: Path) -> Any: - spec = importlib.util.spec_from_file_location("task06_immutable_reference", path) - if spec is None or spec.loader is None: - raise RuntimeError(f"cannot import immutable reference: {path}") - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - return module - - -def ready(value: Any) -> Any: - return jax.tree.map( - lambda leaf: leaf.block_until_ready() - if hasattr(leaf, "block_until_ready") - else leaf, - value, - ) - - -def numeric_mapping(value: Any) -> dict[str, float | int | str]: - if not isinstance(value, dict): - return {"repr": str(value)} - result: dict[str, float | int | str] = {} - for key, item in value.items(): - if str(key) not in {"flops", "transcendentals", "bytes accessed"}: - continue - if isinstance(item, bool): - result[str(key)] = int(item) - elif isinstance(item, (int, float)) and math.isfinite(float(item)): - result[str(key)] = item - else: - result[str(key)] = str(item) - return result - - -def memory_mapping(value: Any) -> dict[str, int | str]: - if value is None: - return {} - result: dict[str, int | str] = {} - for name in dir(value): - if name.startswith("_"): - continue - item = getattr(value, name) - if isinstance(item, (int, float, str)): - result[name] = int(item) if isinstance(item, float) else item - return result or {"repr": str(value)} - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - "--reference", - type=Path, - default=Path("/workspace/references/task-06/solution_6.py"), - ) - parser.add_argument("--steady-steps", type=int, default=8) - parser.add_argument("--output", type=Path) - args = parser.parse_args() - - started = time.perf_counter() - reference = load_reference(args.reference) - hxy, hfield, htarget = reference.build_hamiltonians(CONFIG) - psi0 = reference.initial_state(CONFIG) - params = reference.initial_parameters(CONFIG) - optimizer = optax.adam(CONFIG["learning_rate"]) - opt_state = optimizer.init(params) - setup_sec = time.perf_counter() - started - - def loss_fn(p: Any) -> Any: - return reference.forward(p, psi0, hxy, hfield, htarget, CONFIG) - - def train_step(p: Any, state: Any) -> tuple[Any, Any, Any]: - energy, grads = reference.K.value_and_grad(loss_fn)(p) - updates, state = optimizer.update(grads, state, p) - return optax.apply_updates(p, updates), state, energy - - analysis_step = reference.K.jit(train_step) - started = time.perf_counter() - lowered = analysis_step.lower(params, opt_state) - lower_sec = time.perf_counter() - started - started = time.perf_counter() - compiled = lowered.compile() - compile_sec = time.perf_counter() - started - - execution_step = reference.K.jit(train_step) - started = time.perf_counter() - params, opt_state, first_energy = ready(execution_step(params, opt_state)) - first_call_sec = time.perf_counter() - started - - steady: list[float] = [] - energies: list[float] = [] - for _ in range(args.steady_steps): - started = time.perf_counter() - params, opt_state, energy = ready(execution_step(params, opt_state)) - steady.append(time.perf_counter() - started) - energies.append(float(energy)) - - report = { - "schema_version": 1, - "task_id": "06", - "reference_path": str(args.reference), - "config": CONFIG, - "jax_version": jax.__version__, - "jaxlib_version": jax.lib.__version__, - "backend": jax.default_backend(), - "devices": [str(device) for device in jax.devices()], - "setup_sec": setup_sec, - "train_step": { - "lower_sec": lower_sec, - "compile_sec": compile_sec, - "first_call_compile_and_exec_sec": first_call_sec, - "first_energy_density": float(first_energy), - "steady_measurements": len(steady), - "steady_runtime_sec": steady, - "steady_mean_runtime_sec": statistics.mean(steady), - "steady_median_runtime_sec": statistics.median(steady), - "steady_stdev_runtime_sec": statistics.stdev(steady) - if len(steady) > 1 - else 0.0, - "projected_100_exec_sec": 100 * statistics.mean(steady), - "last_profile_energy_density": energies[-1], - "cost_analysis": numeric_mapping(compiled.cost_analysis()), - "memory_analysis": memory_mapping(compiled.memory_analysis()), - }, - } - rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" - if args.output is not None: - args.output.write_text(rendered, encoding="utf-8") - print(rendered, end="") - - -if __name__ == "__main__": - main() diff --git a/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json b/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json deleted file mode 100644 index 25bd7d2..0000000 --- a/optimized_solutions/challenge-06/research/profiles/digital-fusion-profile.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "energy_abs_error": 9.5367431640625e-07, - "energy_gradient_current": { - "first_compile_and_exec_sec": 2.5818883830070263, - "steady_mean_sec": 0.0028042699981597253, - "steady_median_sec": 0.002786983495752793, - "steady_runtime_sec": [ - 0.0032408120023319498, - 0.0028979140042793006, - 0.0027680060011334717, - 0.002777129993773997, - 0.0028117949987063184, - 0.002841833993443288, - 0.002651470000273548, - 0.0027579229936236516, - 0.0027374240016797557, - 0.0027592559927143157, - 0.002817586006131023, - 0.0028222099936101586, - 0.0028002119943266734, - 0.0027968369977315888, - 0.0027248830010648817, - 0.0027986290078843012, - 0.0027597969892667606, - 0.002737131988396868, - 0.0028167529962956905, - 0.002767797006526962 - ] - }, - "energy_gradient_fused": { - "first_compile_and_exec_sec": 2.242138981993776, - "steady_mean_sec": 0.002792609501921106, - "steady_median_sec": 0.002764053009741474, - "steady_runtime_sec": [ - 0.0027992169925710186, - 0.002852089994121343, - 0.0027409290050854906, - 0.002958791999844834, - 0.0029233780078357086, - 0.0027565940108615905, - 0.002754344997811131, - 0.0027691360010067, - 0.0027502619923325256, - 0.0028245490102563053, - 0.002767595011391677, - 0.002734346009674482, - 0.002760511008091271, - 0.002830423996783793, - 0.0027319289947627112, - 0.0028684639983111992, - 0.0028882539918413386, - 0.002754428001935594, - 0.0027409710019128397, - 0.0026459760119905695 - ] - }, - "energy_gradient_steady_speedup": 1.004175483980341, - "gradient_max_abs_error": 9.653085726313293e-07, - "jax_version": "0.10.0", - "jaxlib_version": "0.10.0", - "schema_version": 1, - "state_current": { - "first_compile_and_exec_sec": 0.4338194299925817, - "steady_mean_sec": 0.0006850948993815109, - "steady_median_sec": 0.0006453139940276742, - "steady_runtime_sec": [ - 0.0012672960001509637, - 0.0007143719994928688, - 0.0006452929956139997, - 0.0006379190017469227, - 0.0006916650017956272, - 0.0006989149987930432, - 0.0007329130021389574, - 0.0006453349924413487, - 0.0007069979910738766, - 0.0006307110015768558, - 0.0006171279965201393, - 0.0006374190124915913, - 0.0006193779991008341, - 0.0006167949904920533, - 0.0006572090060217306, - 0.0006267519929679111, - 0.0006608340045204386, - 0.0006484180048573762, - 0.0006112959963502362, - 0.0006352519994834438 - ] - }, - "state_fused": { - "first_compile_and_exec_sec": 0.44715598500624765, - "steady_mean_sec": 0.0006617616993025877, - "steady_median_sec": 0.0006494810004369356, - "steady_runtime_sec": [ - 0.0006994580035097897, - 0.0006269619916565716, - 0.0006670839939033613, - 0.0007521209918195382, - 0.0006388780020643026, - 0.0006632510048802942, - 0.0006493349937954918, - 0.0008115750097204, - 0.0006499190058093518, - 0.0006379200058290735, - 0.0006113380077295005, - 0.0006253359897527844, - 0.0006063379987608641, - 0.0006228779966477305, - 0.000664334002067335, - 0.0006251279992284253, - 0.0006391279894160107, - 0.0006893749959999695, - 0.0007052489963825792, - 0.0006496270070783794 - ] - }, - "state_max_abs_error": 8.940696716308594e-08, - "state_steady_speedup": 1.035259218089402, - "task_id": "06" -} diff --git a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json deleted file mode 100644 index c467589..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-10.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:46:06.470360+00:00", - "finished_at_utc": "2026-07-29T01:46:29.130306+00:00", - "session_wall_sec": 22.659780916001182, - "configuration": { - "repeat": 1, - "max_steps": 10, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 10, - "runtime_sec": 10.912746, - "wall_sec": 12.421574042004067, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", - "container_name": "orbit-task06-matrix-1678675a15", - "shared_container_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", - "shared_container_name": "orbit-task06-matrix-1678675a15", - "shared_session_id": "5d7919a54b1d96d72cf38dd755a04d6eeaea30d2c52f673a0838a745cd6bffef", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-1678675a15", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-y8o0zxpr,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-1678675a15", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "10" - ], - "source_sha256": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "9bca6e59017ae36a8ad4682e7628b1a2516c859746b66d3749145d7517544327", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 10.912746, - "median": 10.912746, - "sample_stdev": null, - "stderr": null, - "min": 10.912746, - "max": 10.912746 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json b/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json deleted file mode 100644 index a53c5ee..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e01-digital-fusion-100.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:46:45.206152+00:00", - "finished_at_utc": "2026-07-29T01:47:39.521547+00:00", - "session_wall_sec": 54.31520862499019, - "configuration": { - "repeat": 1, - "max_steps": 100, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 100, - "runtime_sec": 42.412637, - "wall_sec": 44.00417716699303, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", - "container_name": "orbit-task06-matrix-555a9004bd", - "shared_container_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", - "shared_container_name": "orbit-task06-matrix-555a9004bd", - "shared_session_id": "c7e2db8845430874987638ff1834ec0eccd2df8058f496989257333efbfe2284", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-555a9004bd", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-gqr53rrw,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-555a9004bd", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "100" - ], - "source_sha256": "b240cf7d3db1e1ad2a820c2d375cf58514e30e53591ef081e9c5516e8f1abd90", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "d8fb53582becbfca3765874fa5e433f34c5a1964bcdfc340382a8ef8ffbd18a2", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "ac98e83525a787b1b643f40128cf1b3ebfc4fbcd026b89e2ede379c3fd8a7db0", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 42.412637, - "median": 42.412637, - "sample_stdev": null, - "stderr": null, - "min": 42.412637, - "max": 42.412637 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json deleted file mode 100644 index 1198f7d..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-10.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:48:47.720756+00:00", - "finished_at_utc": "2026-07-29T01:49:09.691268+00:00", - "session_wall_sec": 21.970367166009964, - "configuration": { - "repeat": 1, - "max_steps": 10, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 10, - "runtime_sec": 10.402433, - "wall_sec": 11.776270124973962, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", - "container_name": "orbit-task06-matrix-8653aabf4f", - "shared_container_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", - "shared_container_name": "orbit-task06-matrix-8653aabf4f", - "shared_session_id": "c808ca2de303bd8d2eba80b2ec81bddc748912b675d29fb4c0a491d386f6bcd3", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-8653aabf4f", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-p3j07258,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-8653aabf4f", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "10" - ], - "source_sha256": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "4d0f501b6a6bf69a6141ab7de8037c4c6e3a49f040db86aa6eb6937767199424", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 10.402433, - "median": 10.402433, - "sample_stdev": null, - "stderr": null, - "min": 10.402433, - "max": 10.402433 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json b/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json deleted file mode 100644 index a61512a..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e02-dt0-auto-100.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:49:21.738837+00:00", - "finished_at_utc": "2026-07-29T01:50:15.782750+00:00", - "session_wall_sec": 54.043716875021346, - "configuration": { - "repeat": 1, - "max_steps": 100, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 100, - "runtime_sec": 42.361953, - "wall_sec": 43.83974287498859, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", - "container_name": "orbit-task06-matrix-1025121759", - "shared_container_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", - "shared_container_name": "orbit-task06-matrix-1025121759", - "shared_session_id": "428bf9307da9aadf4acfdf02d887f2a94f1f49272c11751598bb5925d13b52c8", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-1025121759", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lxykqd57,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-1025121759", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "100" - ], - "source_sha256": "b48f232bf75461326bec78a0bfd830f7b634c9ef7b3acbdeffaaec97bc412582", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "9d559823933611ac5a766e1b9457e5af5bc44828301a13a2e70e7fee77e9d90c", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "5a25cb9d6cdab4f5050535db7374843b6aa6ee0ea1e6f68e4bf5d88e725a545e", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 42.361953, - "median": 42.361953, - "sample_stdev": null, - "stderr": null, - "min": 42.361953, - "max": 42.361953 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json b/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json deleted file mode 100644 index b52a762..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e03-final-five-pair.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "recorded_at_utc": "2026-07-29T05:13:09.636685+00:00", - "purpose": "Final five-pair canonical reference-versus-e03 benchmark", - "configuration": { - "repeat": 5, - "max_steps": 100, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true, - "network": "none" - }, - "provenance": { - "image_id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "reference_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "raw_results_sha256": "a7488be88dd1faae070fb7b3efc51564f86fc9a55b51e835a71e9b029fe77a82" - }, - "reference_runtime_sec": [ - 41.389616, - 41.389259, - 41.441489, - 41.58251, - 41.326743 - ], - "candidate_runtime_sec": [ - 27.290641, - 27.643293, - 27.625098, - 27.380896, - 27.743136 - ], - "paired_speedup": [ - 1.516623079685083, - 1.4972622473017236, - 1.5001390764297016, - 1.5186687097456562, - 1.489620459633691 - ], - "summary": { - "reference_mean_sec": 41.4259234, - "reference_stderr_sec": 0.0431630129, - "candidate_mean_sec": 27.5366128, - "candidate_stderr_sec": 0.0856188716, - "ratio_of_means": 1.5043943023, - "mean_paired_speedup": 1.5044627146, - "paired_speedup_stderr": 0.0056591425, - "paired_speedup_95pct_t_ci": [ - 1.488750416, - 1.5201750132 - ], - "runtime_reduction_pct": 33.528065, - "candidate_wins": 5, - "pairs": 5, - "reference_passes": 5, - "candidate_passes": 5 - }, - "runner_note": "The campaign runner's legacy promotion booleans require a six-run known-hash gate. They are inapplicable to this user-requested five-pair comparison; all ten functional benchmark cells passed." -} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json deleted file mode 100644 index 420b046..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-10.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:51:29.233361+00:00", - "finished_at_utc": "2026-07-29T01:51:47.822468+00:00", - "session_wall_sec": 18.588953124999534, - "configuration": { - "repeat": 1, - "max_steps": 10, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 10, - "runtime_sec": 6.866093, - "wall_sec": 8.333335624978645, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", - "container_name": "orbit-task06-matrix-d3469ba8f8", - "shared_container_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", - "shared_container_name": "orbit-task06-matrix-d3469ba8f8", - "shared_session_id": "a13e9aa99a7ffbbfd021334a45436ce50552bc4778b8efe33efe12c8e4a5068d", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-d3469ba8f8", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-yw5yu1ly,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-d3469ba8f8", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "10" - ], - "source_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "4da24031dcf2d6ee85ee9c90058d2084228bd276dee626ffbdc774bac6c49ede", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 6.866093, - "median": 6.866093, - "sample_stdev": null, - "stderr": null, - "min": 6.866093, - "max": 6.866093 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json deleted file mode 100644 index 9998fc2..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-100.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:51:59.361264+00:00", - "finished_at_utc": "2026-07-29T01:52:38.828867+00:00", - "session_wall_sec": 39.46743862499716, - "configuration": { - "repeat": 1, - "max_steps": 100, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "candidate", - "task_id": "06", - "solution": "candidate", - "repeat": 1, - "repeat_index": 1, - "planned_repeats": 1, - "max_steps": 100, - "runtime_sec": 27.747994, - "wall_sec": 29.234428791998653, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", - "container_name": "orbit-task06-matrix-47927c0928", - "shared_container_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", - "shared_container_name": "orbit-task06-matrix-47927c0928", - "shared_session_id": "887b16919fa9d74c4dbad6286f6adf725bfbbcee0541b49471b849d72a701bcf", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-47927c0928", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-tkhc19qz,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-47927c0928", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_candidate", - "--max-steps", - "100" - ], - "source_sha256": "158063c23d609b01c9cf057d2e8574e2b0bb101e781cf770584d8aef2473e2a1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "e3b12b4f3223df60cc73a2ca18eb39e60916ba24809822a4ae52899bdec5cfb7", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-candidate.stdout.txt", - "stderr_path": "logs/cell-01-candidate.stderr.txt", - "stdout_sha256": "b65485324870eafe60699c5dedc2ce6e46f3c36130ede8bdbf70b15b34e27854", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "candidate": { - "n": 1, - "mean": 27.747994, - "median": 27.747994, - "sample_stdev": null, - "stderr": null, - "min": 27.747994, - "max": 27.747994 - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": false, - "candidate_screen_rule_passed": true - } -} diff --git a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json b/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json deleted file mode 100644 index 4b5aa3b..0000000 --- a/optimized_solutions/challenge-06/research/profiles/e03-jaxode-equivalence.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "candidate": "/workspace/src/solutions/task-06/solution_6.py", - "gradient_max_abs_error": { - "tolerance": 0.0005, - "value": 3.3795833587646484e-05 - }, - "initial_energy": { - "abs_error": 7.3909759521484375e-06, - "candidate": -0.5182192325592041, - "reference": -0.5182266235351562, - "tolerance": 5e-05 - }, - "initial_parameter_max_abs_error": 0.0, - "jax_version": "0.10.0", - "jaxlib_version": "0.10.0", - "passed": true, - "post_update_energy": { - "abs_error": 4.76837158203125e-07, - "candidate": -0.5604710578918457, - "reference": -0.5604715347290039, - "tolerance": 0.002 - }, - "post_update_parameter_max_abs_error": 2.9802322387695312e-08, - "reference": "/workspace/references/task-06/solution_6.py", - "schema_version": 1, - "task_id": "06" -} diff --git a/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json b/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json deleted file mode 100644 index 5610480..0000000 --- a/optimized_solutions/challenge-06/research/profiles/hamiltonian-action-profile.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "analog_max_abs_error": 8.713252341863154e-09, - "analog_sparse": { - "first_compile_and_exec_sec": 0.08943686699785758, - "steady_mean_sec": 0.0008518971015291754, - "steady_median_sec": 0.0008482765042572282, - "steady_runtime_sec": [ - 0.0008858420042088255, - 0.0008393379976041615, - 0.0008360450010513887, - 0.000844755006255582, - 0.0008725490042706951, - 0.0008274620049633086, - 0.000855839010910131, - 0.0008237099973484874, - 0.0008112089999485761, - 0.0008252120023826137, - 0.0008550060010747984, - 0.0008262940100394189, - 0.0008593389939051121, - 0.0009520580060780048, - 0.0008142509905155748, - 0.0008607979980297387, - 0.0009232209995388985, - 0.0008520889969076961, - 0.0008517980022588745, - 0.0008211270032916218 - ] - }, - "analog_steady_speedup": 0.29338073819903326, - "analog_termwise": { - "first_compile_and_exec_sec": 0.17884002199571114, - "steady_mean_sec": 0.0002499302005162463, - "steady_median_sec": 0.00024769250012468547, - "steady_runtime_sec": [ - 0.00027211201086174697, - 0.00025540099886711687, - 0.00027344500995241106, - 0.00024927599588409066, - 0.00024569300876464695, - 0.00023527500161435455, - 0.0002456090005580336, - 0.00024610898981336504, - 0.00023514899658039212, - 0.00025477699819020927, - 0.0002434419875498861, - 0.0002498179965186864, - 0.0002512759965611622, - 0.0002601100131869316, - 0.00023652399249840528, - 0.0002437759976601228, - 0.0002396500058239326, - 0.00025940200430341065, - 0.00024610900436528027, - 0.0002556510007707402 - ] - }, - "construction": { - "backend_sparse_convert_sec": 0.0016592979955021292, - "field_nnz": 12952, - "target_nnz": 229376, - "tensorcircuit_coo_numpy_sec": 0.4132378780050203, - "xy_nnz": 212992 - }, - "jax_version": "0.10.0", - "jaxlib_version": "0.10.0", - "schema_version": 1, - "state_shape": [ - 16384 - ], - "target_max_abs_error": 1.9073486328125e-06, - "target_sparse": { - "first_compile_and_exec_sec": 0.07549469900550321, - "steady_mean_sec": 0.001209446798748104, - "steady_median_sec": 0.0011963539946009405, - "steady_runtime_sec": [ - 0.0013805189955746755, - 0.0012033749953843653, - 0.001289592997636646, - 0.0011987079924438149, - 0.0011907490115845576, - 0.0011937499948544428, - 0.0012134599965065718, - 0.0011802899971371517, - 0.001178746999357827, - 0.0011966249876422808, - 0.0011960830015596002, - 0.0012055010010953993, - 0.001218627003254369, - 0.001236128999153152, - 0.0011803310044342652, - 0.0012083759938832372, - 0.0011735389998648316, - 0.0011857479985337704, - 0.0011812890006694943, - 0.0011774970043916255 - ] - }, - "target_steady_speedup": 0.28472947313686203, - "target_termwise": { - "first_compile_and_exec_sec": 0.18091756899957545, - "steady_mean_sec": 0.00034436514979461206, - "steady_median_sec": 0.00034241149842273444, - "steady_runtime_sec": [ - 0.00036133000685367733, - 0.0003928320074919611, - 0.00034616100310813636, - 0.0003495779965305701, - 0.00035653699887916446, - 0.00032990999170579016, - 0.00033732700103428215, - 0.0003459529980318621, - 0.0003472440002951771, - 0.00033341000380460173, - 0.00034107700048480183, - 0.0003434529935475439, - 0.00034145299287047237, - 0.00035295300767757, - 0.00033670099219307303, - 0.0003222840023227036, - 0.0003433700039749965, - 0.000333075993694365, - 0.000333243006025441, - 0.0003394109953660518 - ] - }, - "task_id": "06" -} diff --git a/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json b/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json deleted file mode 100644 index 85505a7..0000000 --- a/optimized_solutions/challenge-06/research/profiles/reference-baseline-six.json +++ /dev/null @@ -1,637 +0,0 @@ -{ - "schema_version": 1, - "task_id": "06", - "started_at_utc": "2026-07-29T01:29:10.211307+00:00", - "finished_at_utc": "2026-07-29T01:34:01.556945+00:00", - "session_wall_sec": 291.34517045799294, - "configuration": { - "repeat": 6, - "max_steps": 100, - "timeout_sec": 300.0, - "cpus": 6.0, - "memory": "7g", - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": true, - "single_container": true - }, - "host": { - "uname": "Darwin QQYdeMacBook-Air.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:34 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8112 arm64", - "cpu": "Apple M2", - "physical_memory": "17179869184", - "fingerprint_sha256": "8188765e4acb94ead1ba5de9e79cb6cb2be366ecfa06948a06df2ef871880aab" - }, - "image": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "snapshot": { - "reference": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "candidate": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "sitecustomize": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120" - }, - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "results": [ - { - "cell_id": "task06-01", - "pair": 1, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 1, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 43.9766, - "wall_sec": 45.8386168750003, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-01-reference.stdout.txt", - "stderr_path": "logs/cell-01-reference.stderr.txt", - "stdout_sha256": "46ecdcb6d91fea140065df6933b0baf5767f445028b51460ac596a6dc2259148", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 1, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - }, - { - "cell_id": "task06-02", - "pair": 2, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 2, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 45.097434, - "wall_sec": 46.916985250019934, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-02-reference.stdout.txt", - "stderr_path": "logs/cell-02-reference.stderr.txt", - "stdout_sha256": "2d569f1ecc51e83d7cc30396a3cac12f44b9bef149affd6a8d6d6344cab60629", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 2, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - }, - { - "cell_id": "task06-03", - "pair": 3, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 3, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 44.415753, - "wall_sec": 46.19435454098857, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-03-reference.stdout.txt", - "stderr_path": "logs/cell-03-reference.stderr.txt", - "stdout_sha256": "18b7f74580a7cecba355cee577ecd7a317894cff6748c50ab0c8ef5d1a1db98d", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 3, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - }, - { - "cell_id": "task06-04", - "pair": 4, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 4, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 44.864424, - "wall_sec": 46.61729741698946, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-04-reference.stdout.txt", - "stderr_path": "logs/cell-04-reference.stderr.txt", - "stdout_sha256": "b3540a887487f023ccb9efcdf0b0b91868fa6d05517dba88d3c62981d221841d", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 4, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - }, - { - "cell_id": "task06-05", - "pair": 5, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 5, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 45.4811, - "wall_sec": 47.27104333299212, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-05-reference.stdout.txt", - "stderr_path": "logs/cell-05-reference.stderr.txt", - "stdout_sha256": "badeda14bfce7660b4e609e8e7ce8f278aef28a7498608e1a7761c8c0abd2205", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 5, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - }, - { - "cell_id": "task06-06", - "pair": 6, - "position": 1, - "order": "reference", - "task_id": "06", - "solution": "reference", - "repeat_index": 6, - "planned_repeats": 6, - "max_steps": 100, - "runtime_sec": 46.387673, - "wall_sec": 48.185412082995754, - "passed": true, - "timed_out": false, - "terminal_status": "SUCCESS", - "returncode": 0, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": { - "reference": "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "id": "sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "repo_digests": [ - "challenge-benchmark-quantum-tensorcircuit@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833", - "orbitbreakers-expert-benchmarks@sha256:b059c5fa7f75702f9afbf94ec7866e102ac32afd59d25634ec0aca0fd56e2833" - ], - "created": "2026-07-27T22:15:05.362478611+08:00", - "architecture": "arm64", - "os": "linux" - }, - "container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "container_name": "orbit-task06-matrix-07a53e9280", - "shared_container_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_name": "orbit-task06-matrix-07a53e9280", - "shared_session_id": "1fa702c5e378d6fe56204355b7012c69045ce49dae17a9bd890eef185e83a8d5", - "shared_container_start_command": [ - "docker", - "run", - "--detach", - "--rm", - "--name", - "orbit-task06-matrix-07a53e9280", - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - "type=bind,src=/Users/qqy/.codex/visualizations/2026/07/28/019fa982-7244-7e20-99f5-f609bdd0cf27/task06-extreme/.tmp/task06-matrix-lvmto1p5,dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - "6.0", - "--memory", - "7g", - "orbitbreakers-expert-benchmarks:tensorcircuit-py311", - "tail", - "-f", - "/dev/null" - ], - "cpu_limit": "6.0", - "memory_limit": "7g", - "timeout_sec": 300.0, - "source_sha256": "0e7fec8d11135241eb3f3501f3651f3f337e08c636407b3da8a2858c2b3d85d1", - "evaluator_sha256": "0d2dfc7f30087896fb599925f9110190a3a61358263688dbb09cc36115a23998", - "staging_snapshot_sha256": "07285f8d9037983df3d624b3377f56fa1db96077b4885987c2cf9c69dcc44b2f", - "compatibility_sha256": "02800060761f2b15abe9055aded49d2af3877ab93d7b0fae8af94b30bac30120", - "stdout_path": "logs/cell-06-reference.stdout.txt", - "stderr_path": "logs/cell-06-reference.stderr.txt", - "stdout_sha256": "35161dd3fcb325d66ea4d882fff072eb107b19ea814dd4b5d5e08b2e31f47267", - "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "repeat": 6, - "command": [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "orbit-task06-matrix-07a53e9280", - "python", - "/session/evaluate_6.py", - "--solution", - "solution_6_reference", - "--max-steps", - "100" - ] - } - ], - "pairs": [], - "summary": { - "all_cells_passed": true, - "reference": { - "n": 6, - "mean": 45.037164, - "median": 44.980929, - "sample_stdev": 0.8444374388542941, - "stderr": 0.34474014081594845, - "min": 43.9766, - "max": 46.387673 - }, - "candidate": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "ratio_of_means_speedup": null, - "ratio_of_means_improvement_pct": null, - "paired_speedup": { - "n": 0, - "mean": null, - "median": null, - "sample_stdev": null, - "stderr": null, - "min": null, - "max": null - }, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": null, - "high": null - }, - "candidate_wins": 0, - "promotion_rule_passed": false, - "reference_baseline_rule_passed": true - }, - "recovery_note": "The runner omitted the repeat alias and exact docker-exec command from serialized rows; both fields were deterministically reconstructed from the unmodified checkpoint rows after all six raw logs and measurements completed. No runtime, status, hash, order, or output value changed." -} diff --git a/optimized_solutions/challenge-06/research/profiles/reference-profile.json b/optimized_solutions/challenge-06/research/profiles/reference-profile.json deleted file mode 100644 index 803c929..0000000 --- a/optimized_solutions/challenge-06/research/profiles/reference-profile.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "backend": "cpu", - "config": { - "learning_rate": 0.12, - "max_steps": 100, - "maximum_energy_density_gap": 1.0, - "n_blocks": 4, - "n_qubits": 14, - "ode_atol": 1e-06, - "ode_max_steps": 16, - "ode_rtol": 1e-06, - "t_max": 0.5, - "t_min": 0.05 - }, - "devices": [ - "cpu:0" - ], - "jax_version": "0.10.0", - "jaxlib_version": "0.10.0", - "reference_path": "/workspace/references/task-06/solution_6.py", - "schema_version": 1, - "setup_sec": 0.25592545000836253, - "task_id": "06", - "train_step": { - "compile_sec": 3.194720548999612, - "cost_analysis": { - "bytes accessed": 101158672.0, - "flops": 23524274.0, - "transcendentals": 525.0 - }, - "first_call_compile_and_exec_sec": 0.2790715420123888, - "first_energy_density": -0.5182266235351562, - "last_profile_energy_density": -1.1060307025909424, - "lower_sec": 2.851042841997696, - "memory_analysis": { - "alias_size_in_bytes": 0, - "argument_size_in_bytes": 2164, - "generated_code_size_in_bytes": 0, - "host_alias_size_in_bytes": 0, - "host_argument_size_in_bytes": 0, - "host_generated_code_size_in_bytes": 0, - "host_output_size_in_bytes": 0, - "host_temp_size_in_bytes": 0, - "output_size_in_bytes": 2280, - "peak_memory_in_bytes": 137809, - "temp_size_in_bytes": 18776480 - }, - "projected_100_exec_sec": 28.050100437576475, - "steady_mean_runtime_sec": 0.28050100437576475, - "steady_measurements": 8, - "steady_median_runtime_sec": 0.27417020649590995, - "steady_runtime_sec": [ - 0.2754821550042834, - 0.2717890040075872, - 0.2721566330001224, - 0.2728582579875365, - 0.27139141800580546, - 0.2921714349940885, - 0.2921290020021843, - 0.2960301300045103 - ], - "steady_stdev_runtime_sec": 0.010854067648848095 - } -} diff --git a/optimized_solutions/challenge-06/research/run_docker_matrix.py b/optimized_solutions/challenge-06/research/run_docker_matrix.py deleted file mode 100644 index 5a62592..0000000 --- a/optimized_solutions/challenge-06/research/run_docker_matrix.py +++ /dev/null @@ -1,463 +0,0 @@ -#!/usr/bin/env python3 -"""Run Task 06 reference baselines or counterbalanced pairs in one container.""" - -from __future__ import annotations - -import argparse -import hashlib -import json -import math -import re -import shutil -import statistics -import subprocess -import tempfile -import time -import uuid -from datetime import datetime, timezone -from pathlib import Path - - -ROOT = Path(__file__).resolve().parents[2] -RUNTIME_RE = re.compile(r"End-to-end solution time:\s*([0-9.]+)s") -T_CRITICAL_95 = { - 4: 2.7764451052, - 5: 2.5705818366, -} - - -def sha256(path: Path) -> str: - return hashlib.sha256(path.read_bytes()).hexdigest() - - -def utc_now() -> str: - return datetime.now(timezone.utc).isoformat() - - -def run(command: list[str], timeout: float = 30) -> subprocess.CompletedProcess[str]: - return subprocess.run( - command, - check=False, - text=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - timeout=timeout, - ) - - -def stats(values: list[float]) -> dict[str, float | int | None]: - stdev = statistics.stdev(values) if len(values) > 1 else None - return { - "n": len(values), - "mean": statistics.mean(values) if values else None, - "median": statistics.median(values) if values else None, - "sample_stdev": stdev, - "stderr": stdev / math.sqrt(len(values)) if stdev is not None else None, - "min": min(values) if values else None, - "max": max(values) if values else None, - } - - -def host_record() -> dict[str, object]: - commands = { - "uname": ["uname", "-a"], - "cpu": ["sysctl", "-n", "machdep.cpu.brand_string"], - "physical_memory": ["sysctl", "-n", "hw.memsize"], - } - record: dict[str, object] = {} - for key, command in commands.items(): - try: - result = run(command) - record[key] = result.stdout.strip() if result.returncode == 0 else None - except (OSError, subprocess.TimeoutExpired): - record[key] = None - record["fingerprint_sha256"] = hashlib.sha256( - json.dumps(record, sort_keys=True).encode() - ).hexdigest() - return record - - -def image_record(reference: str) -> dict[str, object]: - result = run(["docker", "image", "inspect", reference]) - if result.returncode: - raise RuntimeError(result.stderr.strip() or f"cannot inspect {reference}") - raw = json.loads(result.stdout)[0] - return { - "reference": reference, - "id": raw.get("Id"), - "repo_digests": raw.get("RepoDigests") or [], - "created": raw.get("Created"), - "architecture": raw.get("Architecture"), - "os": raw.get("Os"), - } - - -def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser() - parser.add_argument("--repeat", type=int, default=6) - parser.add_argument("--max-steps", type=int, default=100) - parser.add_argument("--timeout", type=float, default=300.0) - parser.add_argument("--cpus", type=float, default=6.0) - parser.add_argument("--memory", default="7g") - parser.add_argument( - "--reference-only", - action="store_true", - help="Run only the immutable expert; useful for the six-run baseline gate.", - ) - parser.add_argument( - "--candidate-only", - action="store_true", - help="Run only the editable candidate for reduced or canonical screening.", - ) - parser.add_argument( - "--image", - default="orbitbreakers-expert-benchmarks:tensorcircuit-py311", - ) - parser.add_argument("--output", type=Path, required=True) - return parser.parse_args() - - -def main() -> None: - args = parse_args() - if args.repeat <= 0 or args.max_steps <= 0: - raise SystemExit("repeat and max-steps must be positive") - if args.reference_only and args.candidate_only: - raise SystemExit("reference-only and candidate-only are mutually exclusive") - timeout = min(args.timeout, 300.0) - output = args.output.expanduser().resolve() - logs = output / "logs" - logs.mkdir(parents=True, exist_ok=True) - - sources = { - "reference": ROOT / "references/task-06/solution_6.py", - "candidate": ROOT / "src/solutions/task-06/solution_6.py", - } - evaluator = ROOT / "tasks/task-06/evaluator/evaluate_6.py" - sitecustomize = ROOT / "envs/tensorcircuit-py311/sitecustomize.py" - for path in [*sources.values(), evaluator, sitecustomize]: - if not path.is_file(): - raise SystemExit(f"missing required file: {path}") - - image = image_record(args.image) - host = host_record() - container_name = f"orbit-task06-matrix-{uuid.uuid4().hex[:10]}" - started_at = utc_now() - session_started = time.perf_counter() - rows: list[dict[str, object]] = [] - - staging_root = ROOT / ".tmp" - staging_root.mkdir(exist_ok=True) - with tempfile.TemporaryDirectory(prefix="task06-matrix-", dir=staging_root) as tmp: - staging = Path(tmp) - shutil.copy2(evaluator, staging / "evaluate_6.py") - environment = staging / "environment" - environment.mkdir() - shutil.copy2(sitecustomize, environment / "sitecustomize.py") - modules: dict[str, str] = {} - snapshot: dict[str, str] = {} - for role, source in sources.items(): - module = f"solution_6_{role}" - modules[role] = module - target = staging / f"{module}.py" - shutil.copy2(source, target) - snapshot[role] = sha256(target) - snapshot["evaluator"] = sha256(staging / "evaluate_6.py") - snapshot["sitecustomize"] = sha256(environment / "sitecustomize.py") - snapshot_sha256 = hashlib.sha256( - json.dumps(snapshot, sort_keys=True).encode() - ).hexdigest() - - start_command = [ - "docker", - "run", - "--detach", - "--rm", - "--name", - container_name, - "--network", - "none", - "--tmpfs", - "/tmp:rw,noexec,nosuid,size=1g", - "--mount", - f"type=bind,src={staging.resolve()},dst=/session,readonly", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - "--cpus", - str(args.cpus), - "--memory", - args.memory, - args.image, - "tail", - "-f", - "/dev/null", - ] - started = run(start_command, timeout=60) - if started.returncode: - raise SystemExit(started.stderr.strip() or "container start failed") - container_id = started.stdout.strip() - - plan: list[tuple[int, int, str, str]] = [] - for pair in range(1, args.repeat + 1): - if args.reference_only: - roles = ("reference",) - elif args.candidate_only: - roles = ("candidate",) - else: - roles = ( - ("reference", "candidate") - if pair % 2 - else ("candidate", "reference") - ) - order = "->".join(roles) - for position, role in enumerate(roles, start=1): - plan.append((pair, position, role, order)) - - try: - for cell, (pair, position, role, order) in enumerate(plan, start=1): - command = [ - "docker", - "exec", - "--workdir", - "/session", - "--env", - "NUMBA_DISABLE_JIT=1", - "--env", - "PYTHONPATH=/session:/session/environment", - container_name, - "python", - "/session/evaluate_6.py", - "--solution", - modules[role], - "--max-steps", - str(args.max_steps), - ] - wall_started = time.perf_counter() - timed_out = False - try: - result = run(command, timeout=timeout) - stdout, stderr, returncode = ( - result.stdout, - result.stderr, - result.returncode, - ) - except subprocess.TimeoutExpired as exc: - timed_out = True - stdout = exc.stdout or "" - stderr = exc.stderr or "" - returncode = None - wall_sec = time.perf_counter() - wall_started - stdout_path = logs / f"cell-{cell:02d}-{role}.stdout.txt" - stderr_path = logs / f"cell-{cell:02d}-{role}.stderr.txt" - stdout_path.write_text(stdout, encoding="utf-8") - stderr_path.write_text(stderr, encoding="utf-8") - match = RUNTIME_RE.search(stdout) - runtime = float(match.group(1)) if match else None - passed = ( - not timed_out - and returncode == 0 - and runtime is not None - and "Overall: PASS" in stdout - ) - row = { - "cell_id": f"task06-{cell:02d}", - "pair": pair, - "position": position, - "order": order, - "task_id": "06", - "solution": role, - "repeat": pair, - "repeat_index": pair, - "planned_repeats": args.repeat, - "max_steps": args.max_steps, - "runtime_sec": runtime, - "wall_sec": wall_sec, - "passed": passed, - "timed_out": timed_out, - "terminal_status": "SUCCESS" if passed else "FAILED", - "returncode": returncode, - "engine": "docker", - "environment": "tensorcircuit-py311", - "environment_image_provenance": image, - "container_id": container_id, - "container_name": container_name, - "shared_container_id": container_id, - "shared_container_name": container_name, - "shared_session_id": container_id, - "shared_container_start_command": start_command, - "cpu_limit": str(args.cpus), - "memory_limit": args.memory, - "timeout_sec": timeout, - "command": command, - "source_sha256": snapshot[role], - "evaluator_sha256": snapshot["evaluator"], - "staging_snapshot_sha256": snapshot_sha256, - "compatibility_sha256": snapshot["sitecustomize"], - "stdout_path": str(stdout_path.relative_to(output)), - "stderr_path": str(stderr_path.relative_to(output)), - "stdout_sha256": sha256(stdout_path), - "stderr_sha256": sha256(stderr_path), - } - rows.append(row) - (output / "checkpoint.json").write_text( - json.dumps( - { - "schema_version": 1, - "task_id": "06", - "configuration": { - "repeat": args.repeat, - "max_steps": args.max_steps, - "cpus": args.cpus, - "memory": args.memory, - }, - "host": host, - "image": image, - "snapshot": snapshot, - "staging_snapshot_sha256": snapshot_sha256, - "results": rows, - }, - indent=2, - ) - + "\n", - encoding="utf-8", - ) - print( - f"cell {cell:02d}/{len(plan)} pair={pair} role={role} " - f"runtime={runtime} passed={passed}", - flush=True, - ) - finally: - run(["docker", "stop", container_name], timeout=60) - - reference = [ - float(row["runtime_sec"]) - for row in rows - if row["solution"] == "reference" and row["passed"] - ] - candidate = [ - float(row["runtime_sec"]) - for row in rows - if row["solution"] == "candidate" and row["passed"] - ] - by_pair: dict[int, dict[str, float]] = {} - for row in rows: - if row["passed"]: - by_pair.setdefault(int(row["pair"]), {})[str(row["solution"])] = float( - row["runtime_sec"] - ) - pair_rows = [] - speedups = [] - for pair in sorted(by_pair): - values = by_pair[pair] - if set(values) == {"reference", "candidate"}: - speedup = values["reference"] / values["candidate"] - speedups.append(speedup) - pair_rows.append( - { - "pair": pair, - "reference_runtime_sec": values["reference"], - "candidate_runtime_sec": values["candidate"], - "speedup": speedup, - "candidate_won": values["candidate"] < values["reference"], - } - ) - - speedup_stats = stats(speedups) - ci_low = ci_high = None - if len(speedups) > 1: - critical = T_CRITICAL_95.get(len(speedups) - 1) - if critical is not None: - radius = critical * float(speedup_stats["stderr"]) - ci_low = float(speedup_stats["mean"]) - radius - ci_high = float(speedup_stats["mean"]) + radius - ref_stats, cand_stats = stats(reference), stats(candidate) - single_role = args.reference_only or args.candidate_only - expected_cells = args.repeat if single_role else 2 * args.repeat - all_passed = len(rows) == expected_cells and all(row["passed"] for row in rows) - promotion = ( - not single_role - and all_passed - and len(speedups) == args.repeat - and float(cand_stats["mean"]) < float(ref_stats["mean"]) - and float(cand_stats["median"]) < float(ref_stats["median"]) - and sum(row["candidate_won"] for row in pair_rows) - >= math.ceil(0.8 * args.repeat) - and ci_low is not None - and ci_low > 1.0 - ) - report = { - "schema_version": 1, - "task_id": "06", - "started_at_utc": started_at, - "finished_at_utc": utc_now(), - "session_wall_sec": time.perf_counter() - session_started, - "configuration": { - "repeat": args.repeat, - "max_steps": args.max_steps, - "timeout_sec": timeout, - "cpus": args.cpus, - "memory": args.memory, - "pair_order": "odd reference->candidate; even candidate->reference", - "fresh_evaluator_process_per_cell": True, - "single_container": True, - }, - "host": host, - "image": image, - "snapshot": snapshot, - "staging_snapshot_sha256": snapshot_sha256, - "results": rows, - "pairs": pair_rows, - "summary": { - "all_cells_passed": all_passed, - "reference": ref_stats, - "candidate": cand_stats, - "ratio_of_means_speedup": ( - float(ref_stats["mean"]) / float(cand_stats["mean"]) - if reference and candidate - else None - ), - "ratio_of_means_improvement_pct": ( - 100 - * (float(ref_stats["mean"]) - float(cand_stats["mean"])) - / float(ref_stats["mean"]) - if reference and candidate - else None - ), - "paired_speedup": speedup_stats, - "paired_speedup_ci_95": { - "method": "two-sided Student-t interval on mean pairwise speedup", - "low": ci_low, - "high": ci_high, - }, - "candidate_wins": sum(row["candidate_won"] for row in pair_rows), - "promotion_rule_passed": promotion, - "reference_baseline_rule_passed": ( - args.reference_only - and all_passed - and len(reference) == args.repeat - and args.repeat >= 6 - ), - "candidate_screen_rule_passed": ( - args.candidate_only and all_passed and len(candidate) == args.repeat - ), - }, - } - (output / "results.json").write_text( - json.dumps(report, indent=2) + "\n", encoding="utf-8" - ) - print(json.dumps(report["summary"], indent=2), flush=True) - if args.reference_only: - if not report["summary"]["reference_baseline_rule_passed"]: - raise SystemExit(1) - elif args.candidate_only: - if not report["summary"]["candidate_screen_rule_passed"]: - raise SystemExit(1) - elif not promotion: - raise SystemExit(1) - - -if __name__ == "__main__": - main() diff --git a/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py b/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py deleted file mode 100644 index f267864..0000000 --- a/optimized_solutions/challenge-06/research/validate_candidate_equivalence.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python3 -"""Compare Task 06 reference/candidate energy, gradient, and one Adam update.""" - -from __future__ import annotations - -import argparse -import importlib.util -import json -from pathlib import Path -from typing import Any - -import jax -import numpy as np -import optax - -from profile_reference import CONFIG, ready - - -def load_module(name: str, path: Path) -> Any: - spec = importlib.util.spec_from_file_location(name, path) - if spec is None or spec.loader is None: - raise RuntimeError(f"cannot import {path}") - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - return module - - -def loss_factory(module: Any) -> tuple[Any, Any]: - hxy, hfield, htarget = module.build_hamiltonians(CONFIG) - psi0 = module.initial_state(CONFIG) - params = module.initial_parameters(CONFIG) - - def loss(p: Any) -> Any: - return module.forward(p, psi0, hxy, hfield, htarget, CONFIG) - - return params, loss - - -def tree_max_abs_difference(left: Any, right: Any) -> float: - differences = [ - np.max(np.abs(np.asarray(a) - np.asarray(b))) - for a, b in zip(jax.tree.leaves(left), jax.tree.leaves(right)) - ] - return float(max(differences, default=0.0)) - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - "--reference", - type=Path, - default=Path("/workspace/references/task-06/solution_6.py"), - ) - parser.add_argument( - "--candidate", - type=Path, - default=Path("/workspace/src/solutions/task-06/solution_6.py"), - ) - parser.add_argument("--output", type=Path) - args = parser.parse_args() - - reference = load_module("task06_reference_audit", args.reference) - candidate = load_module("task06_candidate_audit", args.candidate) - reference_params, reference_loss = loss_factory(reference) - candidate_params, candidate_loss = loss_factory(candidate) - - reference_energy, reference_grads = ready( - jax.jit(jax.value_and_grad(reference_loss))(reference_params) - ) - candidate_energy, candidate_grads = ready( - jax.jit(jax.value_and_grad(candidate_loss))(candidate_params) - ) - - optimizer = optax.adam(CONFIG["learning_rate"]) - reference_state = optimizer.init(reference_params) - candidate_state = optimizer.init(candidate_params) - reference_updates, reference_state = optimizer.update( - reference_grads, reference_state, reference_params - ) - candidate_updates, candidate_state = optimizer.update( - candidate_grads, candidate_state, candidate_params - ) - reference_post_params = optax.apply_updates( - reference_params, reference_updates - ) - candidate_post_params = optax.apply_updates( - candidate_params, candidate_updates - ) - reference_post_energy = ready(jax.jit(reference_loss)(reference_post_params)) - candidate_post_energy = ready(jax.jit(candidate_loss)(candidate_post_params)) - - report = { - "schema_version": 1, - "task_id": "06", - "reference": str(args.reference), - "candidate": str(args.candidate), - "jax_version": jax.__version__, - "jaxlib_version": jax.lib.__version__, - "initial_parameter_max_abs_error": tree_max_abs_difference( - reference_params, candidate_params - ), - "initial_energy": { - "reference": float(reference_energy), - "candidate": float(candidate_energy), - "abs_error": abs(float(reference_energy) - float(candidate_energy)), - "tolerance": 5e-5, - }, - "gradient_max_abs_error": { - "value": tree_max_abs_difference(reference_grads, candidate_grads), - "tolerance": 5e-4, - }, - "post_update_parameter_max_abs_error": tree_max_abs_difference( - reference_post_params, candidate_post_params - ), - "post_update_energy": { - "reference": float(reference_post_energy), - "candidate": float(candidate_post_energy), - "abs_error": abs( - float(reference_post_energy) - float(candidate_post_energy) - ), - "tolerance": 2e-3, - }, - } - report["passed"] = bool( - report["initial_parameter_max_abs_error"] == 0.0 - and report["initial_energy"]["abs_error"] - <= report["initial_energy"]["tolerance"] - and report["gradient_max_abs_error"]["value"] - <= report["gradient_max_abs_error"]["tolerance"] - and report["post_update_energy"]["abs_error"] - <= report["post_update_energy"]["tolerance"] - ) - rendered = json.dumps(report, indent=2, sort_keys=True) + "\n" - if args.output is not None: - args.output.write_text(rendered, encoding="utf-8") - print(rendered, end="") - if not report["passed"]: - raise SystemExit(1) - - -if __name__ == "__main__": - main() From a3ad07b90be9b82a58eabd46a05290eb7da39fec Mon Sep 17 00:00:00 2001 From: qingyunqian Date: Thu, 30 Jul 2026 13:34:05 +0800 Subject: [PATCH 3/3] Clarify Task 06 factor attribution --- optimized_solutions/challenge-06/README.md | 6 + .../challenge-06/factor-ablation.svg | 3060 +++-------------- 2 files changed, 433 insertions(+), 2633 deletions(-) diff --git a/optimized_solutions/challenge-06/README.md b/optimized_solutions/challenge-06/README.md index e70bc87..da3dc53 100644 --- a/optimized_solutions/challenge-06/README.md +++ b/optimized_solutions/challenge-06/README.md @@ -15,6 +15,12 @@ ![Task 06 factor ablation](factor-ablation.svg) +*Figure — Each panel normalizes the recommended implementation to `1.0x`. +Removing native `jaxode` produces the dominant slowdown. Euler fusion helps +mainly in the cold kernel, while sparse BCOO actions are substantially slower. +The panels retain their stated canonical-screen or isolated-profile context +and are not multiplied.* + ## What the factors mean - **Native `jaxode`:** run the same `tc.timeevol.ode_evol_global` problem diff --git a/optimized_solutions/challenge-06/factor-ablation.svg b/optimized_solutions/challenge-06/factor-ablation.svg index 4538643..5738920 100644 --- a/optimized_solutions/challenge-06/factor-ablation.svg +++ b/optimized_solutions/challenge-06/factor-ablation.svg @@ -1,7 +1,7 @@ - + @@ -20,2850 +20,644 @@ - - - + + + + + + - - - - - - - - - - - - - - - - - - + With jaxode + 27.75 s - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Without + 42.41 s + + + + + + + + + + + + + + + + 0.0 + - + - + - - - - - - - - - - - - - - - - - - - - + + + + + 0.2 + - + - + - - - - - - - - - - - - - - - - + + + + + 0.4 + - - - + - + - - - - - + + + + + 0.6 + - + - + - - - - - - - - - + + + + + 0.8 + - + - + - - - - - - - - - + + + + + 1.0 + - + - + - - - - - - - - - + + + + + 1.2 + - + - + - - - - - - - - - + + + + + 1.4 + - + - + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 1.6 + + Runtime normalized to recommended + - + - + - +" clip-path="url(#pfb3b336fcc)" style="fill: #4472c4; stroke: #333333; stroke-width: 0.55; stroke-linejoin: miter"/> - - - - - - - - - - - - - - - - - - - - - - - - - - +" clip-path="url(#pfb3b336fcc)" style="fill: #c44e52; stroke: #333333; stroke-width: 0.55; stroke-linejoin: miter"/> - - - - - - - - + single canonical screen - - - - - - - - + a - - - - - - - - - - - + 1.000× - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1.528× + + + Native jaxode → Diffrax + + + - - + - - - - - - - - - - - - - - - - - - + + + + + + Fused + - + - - - - - - - - - - - - - - - - - + + + + Unfused + - - - + + + - - - - - - - + + + + + 0.0 + - - - + + + - - - - - - - + + + + + 0.2 + - - - + + + - - - - - - - + + + + + 0.4 + - - - + + + - - - - - - - + + + + + 0.6 + - - - + + + - - - - - - - + + + + + 0.8 + - - - + + + - - - - - - - + + + + + 1.0 + - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 1.2 - - - - - - - - + + - - + + - - + + - - + + - - - - - - - - - - - - + cold kernel; steady gain 1.004× - - - - - - - - - + b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1.000× - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1.152× + + + Fused Euler gate → three gates + + + - - + - + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + Recommended + + + + + + + + Rejected BCOO + - + + + + + + + + + + + 0.0 + + + - + - - - - - - - + + + + + 0.5 + - + - + - - - - - - - + + + + + 1.0 + - + - + - - - - - - - + + + + + 1.5 + - + - + - - - - - - - + + + + + 2.0 + - + - + - - - - - - - + + + - - - - - - - - - - - - - + + 2.5 - - - + + + - - - - - - - + + + - - - - - - - - - - - - + 3.0 - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 3.5 - - - - - - - - + + - - + + - - + + - - + + - - + + isolated actions: 3.4–3.5× slower - - - - - - - - + c - - - - - - - - + 1.000× - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 3.4–3.5× - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Termwise MVP → sparse BCOO + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Task 06 factor ablations — TensorCircuit native jaxode supplies the end-to-end gain + + + Panels use the tracked canonical screen or isolated component profile named above; they are explanatory, not multiplicative. - - + + - - + + - - + +