Skip to content

Repair P9: the support oracle does not reject window reuse with top-8/16 sets at c = 1 - #97

Merged
SamMausberg merged 10 commits into
mainfrom
repair/p9-oracle
Oct 1, 2026
Merged

SamMausberg merged 10 commits into
mainfrom
repair/p9-oracle

Conversation

@SamMausberg

Copy link
Copy Markdown
Owner

Support oracle for Sam's proposal P9 (2026-10-01), correction-closed drafting: after a rejection, reuse once a program compiled from the first cycle's cached DFlash candidate sets, conditioned on the actual correction, instead of drafting the next block fresh. This is the pre-registered first test, run before anything is learned, at concurrency 1.

Rule and result

Two-cycle aggregate test, Delta = E[G2_R - G2_F] - r_F E[A + T2_R - T2_F], r_F = E[G1 + G2_F] / E[T1 + T2_F]; reject this finite-window reuse at the tested configuration if the upper confidence bound of Delta_oracle is <= 0.

18,274 post-rejection cycle boundaries of the drafter workstream's shared DFlash-16 trace (80 requests). Where the corrected prefix lies in the old top-K sets, the greedy oracle proposes the true token wherever it is in the old set, so its second cycle commits 1 + min(m, U_K - J) tokens against fresh DFlash's 1 + L'; a reused cycle costs a fresh cycle minus its 2.33 ms draft phase.

K corrected prefix supported oracle G2 / fresh G2 (reused boundaries) Delta per boundary (95% CI) rule
1 1.6% 2.72 / 6.94 -0.04 (-0.06, -0.03) rejected
2 48.1% 3.10 / 6.07 -0.67 (-0.87, -0.51) rejected
4 71.1% 3.64 / 5.82 -0.42 (-0.64, -0.23) rejected
8 82.4% 4.34 / 5.66 +0.22 (+0.03, +0.39) not rejected
16 88.8% 5.08 / 5.55 +0.99 (+0.82, +1.13) not rejected

