Skip to content

Tooling: exact opt-in 2.3x acceleration of the transport audit behind the control suites (no new kappa) - #1156

Closed
thakrarsagar wants to merge 1 commit into
CrocSwap:mainfrom
thakrarsagar:research/fast-transport-audit-seed87
Closed

thakrarsagar wants to merge 1 commit into
CrocSwap:mainfrom
thakrarsagar:research/fast-transport-audit-seed87

Conversation

@thakrarsagar

Copy link
Copy Markdown
Contributor

Status: tooling improvement (verification engineering). No new κ. No mathematical check is changed, skipped or weakened, and no pinned file or orchestrator is edited.

Track 85–94, OS-random seed 87. Base: current main ce7ad1b6. The work started on 29218749, and every pinned input is unchanged between the two. Only research/fast-transport-audit-seed87/ is added.

What it speeds up

PR635's hpe_audit_and_transport.run (sha c9a05ff2…) is the per-trial cost of every negative-control suite in the cold chain. Each suite runs 96 full audits:

fast_controls.py is a drop-in for python3 <control script> <args>. An import hook lets the script select hpe_audit_and_transport.py by its own rule and executes it from the hashed bytes, never a .pyc. Only for the validated sha256 does it rebind five exact primitives:

  • Q: integral values as int;
  • apply: integer and ±1 fast paths, with the same assertion order, lazy row access and zero-dropping;
  • copy: structural copy of flat gate records only;
  • basis: memoised on all-int inputs;
  • state_maps: scaled-integer dyadic P and P⁻¹, falling back to the pinned code for anything else.

run() and every assertion and message remain the pinned code objects. An unvalidated module runs unaccelerated, or exits non-zero under --require-fast.

Evidence

python3 -I -B research/fast-transport-audit-seed87/verify.py            # tests + 4 real suites (~10 min)
python3 -I -B research/fast-transport-audit-seed87/verify.py --quick    # tests + T37 suite (~2.5 min)

Expected final line: PASS_FAST_HPE_TRANSPORT suites=4 audits=384 identical_receipts_logs_outcomes cpu=…. Deterministic fields are compared with EXPECTED.json. An independent --quick rerun and a clean sparse clone of this branch both reproduced it.

  • Four archived suites, 384 audits. Inputs, receipts and logs are read from the repo's own evidence tarballs. Each unchanged script runs directly, through --pinned, and through --require-fast:

    • COLD-END-CONTROLS.json is byte-identical across the three runs and matches the archived receipt apart from its absolute word path;
    • stdout is identical across the three runs and equal to the archived log for the three suites that have one, apart from the seconds line;
    • all 96 per-audit outcomes are identical (exception type, repr(args) and run() line, or receipt text plus both output-word hashes).
  • Differential tests, under both Fraction constructors. Each primitive is compared with the pinned function on value, key order and exception type and message:

    • apply: 4,000 programs, including malformed gates;
    • state_maps: 300 programs (227 take the dyadic path) and the real 12,913-gate prefix;
    • basis: 3,000 inputs, including non-int and cached calls;
    • the copy, at nesting depths 1 to 2,000;
    • run() on two module instances, for the honest word plus four deep-nesting variants;
    • the import hook (it selects the script's own sibling over $PR635_CODE) and the hash guard.

    Negative controls: a sabotaged apply is detected, and a zero-coefficient gate matches the pinned code.

  • Current frontier. On the Conditional kappa 0.001672660197076918: rare-pattern T16 exchanges #1094 lineage's final k8 word, layer_end_controls_leaver.py produced a byte-identical receipt (95 rejected plus 2 declared not-applicable substitutes) and identical stdout; user CPU fell 50.6 → 24.6 s. This was recorded manually because that word isn't archived.

Adversarial review

Three reviewer subagents tried to break the claim: a primitive fuzzer (~600k apply gates), a word mutator (201 new corrupted U8 words, run in fresh processes), and a harness reviewer. They reproduced one real divergence: an earlier copy used one frame per nesting level, so a gate nested about 500–1,000 deep made the pinned audit raise RecursionError while the accelerated one passed. The copy now handles only flat records.

They also found that pre-importing from $PR635_CODE could substitute a different module for scripts that import a sibling; about 17 directories hold another version. That is why the import hook now leaves the choice to the script. Smaller fixes:

  • bare asserts are now distinguished by the run() line;
  • the receipt is compared as text;
  • a .pyc can no longer bypass the hash guard;
  • the wrapper's own directory is removed from sys.path;
  • -- is passed through to the script.

Each of these cases is now a test.

Measurements

macOS arm64, CPython 3.14.8, concurrent load 8–22:

measurement direct accelerated ratio
honest U8 audit, best-of-9 process CPU 0.766 s 0.334 s 2.29×
four archived suites, CPU 239.3 s 106.0 s 2.26×
#1094-lineage leaver suite, user CPU 50.6 s 24.6 s 2.06×

Cumulative ablation: Q/apply 1.72×, +copy 1.72×, +basis 2.07×, +state_maps 2.29×. The copy step is roughly neutral now and can be dropped.

Scope

Credit

Prepared by Sagar Thakrar with substantial assistance from Anthropic Claude (Claude Code), including the explorer, judge and reviewer subagents.

…nd the control suites (no new kappa)

An import hook lets each unchanged control script select hpe_audit_and_transport.py
by its own rule, executes it from the hashed bytes, and for the validated sha256
rebinds five exact primitives (Q, apply, copy, basis, state_maps); run() and every
assertion stay pinned. Four archived suites (384 audits): receipts, logs and all
per-audit outcomes identical across direct, pinned-wrapper and accelerated runs.
2.29x per audit, 2.26x suite CPU. Adversarially reviewed; the found recursion-depth
and module-substitution issues are fixed and covered by tests.
@Mister-Meeseeks

Copy link
Copy Markdown
Contributor

100-PR batch review at 3bd6e27188b263a9b3dc1f1f41229c3989c405fd.

This remains open after scoped triage. Next review step: Exactness tests passed with both Fraction constructors. The full run completed t37-u8-layer-end, 799-x4-layer-end and 741-p6n-layer-end (96 audits each), but hit the 900-second batch limit before 741-inherited-cold-end and the final EXPECTED comparison completed. Finish and retain the fourth-suite comparison plus the full deterministic-field check; no default checker change is admitted.

This is a specific continuation point, not a rejection or a request to redo already recorded checks. Completed local evidence is retained separately from outstanding whole-head obligations.

Batch review, attribution and evidence. Thank you for the contribution.

@thakrarsagar
thakrarsagar deleted the research/fast-transport-audit-seed87 branch October 14, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants