Repository navigation
joint-dual-replay-fast: opt-in adapter removing the joint-dual replay's per-output triple scans (1.74x replay stage, identical checks) - #1880
Conversation
…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.
|
Batch review at Merged to 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. |
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
replay-runtime(scope keyb1dd41940c60d240b47a; chooser OS nonce24ae43237c3eaed2410bcdf516d854cd; priority revision 3; base0b1cccf86e2f5132ed286a26ef0a681a495740ea; selected-record SHA-25610b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32).portable-replay(scope key831cc1a3c8f9ff01b197) 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 inresearch/joint-dual-replay-fast/TASK.json.scripts/experiments/binary_frame_replay.py:replay()on the pinned wordscertificates/joint-dual-word-{23,25}.json.gz(frozen chainresearch/joint-dual, source freezeresearch/joint-dual/SOURCE.json, enforced byjoint_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 scanexpected=sum(1<<i for i,t in enumerate(triples) if common in t and not(set(t)&(set(triple)-{common})))andtt=[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.pyre-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 samecombinations(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 andtests/test_joint_reclaim.pykeep their bytes and their pins — the opt-in adapter pattern ofresearch/ck-dyadic-replay-fast.Evidence (all in the package;
RESULT.jsonis the recorded receipt)replayreceipts equal on both pinned words and equal to the recorded receipts incertificates/joint-dual-compiler.json; the delegated transitions stage equalscertificates/joint-dual-transitions-{23,25}.json.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.-Oentry refuses ("Assertions must remain enabled"); source-freeze and word pins re-verified every run.shim/binary_frame_replay.pyand passes all 16 tests (verify.pyruns 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):replay()on both pinned words (5 pairs)tests/test_joint_reclaim.py, unmodified (3 pairs)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
Expected:
PASS_PACKAGE_METADATA_AND_PINS,PASS_JOINT_DUAL_REPLAY_FAST_EQUIVALENCEthenPASS_REGISTERED_RESEARCH_PACKAGE research/joint-dual-replay-fast outcome=completed, and paired timings inBENCHMARK.json(values vary by machine). The documented gatepython3 -B -m unittest discover -s tests -p 'test_research_*.py'passes 42 tests at base and after this change (this PR adds onlyresearch/content).Limitations / remaining obligations
research/joint-dual/SOURCE.jsonfreeze. This PR does not do that.verify_joint_dual.py,make frontier1094-verifyand any cold replay of the selected construction (not affected by this change).Overlap
Entry and submission-time
scripts/find_overlap.pyrefreshes (complete pagination: 519/537 open PRs, 489/521 discussion records, 2026-10-14T12:06Z and 13:05Z) found no work on this object. Distinct fromresearch/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
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 incheck_wordfor the cancelling-scatter counterexample, retained verbatim.research/ck-dyadic-replay-fast(opt-in adapter pattern; paired benchmark receipts) andresearch/git-provenance-stream(timings as measurements).TASK.json. No independent human review claimed.Claim: #1166 (comment) (released with this PR).