Skip to content

joint-dual-replay-fast: opt-in adapter removing the joint-dual replay's per-output triple scans (1.74x replay stage, identical checks) - #1880

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
navinor:research/agent-32-replay-runtime-24ae4323
Oct 14, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
navinor:research/agent-32-replay-runtime-24ae4323

Conversation

@navinor

@navinor navinor commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

joint-dual-replay-fast: opt-in adapter removing the joint-dual replay's per-output triple scans (1.74x on the replay stage, identical checks)

Aaron Wang, with help from opencode. Verifier engineering; no kappa, no certificate, supplier or selected-frontier change. Apache-2.0.

Scope

  • Card: replay-runtime (scope key b1dd41940c60d240b47a; chooser OS nonce 24ae43237c3eaed2410bcdf516d854cd; priority revision 3; base 0b1cccf86e2f5132ed286a26ef0a681a495740ea; selected-record SHA-256 10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32).
  • Card selection note (pair-collision). My first-choice drawn card portable-replay (scope key 831cc1a3c8f9ff01b197) matched the fresh claim posted 2026-10-14T11:24Z in Handoffs and requests for independent checks #1166 (completed as Repair locale-dependent reads in test_research_current_status (no new kappa) #1834), so per the collision rule I took my second-choice card. Recorded as a card-selection change in research/joint-dual-replay-fast/TASK.json.
  • Object (scope refined). One measured replay bottleneck: the per-output full-triple scans in scripts/experiments/binary_frame_replay.py:replay() on the pinned words certificates/joint-dual-word-{23,25}.json.gz (frozen chain research/joint-dual, source freeze research/joint-dual/SOURCE.json, enforced by joint_dual_compose.check_sources()). This is the independent word check of the PR 25-PR 58 frame-compiler line and the dominant cost of its longest isolated test module (tests/test_joint_reclaim.py). Verification throughput only.

The measured bottleneck

cProfile of replay() on the h=23 word (CPython 3.12, Windows): 2.045 s total, 0.84 s in the per-output full-triple scan expected=sum(1<<i for i,t in enumerate(triples) if common in t and not(set(t)&(set(triple)-{common}))) and tt=[i for i,t in enumerate(triples) if common in t] (1,020,119 generator iterations at that line; 5,336 outputs x 1,771 triples).

What the package does