The unchanged cached unary control (the old draft's tail after the correction) accepts 0.83 drafts and gives -1.93 (-2.34, -1.59): rejected. Valuing the saved time at DFlash's overall rate instead of the two-cycle rate gives +0.89 (K = 8) and +1.70 (K = 16). By domain at K = 16: chat +1.44, code +1.11, maths +0.82, MATH-500 +0.55. Confidence intervals: request-level bootstrap, 2,000 resamples.

Assumptions

  • Candidate sets are the drafter workstream's offline recomputation (HF target features, SpecForge drafter module, BF16), whose top-1 token matches the engine's drafted token at 97.4% of positions, not the engine's own sets.
  • Costs are the c = 1 phases of one DFlash-16 run in the drafter's configuration (evidence/repair/stage_a_timing.json, run fresh_b16); a reused cycle is charged exactly a fresh cycle without its draft phase.
  • The oracle's extra first-cycle cost A is 0: compiling the program, retaining the candidate sets, conditioning on the correction and draft-cache catch-up are unpriced.
  • The oracle knows the true token wherever it lies in the old set, so it bounds every real program from above; a real program has to select it (the unary control shows the old top-1 choices fail) and pay A out of the same margin of about one token per rejection.

Files

  • experiments/repair/p9_support_oracle.py (also scores a selector's re-walk of the old slots with a per-reuse cost, --rewalk, for the matched-refiner control once the drafter's selector exists)
  • evidence/repair/p9_support_oracle.json (reproduces byte for byte from the raw table)
  • evidence/repair/README.md: P9 section with the command.

Not yet: the draft share at c = 8 and 16 (queued), a priced fixed-shape program and the matched refiner (the drafter workstream's P6 selector re-walking the old slots).

…6 sets

On 18,274 post-rejection boundaries of the shared DFlash-16 trace, a greedy
oracle that reuses the old window's top-16 candidate sets after the actual
correction commits 5.08 tokens against fresh DFlash's 5.55 but skips the
2.33 ms draft: Delta = +0.99 tokens per boundary (95% CI +0.82, +1.13).
Top-8: +0.22 (+0.03, +0.39). Top-4 and below and the cached unary control
are rejected.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T11:13:46.974301Z 3670dd8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80aa96a483

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread experiments/repair/p9_support_oracle.py Outdated
Comment on lines +228 to +229
r_f, d, per = delta(rows, g2r, supported, ph, extra_us=0.0)
lo, hi = bootstrap(rows, per, args.bootstrap, seed=k)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recompute r_F within each bootstrap replicate

The default metric estimates r_F from the same request data, but the bootstrap receives already-computed contributions using the full-sample r_F and only resamples their mean. This omits both the sampling variation in r_F and its covariance with reuse frequency and token gains, so the reported request-level 95% intervals are not intervals for the defined Delta; resample the request rows and recompute r_F and Delta in every replicate.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 13949b4: each request-level bootstrap resample re-estimates r_F on its own boundaries before computing Delta. Point estimates are unchanged; the intervals are regenerated in the JSON and README (top-16 +0.99 (+0.90, +1.07), top-8 +0.22 (+0.12, +0.32)).

Comment thread experiments/repair/p9_support_oracle.py Outdated
Comment on lines +237 to +240
by_domain[dom] = {
'boundaries': len(idx),
'supported_rate': statistics.fmean(supported[i] for i in idx),
'delta_oracle': statistics.fmean(per[i] for i in idx),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recalculate the baseline rate for each domain

The per-domain values average per, whose contributions were calculated with the pooled all-domain r_F. Because the domains have different acceptance rates, these are not each domain's two-cycle Delta under the formula documented above, yet the README reports them as results “By domain.” Subset the rows and recompute r_F and Delta for each domain before recording these values.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 13949b4: the by-domain Deltas use each domain's own two-cycle r_F (recorded per domain as r_F_tokens_per_ms); README updated (top-16: chat +1.08, code +1.23, maths +1.02, MATH-500 +0.86).

Comment on lines +8 to +10
Input: the drafter workstream's per-cycle support table for the shared block-16 DFlash
trace (`support_screen.py --save-cycles`): per verify cycle the request id, prefix length,
the engine's accepted length L, the realized greedy continuation g (15 positions: the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Provide the documented cycles-table producer

A fresh checkout cannot generate the required cycles.pt: a repo-wide search shows that the referenced experiments/drafter/support_screen.py has no --save-cycles option and writes only summary.json and survival.csv, while the input itself is explicitly outside Git. Consequently the committed reproduction command cannot reproduce or independently check this evidence; add the producer/export path (or commit an independently verifiable input artifact).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed: the producer of cycles.pt (the drafter workstream's support_screen.py --save-cycles) is not yet on a pushed branch. I have asked the drafter workstream to push it and send the exact command and commit; the README will record them next to the file's SHA-256 before this PR is ready again.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Reviewed head 80aa96a: four commits, rebased onto main 65a0a23. The oracle script was first committed at 03:31 (d218a58), before the results commit (08:29, b0539c2).

What checks out

  • The evidence reproduces. evidence/repair/p9_support_oracle.json reproduces byte-identical with the README command. I ran it on one core in 8 s. The raw table's SHA-256 starts a587d952074d93f5.
  • The inputs match committed evidence. The table's 21,067 cycles and the 97.4% offline top-1 agreement (0.9745) match the committed evidence/drafter/support/zlab_b16_panel_v1_summary.json. The phases are fresh_b16's: a 2.33 ms draft phase and a 7.46 ms cycle. The overall rate of 1.029 tokens/ms is 7.675 / 7.457.
  • The framing is honest. "Not rejected" is the right word for the rule (reject if the upper confidence bound is ≤ 0). The four assumptions are stated, and the result is framed as an upper bound with A = 0.
  • Hygiene. pre-commit passes, and the commits are Sam's with no AI attribution.

Blocking (Codex's three P2s, all valid)

B1 (p9_support_oracle.py:229): the bootstrap understates the uncertainty. The bootstrap resamples per-request contributions that were computed with the full-sample r_F, so its intervals leave out the variance of r_F and its covariance with reuse frequency and gains. They are not intervals for the defined Delta. Resample request rows and recompute r_F and Delta in each replicate, then regenerate the JSON and the README table. K = 8's interval (+0.03, +0.39) is close enough to zero that the corrected interval must be shown before "not rejected" is stated for it. The rule uses the upper bound, but the README also leans on the lower bound in "comes out ahead".

B2 (:240): the by-domain values use the pooled r_F. "By domain at K = 16: chat +1.44, code +1.11, maths +0.82, MATH-500 +0.55" averages contributions computed with the all-domain r_F, so these are not each domain's Delta under the stated formula. Recompute r_F and Delta per domain, with intervals, or relabel the values as the pooled-rate decomposition. The same applies to the K = 8 by-domain figures in the JSON. MATH-500 there is −0.36.

B3 (:10): the input's producer is not committed. The docstring names support_screen.py --save-cycles, but experiments/drafter/support_screen.py on main has no such option. The commit that adds it, b631dc4 ("Support screen can save the per-cycle joint table…", 03:21), is on no pushed branch. A fresh checkout therefore cannot regenerate cycles.pt, and the README's reproduction starts from a file nothing in the repository makes. Get b631dc4 merged first through the drafter workstream, or include it here. Record the command that produced cycles.pt next to its hash.

r_F and Delta are now computed on the same boundaries: each request-level
bootstrap resample re-estimates the two-cycle rate, and each domain uses its
own. Point estimates are unchanged; the intervals narrow (top-16
+0.99 (+0.90, +1.07), top-8 +0.22 (+0.12, +0.32)) and the by-domain values
change (top-16: chat +1.08, code +1.23, maths +1.02, MATH-500 +0.86).
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (only B3 remains)

Re-reviewed 13949b4.

  • B1 is fixed. estimate() recomputes r_F on each bootstrap replicate's boundaries. The point estimates are unchanged, and the intervals are now K = 16 +0.99 (+0.89, +1.07), K = 8 +0.22 (+0.12, +0.32), and the unary control −1.93 (−2.22, −1.69). The JSON reproduces byte-identical with the README command; I ran it on one core.
  • B2 is fixed. Each domain gets its own two-cycle r_F. At K = 16 the values are chat +1.08, code +1.23, maths +1.02 and MATH-500 +0.86. At K = 8 they are chat +0.50, code +0.31, maths +0.28 and MATH-500 −0.06. The README's by-domain line now names the per-domain rate.
  • B3 is still open. The cycles.pt producer (support_screen.py --save-cycles, b631dc4) is not on main or any pushed branch. I'll re-check when the drafter workstream pushes it and the exact command is recorded next to the SHA-256.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (B3 wording only)

Re-reviewed eef667e. The content of B3 is now right: the full SHA-256, the producer, the run time and the command all check against #104, which I approved at 33e1a0c and which matches the file.

One thing remains. The README text cites "PR #104, branch drafter/support-cycles" and "drafter commit b631dc4" (on drafter/buffered-verify). A committed file may not cite an unmerged branch or PR as evidence. Once #104 merges, change the sentence to cite the files on main: experiments/drafter/support_screen.py --save-cycles, experiments/drafter/run_support_screen.sh and the provenance paragraph in evidence/drafter/README.md. Drop the PR number and branch names. Then this is ready.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Re-reviewed bcffdaf. B3 is fixed. #104 has merged, and the README now cites main's experiments/drafter/support_screen.py --save-cycles, experiments/drafter/run_support_screen.sh and evidence/drafter/README.md. No PR or branch is cited as evidence. The producing commit b631dc4 is named only as provenance, with its identical diff on main (1e66b99), which I verified on #104.

All three blockers are now fixed. The JSON still reproduces byte-identical, which I re-ran at this head, and the P9 verdict wording (not rejected at K = 8 and 16 as an upper bound, with A = 0) is unchanged. The branch is behind main but mergeable. Codex last ran on 80aa96a, and its three P2s were fixed and answered.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcffdafb5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread evidence/repair/README.md
Comment on lines +184 to +186
producer). It was written on 2026-10-01 at 08:27 UTC by `experiments/drafter/support_screen.py
--save-cycles` (on main since commit `1e66b99`; the run used `b631dc4`, an identical diff), run as
`scripts/gpu_lock.sh -s experiments/drafter/run_support_screen.sh` with the stock engine;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the cited cycles-table producer

The fresh evidence since the earlier thread is that this text now claims --save-cycles is available on main, but in the reviewed tree a repo-wide search finds that experiments/drafter/support_screen.py defines only --trace, --panel, --draft, and --out, and the cited experiments/drafter/run_support_screen.sh is also absent. Consequently a clean checkout still cannot produce the required out-of-tree cycles.pt or reproduce the committed JSON; include the producer/export implementation and runnable command in this commit rather than citing an unavailable commit.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cbc39e9: origin/main (with #104) is merged into this branch, so experiments/drafter/support_screen.py with --save-cycles is in the reviewed tree.

Comment thread experiments/repair/p9_support_oracle.py Outdated
if rewalk is not None:
# The real refiner reuses exactly where the oracle at K = 16 could: the correction is
# supported, which is observable when the decision is made.
reuse16 = [r['U16'] >= r['J'] and r['m'] >= 1 and 'rewalk_accept' in r for r in rows]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Require top-16 data before scoring a rewalk

When --rewalk is combined with a valid --ks list that omits 16 (for example --ks 8 --rewalk selector.pt), boundaries() only adds the requested U{k} fields, but this unconditional r['U16'] lookup raises KeyError and the optional refiner experiment produces no output. Either always load U_16 when rewalk scoring is enabled or reject this option combination during argument validation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f378014: --rewalk adds 16 to --ks when it is missing, since the re-walk reuses exactly where the top-16 oracle could; tests/test_repair_p9.py runs --ks 4 --rewalk on a synthetic table and checks that a re-walk following the truth wherever it is supported reproduces the top-16 oracle's Delta.

A --ks list without 16 made --rewalk fail on U16; the script now adds 16
whenever --rewalk is given. Test with a synthetic table (skips without torch).
The committed JSON regenerates byte for byte.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f37801454b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread experiments/repair/p9_support_oracle.py Outdated
if rewalk is not None:
# The real refiner reuses exactly where the oracle at K = 16 could: the correction is
# supported, which is observable when the decision is made.
reuse16 = [r['U16'] >= r['J'] and r['m'] >= 1 and 'rewalk_accept' in r for r in rows]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject incomplete rewalk tables

When a --rewalk artifact omits any top-16-supported boundary, the 'rewalk_accept' in r condition silently treats that boundary as fresh DFlash, avoiding both the refiner's token loss and --rewalk-cost-us. Thus a partial artifact—such as one containing only successful or available walks—can inflate the matched-refiner Delta even though the stated policy reuses at every supported boundary. Require a walk for every eligible (rid, prefix_len) or model an explicit decision-time abstention rule rather than using missing data as fallback.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3670dd8: with --rewalk, every boundary the top-16 oracle would reuse (U16 >= J and m >= 1) must have a walk. If any are missing, the script exits non-zero before writing output and names the count and the first missing (rid, prefix_len) keys. Each boundary record now carries prefix_len for this check. tests/test_repair_p9.py::test_partial_rewalk_fails_closed drops one walk from the table and checks for the exit and for no output file. Without --rewalk, p9_support_oracle.json still regenerates byte for byte.

…daries

A boundary the top-16 oracle would reuse but the re-walk lacks used to be
scored as fresh DFlash, which could inflate the refiner's Delta. The script now
exits naming the missing (rid, prefix_len) keys; test with a partial table.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Re-reviewed 3670dd8 (cbc39e9, f378014 and 3670dd8).

  • cbc39e9 is a pure merge of main. Re-doing it from bcffdaf gives no conflict and no difference. It brings Support screen: save the per-cycle table for P9 (cycles.pt provenance) #104's support_screen.py --save-cycles into the reviewed tree, as Codex asked.
  • f378014 makes --rewalk add 16 to --ks when it is missing, since the re-walk reuses exactly where the top-16 oracle could.
  • 3670dd8 fixes Codex's P2 on f378014. A --rewalk artifact missing any top-16-supported boundary now exits, naming the missing (rid, prefix_len) pairs, instead of scoring those boundaries as fresh DFlash.
  • Tests. tests/test_repair_p9.py passes (2): a re-walk that follows the truth reproduces the top-16 oracle's Delta, and an incomplete artifact is refused.
  • Evidence. p9_support_oracle.json still reproduces byte-identical; I ran it on one core at this head. pre-commit passes.

Codex finished on f378014, and its one P2 is what 3670dd8 fixes. It has not run on 3670dd8.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 3670dd83a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant