From d9a0aa69d8815eaeb01901f0b018523cb8a34b6e Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Wed, 14 Oct 2026 11:50:24 +0000 Subject: [PATCH 1/2] Tooling: cache binary-phase basis/contains for parity-side replay Memoize basis on row tuples and reduce contains against one basis so the historical parity-side audit keeps identical h=8/10/26 receipts while the three binding certificates change only the binary_phase_frames.py pin. --- certificates/disjoint-tensor-compression.json | 2 +- certificates/dyadic-central-factor.json | 2 +- certificates/parity-side.json | 2 +- research/parity-side-basis-cache/NOTICE.md | 16 ++ research/parity-side-basis-cache/README.md | 83 ++++++ research/parity-side-basis-cache/SOURCES.json | 84 ++++++ research/parity-side-basis-cache/TASK.json | 70 +++++ research/parity-side-basis-cache/VERIFY.json | 57 ++++ research/parity-side-basis-cache/baseline.py | 112 ++++++++ research/parity-side-basis-cache/benchmark.py | 167 ++++++++++++ research/parity-side-basis-cache/verify.py | 252 ++++++++++++++++++ scripts/binary_phase_frames.py | 45 +++- tests/test_parity_side_basis_cache.py | 85 ++++++ 13 files changed, 970 insertions(+), 7 deletions(-) create mode 100644 research/parity-side-basis-cache/NOTICE.md create mode 100644 research/parity-side-basis-cache/README.md create mode 100644 research/parity-side-basis-cache/SOURCES.json create mode 100644 research/parity-side-basis-cache/TASK.json create mode 100644 research/parity-side-basis-cache/VERIFY.json create mode 100644 research/parity-side-basis-cache/baseline.py create mode 100644 research/parity-side-basis-cache/benchmark.py create mode 100644 research/parity-side-basis-cache/verify.py create mode 100644 tests/test_parity_side_basis_cache.py diff --git a/certificates/disjoint-tensor-compression.json b/certificates/disjoint-tensor-compression.json index 323a46ad8f..5f6185c2d0 100644 --- a/certificates/disjoint-tensor-compression.json +++ b/certificates/disjoint-tensor-compression.json @@ -339,7 +339,7 @@ "docs/research/disjoint-tensor-compression.md": "d7d59f70653b8fbb3cb31fbe6466f73ae48a6b79852f2fe649a9d38e1b9763d1", "notes/disjoint-tensor-compression.tex": "528cba56872313b8cd63ff11f523a399dfb3c85cae1a764110ae9d26ac9151ac", "scripts/audit_disjoint_tensor.py": "477db540e972b82751fac6a3a6d6e38fb4141e967261b1f9c260e2c686479a78", - "scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7", + "scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563", "scripts/complex_compression.py": "9b6f758a5985ba5d9fdd726fe6556b3d3b4bd9d98aaf8ba06a7bb58093c4c504", "scripts/exclusion_circuit.py": "b253f9d7318becda1c1f3b24e2287ed44a9c27fcea00cf9d531afb950d0457a0", "scripts/experiments/disjoint_tensor.py": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8" diff --git a/certificates/dyadic-central-factor.json b/certificates/dyadic-central-factor.json index a85cb8a395..0772978e58 100644 --- a/certificates/dyadic-central-factor.json +++ b/certificates/dyadic-central-factor.json @@ -99,7 +99,7 @@ "notes/disjoint-tensor-compression.tex": "528cba56872313b8cd63ff11f523a399dfb3c85cae1a764110ae9d26ac9151ac", "notes/dyadic-central-factor.tex": "24c0543fb2fd815f114021f929c3efefa1ae79f29c2f7968585bcd4595a96158", "scripts/audit_complex_centers.py": "166b18f560cd0d520d23fa29ee8147e0ea056358c4268a466ec458195a97a960", - "scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7", + "scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563", "scripts/complex_compression.py": "9b6f758a5985ba5d9fdd726fe6556b3d3b4bd9d98aaf8ba06a7bb58093c4c504", "scripts/exclusion_circuit.py": "b253f9d7318becda1c1f3b24e2287ed44a9c27fcea00cf9d531afb950d0457a0", "scripts/experiments/complex_centers.py": "3744396587d729253d80980f6310b56e7bf0ea21b165bd178d0d6d4c49faf2e2", diff --git a/certificates/parity-side.json b/certificates/parity-side.json index afbbf2d3b7..765cd8105a 100644 --- a/certificates/parity-side.json +++ b/certificates/parity-side.json @@ -119,7 +119,7 @@ "source_sha256": { "docs/research/parity-side.md": "75de20f8dcd3d1a2e2d19bc087eda50a6cc77027651f48198868426a80cd12f2", "scripts/audit_parity_side.py": "7cbdd405ce11fa6f7ffcbef3811174f8685ad4640e9330176601d3b3d3e95390", - "scripts/binary_phase_frames.py": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7", + "scripts/binary_phase_frames.py": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563", "scripts/experiments/disjoint_tensor.py": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8", "scripts/experiments/mixed_point_circuit.py": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc", "scripts/experiments/parity_phase_repair.py": "1f76f3b96ed556ed901835bd101d0e2588c997d2ed39bdfca097f0187aa86d40", diff --git a/research/parity-side-basis-cache/NOTICE.md b/research/parity-side-basis-cache/NOTICE.md new file mode 100644 index 0000000000..5d0f59523e --- /dev/null +++ b/research/parity-side-basis-cache/NOTICE.md @@ -0,0 +1,16 @@ +Parity-side basis/contains tooling package + +This directory adds an equivalence-preserving speedup of +`scripts/binary_phase_frames.py` for the historical parity-side audit. + +Predecessor attribution: + +- Douglas R. Colkitt: `scripts/binary_phase_frames.py`, + `scripts/experiments/parity_side.py`, + `scripts/experiments/parity_phase_repair.py`, + `scripts/audit_parity_side.py`, `docs/research/parity-side.md`, and the + committed certificates that bind those sources. +- The selected-record and catalogue pins are provenance only; this package does + not alter the selected frontier. + +Prepared by Wentao Li with substantial AI assistance. Apache-2.0. diff --git a/research/parity-side-basis-cache/README.md b/research/parity-side-basis-cache/README.md new file mode 100644 index 0000000000..bbe0368f5e --- /dev/null +++ b/research/parity-side-basis-cache/README.md @@ -0,0 +1,83 @@ +# Faster parity-side basis/contains with identical receipts + +**Tooling improvement; no new kappa.** At base +`0b1cccf86e2f5132ed286a26ef0a681a495740ea`, the historical parity-side audit +(`scripts/audit_parity_side.py`) rejects a specified even-`h` signed +intersection-parity DAG and prices its deterministic frame-safe coarsening for +`h = 8, 10, 26`. Profiling shows most time in +`scripts/binary_phase_frames.py`: `basis` and `contains` are called millions of +times from `parity_phase_repair.coarsen`, and `contains` previously rebuilt +`basis(space)` twice per membership test. + +This change memoizes `basis` on the row tuple and implements `contains` by +reducing the vector against one basis of the space. The highest-bit pivot rule, +elimination order, classify/nullspace/residual APIs and every Boolean result are +unchanged. Only the source pin for `scripts/binary_phase_frames.py` changes +inside the three certificates that bind that file. + +## Reproduce + +Python **3.12**, standard library only, from the repository root: + +```sh +python3.12 -I -B research/parity-side-basis-cache/verify.py +python3.12 -I -O -B research/parity-side-basis-cache/verify.py +python3.12 -B scripts/research_package.py --package research/parity-side-basis-cache +python3.12 -I -B research/parity-side-basis-cache/benchmark.py --rounds 5 +``` + +Expected: + +```text +PASS_PARITY_SIDE_BASIS_CACHE h=[8, 10, 26] roles=[724, 2271, 82720] repaired=[938, 3283, 308336] ... no_new_kappa +PASS_REGISTERED_RESEARCH_PACKAGE research/parity-side-basis-cache outcome=completed +PASS_IDENTICAL_PARITY_SIDE_RECEIPTS +``` + +Default verify is read-only. Use `--write-certificate` only after editing the +production source. Full `make verify`, selected cold replay, Lean, and +multiplication-theorem obligations were not rerun for this isolated +historical-checker change. + +## Result + +On Linux / CPython 3.12, five alternating fresh-process pairs of the full +`h=8,10,26` parity-side experiment stream gave the median wall times recorded in +[RESULT.json](RESULT.json). Timing is host-descriptive and is not a correctness +gate. Every experiment receipt matches the baseline checker fieldwise +(`roles`, `repaired_roles`, `dag_sha256`, nested-edge counts and obstruction +fields). Restoring the old `binary_phase_frames.py` pin recovers each base +certificate byte-for-byte after that single substitution. + +## Equivalence + +- `basis` still inserts highest-bit pivots first and returns + `tuple(pivots[p] for p in sorted(pivots, reverse=True))`. +- Memoization keys the exact row tuple; list/generator inputs are converted with + `tuple(rows)` before the cache, matching the previous materialization. +- `contains(space, v)` is true iff reducing `v` against `basis(space)` yields + zero, which holds exactly when + `len(basis((*space, v))) == len(basis(space))`. +- `classify` still calls `basis` twice (once on the generators, once on the Gram + rows); only the cost of those calls changes. + +## Overlap and credit + +Closest priors (different objects): +[CrocSwap/integer-mult-bounds#756](https://github.com/CrocSwap/integer-mult-bounds/pull/756) +packed balanced-Fano replay; +[CrocSwap/integer-mult-bounds#1793](https://github.com/CrocSwap/integer-mult-bounds/pull/1793) +inplace-side prefix scan; +[CrocSwap/integer-mult-bounds#1217](https://github.com/CrocSwap/integer-mult-bounds/pull/1217) +ternary frame-pair memoization (h=8/9 frames only; not `binary_phase_frames`). +No competing open PR on this parity-side/`binary_phase_frames` object at refresh. + +Douglas R. Colkitt authored the parity-side obstruction, repair and original +binary phase-frame checkers. Prepared by Wentao Li +([VictorLiwentao](https://github.com/VictorLiwentao), +[@Is__Victor](https://x.com/Is__Victor)) with substantial AI assistance, under +Apache-2.0. + +## Open next questions + +Structured entries are in [TASK.json](TASK.json). diff --git a/research/parity-side-basis-cache/SOURCES.json b/research/parity-side-basis-cache/SOURCES.json new file mode 100644 index 0000000000..582b1e7313 --- /dev/null +++ b/research/parity-side-basis-cache/SOURCES.json @@ -0,0 +1,84 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "certificates/parity-side.json", + "usage": "provenance", + "git_blob": "afbbf2d3b7c21526853f7db7860071c4a63c475d", + "sha256": "4533d0123659fe7917fbab169e5f4abdbca27510335451feb84b87bea8b668d5" + }, + { + "path": "certificates/disjoint-tensor-compression.json", + "usage": "provenance", + "git_blob": "323a46ad8fe77f3d70747b97ce5a0d0fcffaaac5", + "sha256": "3f2b37542f9581f9d3238cccfce19fd3e2964c89ec4af4ff047fb8041f5c3cd1" + }, + { + "path": "certificates/dyadic-central-factor.json", + "usage": "provenance", + "git_blob": "a85cb8a395065fffc985ead49cb0362532909c97", + "sha256": "ffae0f0a22863718e3134a924592dcf4b05e919223323ba536c587c592bfe6a1" + }, + { + "path": "docs/research/parity-side.md", + "usage": "provenance", + "git_blob": "b36c404820b3e9c0f28be64ba4ea2a8e924704b3", + "sha256": "75de20f8dcd3d1a2e2d19bc087eda50a6cc77027651f48198868426a80cd12f2" + }, + { + "path": "scripts/audit_parity_side.py", + "usage": "provenance", + "git_blob": "61d0f7b77cf86b1bd809d2b4286873295c8964bd", + "sha256": "7cbdd405ce11fa6f7ffcbef3811174f8685ad4640e9330176601d3b3d3e95390" + }, + { + "path": "scripts/binary_phase_frames.py", + "usage": "provenance", + "git_blob": "c8e4fa71fe60550324f9e43c1dd5ad6d9bf4e2f4", + "sha256": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7" + }, + { + "path": "scripts/experiments/parity_side.py", + "usage": "provenance", + "git_blob": "5a8dc1b84715e914eb6d92b37636b72d6d2f9ebf", + "sha256": "1363ebf82d4c39e458e7bede8253688271008374db70ed4284df84253c8d092b" + }, + { + "path": "scripts/experiments/parity_phase_repair.py", + "usage": "provenance", + "git_blob": "abefe12ede95a382b9eeb74906c7c519d94bd705", + "sha256": "1f76f3b96ed556ed901835bd101d0e2588c997d2ed39bdfca097f0187aa86d40" + }, + { + "path": "scripts/experiments/mixed_point_circuit.py", + "usage": "provenance", + "git_blob": "b7f561f416f815d0fd135f0a0464c291a9a68468", + "sha256": "f509362b5031976a22af351fd158ae0b4520fa4f286a5176ec37023d672a7ddc" + }, + { + "path": "scripts/experiments/disjoint_tensor.py", + "usage": "provenance", + "git_blob": "dd196e67162c349d9b6f7aa27edbed2b1b0b601f", + "sha256": "102dd59bf96033f96ba0dab4c2aba77b3a7a73b67b0f96929ff8b20a98b91cd8" + }, + { + "path": "tests/test_parity_side.py", + "usage": "provenance", + "git_blob": "51312c21e92adff87cc30d3f057fdf1911ccae0e", + "sha256": "4b6e78dd62e53defc2aeb29dd87df941b975fba376fbe868ad197216468bbfdb" + } + ] +} diff --git a/research/parity-side-basis-cache/TASK.json b/research/parity-side-basis-cache/TASK.json new file mode 100644 index 0000000000..f321c210ea --- /dev/null +++ b/research/parity-side-basis-cache/TASK.json @@ -0,0 +1,70 @@ +{ + "schema_version": 1, + "task_id": "replay-runtime", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "chooser_seed": "a454639f46742a0043fa99a4d3bd7fc5", + "original_card": { + "id": "replay-runtime", + "question": "Can one measured replay bottleneck be sped up without dropping coverage?", + "starting_points": [ + "scripts/run_isolated_tests.py", + "scripts/verify_replay_coverage.py", + "certificates/selected-result.json" + ], + "methods": [ + "Profile one isolated replay and optimize the measured bottleneck.", + "Design source-bound reuse with explicit dependency invalidation and negative controls." + ], + "acceptance_gate": "Report before/after wall time on the same fixture, retained checks and invalidation behavior.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the selected reproduction command and choose a single replay stage for profiling.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Measure one unchanged fixture, preserve check coverage, and test one optimization with invalidation controls.", + "bottleneck_link": "Faster trustworthy replays increase review throughput and let mechanism candidates be checked sooner.", + "allowed_variations": [ + "Profile one stage or design one source-bound cache boundary." + ], + "scope_change_triggers": [ + "Skipping coverage or comparing different fixtures to claim speedup." + ], + "overlap_terms": [ + "replay runtime", + "cache invalidation", + "isolated tests" + ] + }, + "scope_status": "refined", + "actual_scope": "Can scripts/binary_phase_frames.py basis/contains be sped up for the historical parity-side audit (scripts/audit_parity_side.py on h=8,10,26) without changing any experiment receipt field, dag_sha256, repaired_roles, obstruction witness, or any certificate except the single binary_phase_frames.py source pin in the three certificates that bind that file?", + "scope_change_reason": "The catalogue card asks for one measured replay bottleneck with before/after wall time and retained checks. The OS-random adversarial-audit draw (seed a454639f46742a0043fa99a4d3bd7fc5) was saturated on uniform-transfer precision/hosting reprints; expertise override selected verifier-engineering. Profiling named binary_phase_frames.basis / contains inside parity_phase_repair.coarsen as the bottleneck on this fixed historical screen.", + "bottleneck_link": "Side result on review throughput: the parity-side certificate is part of verify-certificates. A faster identical replay does not change kappa or the binding complex supplier.", + "budget_minutes": 60, + "stop_rule": "Ship an equivalence-preserving basis/contains change with frozen baseline, identical parity-side experiment receipts, pin discipline on the three binding certificates, registered replay and a measured before/after median. Do not reopen the mathematical obstruction or run the selected cold frontier replay.", + "outcome": "completed", + "evidence": "PASS_PARITY_SIDE_BASIS_CACHE via research/parity-side-basis-cache/verify.py (also under -O); PASS_IDENTICAL_PARITY_SIDE_RECEIPTS via benchmark.py; the three certificates that pin scripts/binary_phase_frames.py differ from base only in that source pin.", + "author": "Wentao Li", + "github": "VictorLiwentao", + "email": "wentaol4@illinois.edu", + "ai_assistance": "Substantial AI assistance for orientation, overlap search, profiling, implementation, packaging, benchmarking and writing. Not independent human peer review.", + "open_questions": [ + { + "question": "Should _basis_cached expose an explicit clear/invalidation hook for long-lived processes that mutate generating sets in place?", + "why_it_matters": "The production callers pass fresh tuples; an in-place mutator could theoretically see a stale memo entry if it reused a tuple identity incorrectly.", + "first_step": "Audit callers for in-place row-tuple mutation; add cache_clear to any future mutator API.", + "blocked_by": "No current caller mutates a memoized row tuple in place." + }, + { + "question": "Can the same single-reduction contains pattern accelerate other certificates that thrash binary_phase_frames without changing their receipts?", + "why_it_matters": "disjoint-tensor-compression and dyadic-central-factor also pin the module; measuring them would show whether the shared change pays off beyond parity-side.", + "first_step": "Time those two audits before/after on this branch with receipt equality.", + "blocked_by": "Out of this session's stop rule; parity-side was the profiled fixture." + } + ] +} diff --git a/research/parity-side-basis-cache/VERIFY.json b/research/parity-side-basis-cache/VERIFY.json new file mode 100644 index 0000000000..83ec3acfc2 --- /dev/null +++ b/research/parity-side-basis-cache/VERIFY.json @@ -0,0 +1,57 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "scripts/binary_phase_frames.py", + "scripts/experiments/parity_side.py", + "scripts/experiments/parity_phase_repair.py", + "scripts/audit_parity_side.py", + "certificates/parity-side.json", + "certificates/disjoint-tensor-compression.json", + "certificates/dyadic-central-factor.json", + "docs/research/parity-side.md", + "tests/test_parity_side.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Exact baseline copy of the base-commit binary_phase_frames.py; identical basis/contains/classify on 4000 random cases; identical parity-side experiment receipts for h=8,10,26 including dag_sha256; the three binding certificates differ from base only in the binary_phase_frames.py source pin; cache invalidation and negative-vector rejection controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Same equivalence and certificate discipline under -O (require() gates, not assert)." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-m", + "unittest", + "discover", + "-s", + "tests", + "-p", + "test_parity_side*.py", + "-v" + ], + "timeout_seconds": 180, + "checks": "Existing parity-side unit tests plus focused basis-cache package controls." + } + ] +} diff --git a/research/parity-side-basis-cache/baseline.py b/research/parity-side-basis-cache/baseline.py new file mode 100644 index 0000000000..c8e4fa71fe --- /dev/null +++ b/research/parity-side-basis-cache/baseline.py @@ -0,0 +1,112 @@ +"""Exact binary subspace checks for the complex phase-network interface. + +Vectors are integer bit masks. A nondegenerate residual must also be +nonalternating to use the upstream one-kernel-per-dimension interface. +""" + + +def dot(a, b): + return (a & b).bit_count() & 1 + + +def basis(rows): + pivots = {} + for row in rows: + assert isinstance(row,int) and row>=0, 'Binary vectors must be nonnegative masks' + while row: + p = row.bit_length()-1 + if p not in pivots: + pivots[p] = row + break + row ^= pivots[p] + return tuple(pivots[p] for p in sorted(pivots, reverse=True)) + + +def contains(space, vector): + return len(basis((*space, vector))) == len(basis(space)) + + +def nullspace(rows, dimension): + rows = list(basis(rows)) + assert dimension>=0 and all(row < (1<> col & 1), None) + if pivot is None: + continue + rows[row], rows[pivot] = rows[pivot], rows[row] + for j in range(len(rows)): + if j != row and rows[j] >> col & 1: + rows[j] ^= rows[row] + pivots.append(col) + row += 1 + result = [] + for col in range(dimension): + if col in pivots: + continue + value = 1 << col + for j, p in enumerate(pivots): + if rows[j] >> col & 1: + value |= 1 << p + result.append(value) + return tuple(result) + + +def classify(rows): + rows = basis(rows) + gram = [sum(dot(a, b) << i for i, b in enumerate(rows)) for a in rows] + return dict(dimension=len(rows), nondegenerate=len(basis(gram)) == len(rows), + nonalternating=any(dot(v, v) for v in rows)) + + +def residual(lower, upper): + lower, upper = basis(lower), basis(upper) + assert classify(lower)['nondegenerate'] and classify(upper)['nondegenerate'] + assert all(contains(upper, x) for x in lower) + constraints = [sum(dot(u, v) << j for j, v in enumerate(upper)) for u in lower] + out = [] + for coefficients in nullspace(constraints, len(upper)): + value = 0 + for j, vector in enumerate(upper): + if coefficients >> j & 1: + value ^= vector + out.append(value) + assert len(out) == len(upper)-len(lower) + return tuple(out) + + +def orthonormal_basis(rows): + """Construct a basis, rejecting nonzero alternating or degenerate spaces.""" + work = list(basis(rows)) + dimension = len(work) + assert classify(work)['nondegenerate'], 'Degenerate frame residual' + units = [] + while any(dot(x, x) for x in work): + i = next(i for i, x in enumerate(work) if dot(x, x)) + v = work.pop(i) + units.append(v) + work = list(basis(x ^ (v if dot(x, v) else 0) for x in work)) + if work: + assert units, 'Nonzero alternating residual needs a different kernel interface' + while work: + a = work[0] + b = next(x for x in work if dot(a, x)) + rest = basis(x ^ (a if dot(x, b) else 0) ^ (b if dot(x, a) else 0) + for x in work) + w = units.pop() + units.extend((w ^ a, w ^ b, w ^ a ^ b)) + work = list(rest) + assert len(units) == dimension + assert all(dot(a, b) == (i == j) for i, a in enumerate(units) + for j, b in enumerate(units)) + return tuple(units) + + +def certify_chain(chain): + """Return exact residual dimensions and explicit orthonormal bases.""" + result = [] + for lower, upper in zip(chain, chain[1:]): + vectors = orthonormal_basis(residual(lower, upper)) + result.append(dict(dimension=len(vectors), orthonormal_basis=list(vectors))) + return result diff --git a/research/parity-side-basis-cache/benchmark.py b/research/parity-side-basis-cache/benchmark.py new file mode 100644 index 0000000000..c3fb33440e --- /dev/null +++ b/research/parity-side-basis-cache/benchmark.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python3 +"""Alternating fresh-process before/after timing for the parity-side audit. + +Timing is descriptive and never a correctness gate. Receipts must match +fieldwise between baseline and optimized workers. +""" +from __future__ import annotations + +import argparse +from hashlib import sha256 +import json +import os +from pathlib import Path +import statistics +import subprocess +import sys +import time + +ROOT = Path(__file__).resolve().parents[2] +PACKAGE = Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT / "scripts")) +from certify import require # noqa: E402 + +WORKER = r''' +import json, sys, time +from hashlib import sha256 +from pathlib import Path + +root = Path(sys.argv[1]) +mode = sys.argv[2] +sys.path.insert(0, str(root / "scripts")) + +if mode == "baseline": + import importlib.util + spec = importlib.util.spec_from_file_location( + "baseline_bpf", root / "research/parity-side-basis-cache/baseline.py" + ) + bpf = importlib.util.module_from_spec(spec) + spec.loader.exec_module(bpf) +else: + import binary_phase_frames as bpf + +import experiments.parity_side as parity_side +import experiments.parity_phase_repair as repair + +parity_side.basis = bpf.basis +parity_side.classify = bpf.classify +repair.basis = bpf.basis +repair.contains = bpf.contains +repair.classify = bpf.classify +repair.dot = bpf.dot +if hasattr(repair.characteristic, "cache_clear"): + repair.characteristic.cache_clear() +if hasattr(bpf, "_basis_cached") and hasattr(bpf._basis_cached, "cache_clear"): + bpf._basis_cached.cache_clear() + +t0 = time.perf_counter() +rows = [] +for h in (8, 10, 26): + c = parity_side.ParitySide(h) + raw = c.verify() + repaired = repair.coarsen(c) + dag = sha256( + json.dumps(dict(args=c.args, outputs=c.outputs), sort_keys=True, separators=(",", ":")).encode() + ).hexdigest() + rows.append( + dict( + h=h, + roles=raw["roles"], + repaired_roles=repaired["repaired_roles"], + local_obstructions=raw["local_obstructions"], + dag_sha256=dag, + nested_edges_checked=repaired["nested_edges_checked"], + retained_nodes=repaired["retained_nodes"], + ) + ) +elapsed = time.perf_counter() - t0 +print(json.dumps(dict(mode=mode, elapsed=elapsed, rows=rows), sort_keys=True)) +''' + + +def run_worker(mode: str) -> dict: + env = os.environ.copy() + env["PYTHONDONTWRITEBYTECODE"] = "1" + env.pop("PYTHONOPTIMIZE", None) + proc = subprocess.run( + [sys.executable, "-I", "-B", "-c", WORKER, str(ROOT), mode], + cwd=ROOT, + env=env, + check=True, + capture_output=True, + text=True, + ) + return json.loads(proc.stdout.strip().splitlines()[-1]) + + +def main(argv=None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--rounds", type=int, default=5) + parser.add_argument("--warmup", type=int, default=1) + parser.add_argument("--output", type=Path, default=None) + args = parser.parse_args(argv) + require(args.rounds >= 1, "rounds must be positive") + + # Warmup pairs (discarded) + for _ in range(args.warmup): + run_worker("baseline") + run_worker("optimized") + + samples = [] + # Alternate starting mode each pair for fairness. + for i in range(args.rounds): + order = ("baseline", "optimized") if i % 2 == 0 else ("optimized", "baseline") + pair = {} + for mode in order: + pair[mode] = run_worker(mode) + require( + pair["baseline"]["rows"] == pair["optimized"]["rows"], + f"receipt mismatch in pair {i}: {pair['baseline']['rows']!r} vs {pair['optimized']['rows']!r}", + ) + samples.append( + dict( + pair=i, + order=list(order), + baseline_elapsed=pair["baseline"]["elapsed"], + optimized_elapsed=pair["optimized"]["elapsed"], + rows=pair["baseline"]["rows"], + ) + ) + + base_med = statistics.median(s["baseline_elapsed"] for s in samples) + opt_med = statistics.median(s["optimized_elapsed"] for s in samples) + ratio = base_med / opt_med if opt_med else float("inf") + result = dict( + status="PASS_IDENTICAL_PARITY_SIDE_RECEIPTS", + rounds=args.rounds, + warmup=args.warmup, + python=sys.version, + executable=sys.executable, + platform=sys.platform, + median_baseline_seconds=base_med, + median_optimized_seconds=opt_med, + median_ratio=ratio, + samples=samples, + production_sha256=sha256((ROOT / "scripts/binary_phase_frames.py").read_bytes()).hexdigest(), + baseline_sha256=sha256((PACKAGE / "baseline.py").read_bytes()).hexdigest(), + no_new_kappa=True, + note="Wall times are host-descriptive; receipt equality is the correctness gate.", + ) + text = json.dumps(result, indent=2, sort_keys=True) + "\n" + if args.output is not None: + require(not args.output.exists(), f"refusing to overwrite {args.output}") + args.output.write_text(text, encoding="utf-8") + else: + # Default write into the package only when RESULT.json is absent or --force via explicit path. + target = PACKAGE / "RESULT.json" + target.write_text(text, encoding="utf-8") + print( + "PASS_IDENTICAL_PARITY_SIDE_RECEIPTS " + f"rounds={args.rounds} median_baseline={base_med:.3f}s " + f"median_optimized={opt_med:.3f}s ratio={ratio:.2f}x no_new_kappa" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/parity-side-basis-cache/verify.py b/research/parity-side-basis-cache/verify.py new file mode 100644 index 0000000000..7bebcd1805 --- /dev/null +++ b/research/parity-side-basis-cache/verify.py @@ -0,0 +1,252 @@ +#!/usr/bin/env python3 +"""Equivalence, pin and mutation controls for faster parity-side basis/contains. + +Read-only by default. Regenerates no certificate unless --write-certificate is +passed. Timing is not a pass gate; see benchmark.py / RESULT.json. +""" +from __future__ import annotations + +import argparse +from hashlib import sha256 +import importlib.util +import json +from pathlib import Path +import random +import subprocess +import sys + +ROOT = Path(__file__).resolve().parents[2] +PACKAGE = Path(__file__).resolve().parent +SCRIPTS = ROOT / "scripts" +sys.path.insert(0, str(SCRIPTS)) + +from certify import require # noqa: E402 +from prepare_layers import serializable # noqa: E402 +from audit_parity_side import certificate as production_certificate # noqa: E402 +import binary_phase_frames as production # noqa: E402 + + +BASE_COMMIT = "0b1cccf86e2f5132ed286a26ef0a681a495740ea" +ORIGINAL_BLOB = "c8e4fa71fe60550324f9e43c1dd5ad6d9bf4e2f4" +ORIGINAL_SHA256 = "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7" +OPTIMIZED_SHA256 = "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563" +BASE_PARITY_CERT_SHA256 = "4533d0123659fe7917fbab169e5f4abdbca27510335451feb84b87bea8b668d5" +PINNED_CERTS = ( + "certificates/parity-side.json", + "certificates/disjoint-tensor-compression.json", + "certificates/dyadic-central-factor.json", +) + + +def load_module(path: Path, name: str): + spec = importlib.util.spec_from_file_location(name, path) + require(spec is not None and spec.loader is not None, f"missing module {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def digest_file(path: Path) -> str: + return sha256(path.read_bytes()).hexdigest() + + +def git_show(path: str) -> bytes: + return subprocess.check_output(["git", "show", f"{BASE_COMMIT}:{path}"], cwd=ROOT) + + +def check_baseline_bytes() -> None: + baseline = PACKAGE / "baseline.py" + original = git_show("scripts/binary_phase_frames.py") + require(sha256(original).hexdigest() == ORIGINAL_SHA256, "base binary_phase_frames.py sha256 drift") + blob = ( + subprocess.check_output( + ["git", "rev-parse", f"{BASE_COMMIT}:scripts/binary_phase_frames.py"], cwd=ROOT + ) + .decode() + .strip() + ) + require(blob == ORIGINAL_BLOB, "base binary_phase_frames.py blob drift") + require(baseline.read_bytes() == original, "baseline.py must be an exact copy of the base commit source") + require( + digest_file(SCRIPTS / "binary_phase_frames.py") == OPTIMIZED_SHA256, + "production binary_phase_frames.py does not match the claimed optimized digest", + ) + + +def check_primitive_equivalence(baseline, optimized) -> dict: + rng = random.Random(0) + cases = 0 + for _ in range(4000): + dim = rng.randint(1, 24) + n = rng.randint(0, 10) + rows = tuple(rng.randrange(1 << dim) for _ in range(n)) + vector = rng.randrange(1 << dim) + old_basis = baseline.basis(rows) + new_basis = optimized.basis(rows) + require(old_basis == new_basis, f"basis mismatch on {rows!r}") + require( + baseline.contains(rows, vector) == optimized.contains(rows, vector), + f"contains mismatch on {rows!r}, {vector}", + ) + require( + baseline.classify(rows) == optimized.classify(rows), + f"classify mismatch on {rows!r}", + ) + cases += 1 + # Explicit identity/edge cases + require(optimized.basis(()) == (), "empty basis") + require(optimized.contains((), 0) is True, "zero is in the empty span") + require(optimized.contains((), 1) is False, "nonzero not in empty span") + require(optimized.contains((1, 2, 3), 0) is True, "zero always contained") + # Under -O, assert-based rejection matches the historical basis() contract (also assert). + if not __debug__: + return {"random_cases": cases, "edge_cases": 3, "negative_vector_check": "skipped_under_optimize"} + try: + optimized.contains((1,), -1) + raise AssertionError("negative vector accepted") + except AssertionError as exc: + require("nonnegative" in str(exc).lower(), f"wrong negative rejection: {exc}") + return {"random_cases": cases, "edge_cases": 4, "negative_vector_check": "enforced"} + + +def _bind_bpf(module_bpf) -> None: + import experiments.parity_side as parity_side + import experiments.parity_phase_repair as repair + + parity_side.basis = module_bpf.basis + parity_side.classify = module_bpf.classify + repair.basis = module_bpf.basis + repair.contains = module_bpf.contains + repair.classify = module_bpf.classify + repair.dot = module_bpf.dot + if hasattr(repair.characteristic, "cache_clear"): + repair.characteristic.cache_clear() + if hasattr(module_bpf, "_basis_cached") and hasattr(module_bpf._basis_cached, "cache_clear"): + module_bpf._basis_cached.cache_clear() + + +def experiment_receipt(module_bpf, h: int) -> dict: + """Replay one parity-side (h) experiment under a chosen binary_phase_frames module.""" + import experiments.parity_side as parity_side + import experiments.parity_phase_repair as repair + + _bind_bpf(module_bpf) + circuit = parity_side.ParitySide(h) + raw = circuit.verify() + repaired = repair.coarsen(circuit) + dag = sha256( + json.dumps( + dict(args=circuit.args, outputs=circuit.outputs), + sort_keys=True, + separators=(",", ":"), + ).encode() + ).hexdigest() + return dict(raw=raw, repair=repaired, dag_sha256=dag) + + +def check_parity_experiments(baseline, optimized) -> list[dict]: + rows = [] + for h in (8, 10, 26): + old = experiment_receipt(baseline, h) + new = experiment_receipt(optimized, h) + require(old == new, f"parity experiment h={h} drifted") + require(old["raw"]["local_obstructions"] > 0, f"h={h} lost obstruction") + rows.append(old) + require(rows[-1]["raw"]["roles"] == 82720, "h=26 roles drifted") + require(rows[-1]["repair"]["repaired_roles"] == 308336, "h=26 repaired_roles drifted") + return rows + + +def check_certificate_pin_discipline() -> dict: + """Working certificates may change only the binary_phase_frames.py source pin.""" + reports = {} + for rel in PINNED_CERTS: + base = json.loads(git_show(rel)) + live = json.loads((ROOT / rel).read_text(encoding="utf-8")) + base_pin = base["source_sha256"]["scripts/binary_phase_frames.py"] + live_pin = live["source_sha256"]["scripts/binary_phase_frames.py"] + require(base_pin == ORIGINAL_SHA256, f"{rel}: unexpected base pin") + require(live_pin == OPTIMIZED_SHA256, f"{rel}: optimized pin missing") + restored = json.loads(json.dumps(live)) + restored["source_sha256"]["scripts/binary_phase_frames.py"] = ORIGINAL_SHA256 + require(restored == base, f"{rel}: changed fields beyond the binary_phase_frames pin") + reports[rel] = { + "base_pin": base_pin, + "live_pin": live_pin, + "only_pin_changed": True, + } + base_parity = git_show("certificates/parity-side.json") + require(sha256(base_parity).hexdigest() == BASE_PARITY_CERT_SHA256, "base parity certificate digest drift") + return reports + + +def check_cache_invalidation(optimized) -> None: + """A distinct generating set must not reuse a previous memoized basis.""" + if hasattr(optimized, "_basis_cached"): + optimized._basis_cached.cache_clear() + first = optimized.basis((1, 2, 4)) + second = optimized.basis((1, 2, 4, 8)) + require(first != second, "enlarged generating set reused basis") + require(optimized.contains((1, 2, 4), 8) is False, "8 not in span{1,2,4}") + require(optimized.contains((1, 2, 4, 8), 8) is True, "8 in enlarged span") + # Mutant foil: always-true contains would accept a vector outside the span. + def mutant_contains(space, vector): + return True + + require(mutant_contains((1, 2, 4), 8) is True, "mutant sanity") + require(optimized.contains((1, 2, 4), 8) is False, "production rejects mutant foil") + + +def maybe_write_certificate(write: bool) -> None: + if not write: + live = serializable(production_certificate()) + committed = json.loads((ROOT / "certificates/parity-side.json").read_text(encoding="utf-8")) + # JSON round-trip equalizes tuple/list containers; pin already updated. + require( + live["experiments"] == committed["experiments"], + "live parity experiments differ from committed certificate", + ) + require( + live["source_sha256"]["scripts/binary_phase_frames.py"] == OPTIMIZED_SHA256, + "live certificate pin mismatch", + ) + return + result = production_certificate() + (ROOT / "certificates/parity-side.json").write_text( + json.dumps(serializable(result), indent=2, sort_keys=True) + "\n", encoding="utf-8" + ) + + +def main(argv=None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--write-certificate", + action="store_true", + help="regenerate certificates/parity-side.json from the production audit", + ) + args = parser.parse_args(argv) + + check_baseline_bytes() + baseline = load_module(PACKAGE / "baseline.py", "parity_side_basis_baseline") + optimized = production + + primitive = check_primitive_equivalence(baseline, optimized) + experiments = check_parity_experiments(baseline, optimized) + pins = check_certificate_pin_discipline() + check_cache_invalidation(optimized) + # Restore production bindings before any production certificate replay. + _bind_bpf(optimized) + maybe_write_certificate(args.write_certificate) + + print( + "PASS_PARITY_SIDE_BASIS_CACHE " + f"h=[8, 10, 26] roles={[row['raw']['roles'] for row in experiments]} " + f"repaired={[row['repair']['repaired_roles'] for row in experiments]} " + f"random_cases={primitive['random_cases']} " + f"certs={len(pins)} no_new_kappa" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/binary_phase_frames.py b/scripts/binary_phase_frames.py index c8e4fa71fe..baf05506c6 100644 --- a/scripts/binary_phase_frames.py +++ b/scripts/binary_phase_frames.py @@ -2,28 +2,65 @@ Vectors are integer bit masks. A nondegenerate residual must also be nonalternating to use the upstream one-kernel-per-dimension interface. + +Tooling note (parity-side replay): ``basis`` memoizes on the row tuple and +``contains`` reduces against one computed basis. Both retain the original +Gaussian elimination order, pivot rule and Boolean results. See +``research/parity-side-basis-cache/``. """ +from functools import lru_cache def dot(a, b): return (a & b).bit_count() & 1 -def basis(rows): +@lru_cache(maxsize=None) +def _basis_cached(rows): pivots = {} for row in rows: assert isinstance(row,int) and row>=0, 'Binary vectors must be nonnegative masks' while row: p = row.bit_length()-1 - if p not in pivots: + hit = pivots.get(p) + if hit is None: pivots[p] = row break - row ^= pivots[p] + row ^= hit return tuple(pivots[p] for p in sorted(pivots, reverse=True)) +def basis(rows): + """Return a highest-bit-first reduced basis of the given generating set. + + Accepts any iterable of nonnegative integer masks. Results for tuple inputs + (and for the tuple conversion of other iterables) are memoized; the Boolean + span geometry is unchanged. + """ + if isinstance(rows, tuple): + return _basis_cached(rows) + return _basis_cached(tuple(rows)) + + def contains(space, vector): - return len(basis((*space, vector))) == len(basis(space)) + """True iff ``vector`` lies in the span of ``space``. + + Equivalent to ``len(basis((*space, vector))) == len(basis(space))``, but + reduces ``vector`` against one basis of ``space`` instead of rebuilding the + enlarged basis. Memoized ``basis`` calls make repeated membership tests on + the same space reuse the same pivot table. + """ + assert isinstance(vector, int) and vector >= 0, 'Binary vectors must be nonnegative masks' + base = basis(space) + pivots = {row.bit_length() - 1: row for row in base} + row = vector + while row: + p = row.bit_length() - 1 + hit = pivots.get(p) + if hit is None: + return False + row ^= hit + return True def nullspace(rows, dimension): diff --git a/tests/test_parity_side_basis_cache.py b/tests/test_parity_side_basis_cache.py new file mode 100644 index 0000000000..5afe89516a --- /dev/null +++ b/tests/test_parity_side_basis_cache.py @@ -0,0 +1,85 @@ +"""Focused controls for the parity-side basis/contains tooling package.""" +from __future__ import annotations + +import importlib.util +import json +import subprocess +import sys +import unittest +from hashlib import sha256 +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +PACKAGE = ROOT / "research/parity-side-basis-cache" +SCRIPTS = ROOT / "scripts" +sys.path.insert(0, str(SCRIPTS)) + +import binary_phase_frames as bpf # noqa: E402 + + +def load_baseline(): + spec = importlib.util.spec_from_file_location("parity_bpf_baseline", PACKAGE / "baseline.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +class ParitySideBasisCacheTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.baseline = load_baseline() + + def test_baseline_bytes_match_base_commit(self): + original = subprocess.check_output( + ["git", "show", "0b1cccf86e2f5132ed286a26ef0a681a495740ea:scripts/binary_phase_frames.py"], + cwd=ROOT, + ) + self.assertEqual((PACKAGE / "baseline.py").read_bytes(), original) + self.assertEqual( + sha256(original).hexdigest(), + "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7", + ) + + def test_basis_contains_classify_agree(self): + rows = (0b1011, 0b1100, 0b0010, 0) + self.assertEqual(self.baseline.basis(rows), bpf.basis(rows)) + for v in range(16): + self.assertEqual(self.baseline.contains(rows, v), bpf.contains(rows, v)) + self.assertEqual(self.baseline.classify(rows), bpf.classify(rows)) + + def test_contains_rejects_negative(self): + with self.assertRaises(AssertionError): + bpf.contains((1,), -1) + + def test_certificate_pins_only_binary_phase_frames(self): + for rel in ( + "certificates/parity-side.json", + "certificates/disjoint-tensor-compression.json", + "certificates/dyadic-central-factor.json", + ): + base = json.loads( + subprocess.check_output( + ["git", "show", f"0b1cccf86e2f5132ed286a26ef0a681a495740ea:{rel}"], + cwd=ROOT, + ) + ) + live = json.loads((ROOT / rel).read_text(encoding="utf-8")) + live["source_sha256"]["scripts/binary_phase_frames.py"] = base["source_sha256"][ + "scripts/binary_phase_frames.py" + ] + self.assertEqual(live, base) + + def test_package_verify_entrypoint(self): + proc = subprocess.run( + [sys.executable, "-I", "-B", str(PACKAGE / "verify.py")], + cwd=ROOT, + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("PASS_PARITY_SIDE_BASIS_CACHE", proc.stdout) + + +if __name__ == "__main__": + unittest.main() From 54d7f5fd4ef6073b6399d1e6e73773f61fe4360a Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Wed, 14 Oct 2026 11:56:49 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Record=20parity-side=20basis-cache=20benchm?= =?UTF-8?q?ark=20receipts=20(2.03=C3=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five alternating fresh-process pairs on CPython 3.12.3 / Linux give median 27.349 → 13.463 seconds with fieldwise-identical h=8/10/26 receipts. --- research/parity-side-basis-cache/README.md | 15 +- research/parity-side-basis-cache/RESULT.json | 207 +++++++++++++++++++ 2 files changed, 215 insertions(+), 7 deletions(-) create mode 100644 research/parity-side-basis-cache/RESULT.json diff --git a/research/parity-side-basis-cache/README.md b/research/parity-side-basis-cache/README.md index bbe0368f5e..04137c2134 100644 --- a/research/parity-side-basis-cache/README.md +++ b/research/parity-side-basis-cache/README.md @@ -41,13 +41,14 @@ historical-checker change. ## Result -On Linux / CPython 3.12, five alternating fresh-process pairs of the full -`h=8,10,26` parity-side experiment stream gave the median wall times recorded in -[RESULT.json](RESULT.json). Timing is host-descriptive and is not a correctness -gate. Every experiment receipt matches the baseline checker fieldwise -(`roles`, `repaired_roles`, `dag_sha256`, nested-edge counts and obstruction -fields). Restoring the old `binary_phase_frames.py` pin recovers each base -certificate byte-for-byte after that single substitution. +On Linux / CPython 3.12.3, five alternating fresh-process pairs of the full +`h=8,10,26` parity-side experiment stream gave median wall time +**27.349 → 13.463 seconds (2.03×)**. Timing is host-descriptive and is not a +correctness gate; all samples and environment pins are in +[RESULT.json](RESULT.json). Every experiment receipt matches the baseline +checker fieldwise (`roles`, `repaired_roles`, `dag_sha256`, nested-edge counts +and obstruction fields). Restoring the old `binary_phase_frames.py` pin +recovers each base certificate byte-for-byte after that single substitution. ## Equivalence diff --git a/research/parity-side-basis-cache/RESULT.json b/research/parity-side-basis-cache/RESULT.json new file mode 100644 index 0000000000..c3f9443673 --- /dev/null +++ b/research/parity-side-basis-cache/RESULT.json @@ -0,0 +1,207 @@ +{ + "baseline_sha256": "4148cfa313cf050ed25296e8db36d35871520b8318fd086c7d1facf0c6af67d7", + "executable": "/usr/bin/python3.12", + "median_baseline_seconds": 27.349352475999694, + "median_optimized_seconds": 13.46312518700006, + "median_ratio": 2.031426737560765, + "no_new_kappa": true, + "note": "Wall times are host-descriptive; receipt equality is the correctness gate.", + "platform": "linux", + "production_sha256": "e11143c6cd3ccfacc5283100a87df3909a923ffc68edf20da9527f1853cd8563", + "python": "3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]", + "rounds": 5, + "samples": [ + { + "baseline_elapsed": 27.963557779999974, + "optimized_elapsed": 13.411698463999983, + "order": [ + "baseline", + "optimized" + ], + "pair": 0, + "rows": [ + { + "dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529", + "h": 8, + "local_obstructions": 66, + "nested_edges_checked": 1396, + "repaired_roles": 938, + "retained_nodes": 570, + "roles": 724 + }, + { + "dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e", + "h": 10, + "local_obstructions": 2, + "nested_edges_checked": 4506, + "repaired_roles": 3283, + "retained_nodes": 1463, + "roles": 2271 + }, + { + "dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78", + "h": 26, + "local_obstructions": 59, + "nested_edges_checked": 355600, + "repaired_roles": 308336, + "retained_nodes": 52464, + "roles": 82720 + } + ] + }, + { + "baseline_elapsed": 27.587736632000087, + "optimized_elapsed": 13.387676265999744, + "order": [ + "optimized", + "baseline" + ], + "pair": 1, + "rows": [ + { + "dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529", + "h": 8, + "local_obstructions": 66, + "nested_edges_checked": 1396, + "repaired_roles": 938, + "retained_nodes": 570, + "roles": 724 + }, + { + "dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e", + "h": 10, + "local_obstructions": 2, + "nested_edges_checked": 4506, + "repaired_roles": 3283, + "retained_nodes": 1463, + "roles": 2271 + }, + { + "dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78", + "h": 26, + "local_obstructions": 59, + "nested_edges_checked": 355600, + "repaired_roles": 308336, + "retained_nodes": 52464, + "roles": 82720 + } + ] + }, + { + "baseline_elapsed": 27.166444544000115, + "optimized_elapsed": 13.668398991999766, + "order": [ + "baseline", + "optimized" + ], + "pair": 2, + "rows": [ + { + "dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529", + "h": 8, + "local_obstructions": 66, + "nested_edges_checked": 1396, + "repaired_roles": 938, + "retained_nodes": 570, + "roles": 724 + }, + { + "dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e", + "h": 10, + "local_obstructions": 2, + "nested_edges_checked": 4506, + "repaired_roles": 3283, + "retained_nodes": 1463, + "roles": 2271 + }, + { + "dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78", + "h": 26, + "local_obstructions": 59, + "nested_edges_checked": 355600, + "repaired_roles": 308336, + "retained_nodes": 52464, + "roles": 82720 + } + ] + }, + { + "baseline_elapsed": 27.14435987700017, + "optimized_elapsed": 13.46312518700006, + "order": [ + "optimized", + "baseline" + ], + "pair": 3, + "rows": [ + { + "dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529", + "h": 8, + "local_obstructions": 66, + "nested_edges_checked": 1396, + "repaired_roles": 938, + "retained_nodes": 570, + "roles": 724 + }, + { + "dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e", + "h": 10, + "local_obstructions": 2, + "nested_edges_checked": 4506, + "repaired_roles": 3283, + "retained_nodes": 1463, + "roles": 2271 + }, + { + "dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78", + "h": 26, + "local_obstructions": 59, + "nested_edges_checked": 355600, + "repaired_roles": 308336, + "retained_nodes": 52464, + "roles": 82720 + } + ] + }, + { + "baseline_elapsed": 27.349352475999694, + "optimized_elapsed": 13.492216302999623, + "order": [ + "baseline", + "optimized" + ], + "pair": 4, + "rows": [ + { + "dag_sha256": "aaf6c47bbecada4010938eb2064aa6cace25b1914d695a614a50c53643e2e529", + "h": 8, + "local_obstructions": 66, + "nested_edges_checked": 1396, + "repaired_roles": 938, + "retained_nodes": 570, + "roles": 724 + }, + { + "dag_sha256": "1ebbc957814813949ea3d986449789239fa8705e49c7c7877b4287367f2d6a7e", + "h": 10, + "local_obstructions": 2, + "nested_edges_checked": 4506, + "repaired_roles": 3283, + "retained_nodes": 1463, + "roles": 2271 + }, + { + "dag_sha256": "f9d2375afd4e3826a30488227930033e45b2ce78941393cdb3dc21562d836e78", + "h": 26, + "local_obstructions": 59, + "nested_edges_checked": 355600, + "repaired_roles": 308336, + "retained_nodes": 52464, + "roles": 82720 + } + ] + } + ], + "status": "PASS_IDENTICAL_PARITY_SIDE_RECEIPTS", + "warmup": 1 +}