research/joint-dual-replay-fast/fast_replay.py re-executes the historical replay body with every assertion, both full-basis orientations and the receipt identical, replacing only those scans with containment masks over the same combinations(range(h), 3) enumeration: expected(common, triple) = center_mask[common] & ~pair_mask[common][x] for x in set(triple)-{common}, which is exactly the literal condition. check_word (including PR 64/rfu08's cancelling-scatter control, retained verbatim) and the whole transitions stage are the frozen historical implementations, imported unchanged. Nothing frozen is modified: the historical scripts, certificates and tests/test_joint_reclaim.py keep their bytes and their pins — the opt-in adapter pattern of research/ck-dyadic-replay-fast.

Evidence (all in the package; RESULT.json is the recorded receipt)

  • Identical receipts: historical vs adapter replay receipts equal on both pinned words and equal to the recorded receipts in certificates/joint-dual-compiler.json; the delegated transitions stage equals certificates/joint-dual-transitions-{23,25}.json.
  • Full cross-check: on all 12,261 outputs of both words the mask algebra equals an independently written literal scan.
  • Oracle matrix: the exact twelve mutations of the frozen tests/test_joint_reclaim.py (11 rejections + scatter-reversal acceptance) on both words, both checkers: 24 cases, every accept/reject outcome agrees with the historical module, and the documented rejections reject.
  • Failure controls: a corrupted containment table is detected by the cross-check (40/44 mismatching outputs at h=23/25); an unchecked word rejects; -O entry refuses ("Assertions must remain enabled"); source-freeze and word pins re-verified every run.
  • Adoption simulation: the unmodified frozen test module runs against the adapter through shim/binary_frame_replay.py and passes all 16 tests (verify.py runs this as a load-bearing control).

Before/after wall time (same fixture; timings are measurements, never a correctness gate)

Paired alternating runs, CPython 3.12, Windows (BENCHMARK.json):

Fixture Historical median Adapter median Speedup
replay() on both pinned words (5 pairs) 2.233 s 1.285 s 1.74x
frozen tests/test_joint_reclaim.py, unmodified (3 pairs) 41.47 s 37.72 s 1.10x

The unit fixture clears the stated target of at least 25% (42% reduction). The suite fixture improves only 10% because most of that module is JSON deep-copies, early rejection paths and the unchanged transitions stage; no coverage was dropped to improve either number.

Retained checks: check_word, every replay assertion, both full-basis orientations, the unchanged transitions stage, and the frozen test module as oracle. Invalidation: containment tables are rebuilt from the word on every call — no persistent cache, no staleness; freeze/pin bindings are re-checked each run.

Reproduce

python3.12 -B scripts/research_package.py --package research/joint-dual-replay-fast --check-only
python3.12 scripts/research_package.py --package research/joint-dual-replay-fast
python3.12 -I -B research/joint-dual-replay-fast/benchmark.py

Expected: PASS_PACKAGE_METADATA_AND_PINS, PASS_JOINT_DUAL_REPLAY_FAST_EQUIVALENCE then PASS_REGISTERED_RESEARCH_PACKAGE research/joint-dual-replay-fast outcome=completed, and paired timings in BENCHMARK.json (values vary by machine). The documented gate python3 -B -m unittest discover -s tests -p 'test_research_*.py' passes 42 tests at base and after this change (this PR adds only research/ content).

Limitations / remaining obligations

  • Opt-in only: the repository-wide suite wall time benefits only if a maintainer later adopts the adapter, which would require superseding the research/joint-dual/SOURCE.json freeze. This PR does not do that.
  • Domain is exactly the two frozen words at h in {23, 25}; the mask identity is unit-tested on synthetic shapes up to h=12 but no other word is claimed. Not checked: the C++ profile stage of verify_joint_dual.py, make frontier1094-verify and any cold replay of the selected construction (not affected by this change).
  • No mathematical claim of any kind.

Overlap

Entry and submission-time scripts/find_overlap.py refreshes (complete pagination: 519/537 open PRs, 489/521 discussion records, 2026-10-14T12:06Z and 13:05Z) found no work on this object. Distinct from research/ck-dyadic-replay-fast (CK dyadic row kernels), research/git-provenance-stream (research_package git batching), research/omission-lanes-seed92, research/rational-containment-performance (different replays) and discussion 1547's gzip full-payload adapter (different artifact).

Credit

  • Chafik Boukhalfa's frame-compiler line (PR 25 by Rohan Arun (rohanarun, with OpenAI Codex assistance) through PR 58 by Chafik Boukhalfa (chafreaky, with OpenAI Codex assistance); scripts/experiments/pin_joint_dual_sources.py, research/joint-dual) owns the frozen replay, transitions stage, words and source freeze; PR 64 (rfu08) is credited in check_word for the cancelling-scatter counterexample, retained verbatim.
  • Workflow precedent, credited not modified: research/ck-dyadic-replay-fast (opt-in adapter pattern; paired benchmark receipts) and research/git-provenance-stream (timings as measurements).
  • Task selection, profiling, adapter, controls and write-up by Aaron Wang with help from opencode; substantial AI assistance is disclosed in TASK.json. No independent human review claimed.

Claim: #1166 (comment) (released with this PR).

…al replay's per-output triple scans (1.74x replay stage, identical checks)

Aaron Wang, with help from opencode. Verifier engineering, card replay-runtime
(scope key b1dd41940c60d240b47a). Replaces the O(outputs x v) per-output scans
in binary_frame_replay.replay with per-call containment masks in an additive
adapter; the frozen historical chain (research/joint-dual/SOURCE.json), its
scripts and tests/test_joint_reclaim.py are untouched and used as the oracle.
Equal receipts on both pinned words, full literal cross-check over 12,261
outputs, the frozen 24-case mutation matrix, corrupted-table/unchecked-word/-O
controls, and an unmodified frozen-suite adoption run. Paired same-fixture
timings: replay unit 2.233s -> 1.285s (1.74x); frozen suite 41.47s -> 37.72s
(1.10x). No kappa, certificate, supplier or frontier change.
@Mister-Meeseeks
Mister-Meeseeks merged commit b6135f9 into CrocSwap:main Oct 14, 2026
17 of 61 checks passed
@Mister-Meeseeks

Copy link
Copy Markdown
Contributor

Batch review at f4e150e4222ce4b4418e66874c6363c43987c8d1.

Merged to main, preserving the original contributor commits and package attribution.

Reviewed scope: Opt-in containment-mask adapter preserves both frozen full-basis replay orientations and receipts; full historical16-test suite,24 mutation cases, exhaustive small shapes and assertion-disabled entry rejection pass. Missing historical PR58 fixture restored from exact head. Benchmark speedup remains author-measured, not selected-supplier adoption.

The pinned scoped command passed; the batch ledger contains its command, input hashes, environment and log. This incorporates the research/tooling contribution and does not change the selected κ or discharge the inherited multiplication-theorem assumptions.

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

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