Repository navigation
Repair oracles: Stage A refutes P3's two-pass design; recycling does not help DFlash - #56
Conversation
engine/sglang/patches/repair-0001 adds env-gated probes to SGLang's DFlash worker (per-cycle GPU phase timing, reference-continuation injection, Jacobi recycling policies, and exact Jacobi sweeps from the same committed prefix). experiments/repair/ drives them (serve_probe.py), builds the checkpoint panel from the drafter's shared DFlash trace, times GDN state handling at wide blocks, derives the Stage A oracle table, analyses Jacobi progress and evaluates a fixed-basis anchored residual evaluator at the decision level.
At boundaries after a rejection, drafting the next block from the target's suffix predictions accepts 0.52 drafts on average at block 16 (0.45 at block 8) against 4.44 (3.21) for the fresh DFlash draft.
…e patch under patches/repair
…y switch (engine patch 0002)
…racle Forced full acceptance at B = 16..256 on GH200 (c = 1): the verify pass takes 4.8, 7.3, 15.6, 28.1 and 44.8 ms, so a perfect drafter reaches at most 5.5x DFlash's decode rate (5.0x end to end) at B = 256 and the two-pass anchor-plus-audit design at most 2.9x (2.8x end to end).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5b4d82d02
ℹ️ 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".
| elif not g and args.state_bytes_bound: | ||
| states = B * 24 * 32 * 128 * 128 * 4 / (write_tbps * 1e12) * 1e6 | ||
| state_source = 'bound: per-position state bytes at the HBM write rate' | ||
| replay_a = med(g, 'replay_a', 'median_us') | ||
| if verify is None or commit is None or period is None: | ||
| continue | ||
| v0 = verify - (0.0 if replay_protocol else states) |
There was a problem hiding this comment.
Use a valid lower bound for the P3 anchor pass
When the committed --state-bytes-bound path is used, states is only the theoretical minimum time required to write the state bytes; the actual state overhead may be much larger. Subtracting that minimum from verify therefore produces an upper bound on v0, yet v0 is added to the P3 cost and the resulting speedup is presented as a ceiling that refutes P3. Until a no-state run measures this term, a cheaper anchor pass remains possible, so the reported 2.9x maximum and Stage A refutation do not follow from these data.
Useful? React with 👍 / 👎.
| max_extra = B - 1 - a0 + 1 | ||
| rigorous = audit_us / max_extra >= per_token_base |
There was a problem hiding this comment.
Subtract the anchor's already-committed bonus token
For an anchor acceptance of a0, the anchor has already committed a0 + 1 tokens, while a width-B audit can commit at most B tokens (B - 1 accepted drafts plus its bonus). The maximum incremental gain is therefore B - a0 - 1, not B - a0; the extra token here understates audit_us_per_max_extra_token and can incorrectly mark the rigorous P3 rejection as passing near the threshold.
Useful? React with 👍 / 👎.
| 'gate_lower_us_per_token': (verify + commit) / (B + 1), | ||
| 'gate_rejects': (verify + commit) / (B + 1) >= per_token_base, |
There was a problem hiding this comment.
Divide the gate cost by at most B committed tokens
A width-B DFlash candidate has acceptance lengths 0..B-1, so even full acceptance commits only B tokens; this is also the assumption used by s_a above and is confirmed by the forced-run commit_per_cycle values. Dividing by B + 1 understates the verify-and-commit cost per token and can turn a gate that should reject into gate_rejects = false.
Useful? React with 👍 / 👎.
|
Verdict: REQUEST CHANGES Reviewed head a5b4d82 against main at 565d253. The measurements are sound. Checked and correct
BlockingB1. The 2.9x "ceiling" uses an upper bound where it needs a lower bound. The P3 verdict still holds, but only stated against the right bound (Codex P1 on
B2. The repository has neither the verdicts nor the pre-registered rule (
B3. The session script the README cites is not committed (
B4. The engine README does not list patch 0002 or its variable (
B5. The two Codex P2 comments are valid (
Suggestions (not blocking)
|
…tracked run scripts - stage_a.py: add the S_b ceiling (anchor pass at one weight read at the measured read peak) and the state share a boundary-replay protocol would need; the gate divides by B, the most a width-B cycle commits. - evidence/repair/README.md: results and verdicts against the pre-registered Stage A rules, the target (5.51x decode at f = 2.28%), P2 Arm A rows labelled derived, and the recycling result labelled measured offline. - experiments/repair/runs/*.sh were ignored by .gitignore (runs/); add them. - engine README: patches 0001-0002, head 5d8e00e3e1, and the no-state switch marked as timing-only. - p3_gate.py: the audit accepts at most B - 1 - a0 extra drafts.
|
Verdict: APPROVE Re-reviewed head 1d8195a (one commit on a5b4d82). All five blocking items and every suggestion are addressed. One merge conflict with current main needs resolving before the merge (see the end). Blocking items
Suggestions (all taken). The pooled baseline is quoted, the repeats and spread are stated, the panel provenance is fixed, and the README reconciles the 21,354 cycles with the drafter's 21,274: one extra record per request, at most 80 of the 18,525 boundaries. Other checks. Pre-commit passes on the changed files, and the commit has no AI co-author lines. The three Codex comments (P1, P2, P2) on a5b4d82 are all addressed in 1d8195a. Merge note (not a review item). A test merge into current main conflicts in |
# Conflicts: # engine/sglang/README.md
|
Verdict: APPROVE Approving head 79f3e99. It is a merge of main (a4fb20f) into the approved 1d8195a. I checked that it is a pure conflict resolution:
GitHub reports the PR as MERGEABLE/CLEAN. My earlier approval (#56 (comment)) applies to this head. |
Oracle kill tests for PROPOSALS.md P2 (long-window exact repair) and P3 (target-anchored residual decoding). This PR carries the measured Stage A oracle and the one-step recycling result, the engine probes and drivers behind them, and the code for the remaining tests (exact Jacobi sweeps, decision-level anchored evaluator), whose runs are queued on the GPU. Results will be added to this branch as they land.
Results so far
Stage A, perfect continuations at width B (
evidence/repair/stage_a_timing.json,stage_a_oracle.{json,csv}). GH200, concurrency 1, DFlash-4B with the drafter workstream's trace flags, verification forced to accept every B-token block (SGLang'sSGLANG_SIMULATE_ACC_LEN), eight MATH-500 problems of 2,048 tokens:Stock DFlash at block 16 on the same problems commits 7.68 tokens per 7.46 ms cycle (970 tokens/s); prefill and scheduling take f = 2.3% of a request, so 5x end to end needs 5.5x in decode.
One-step recycling on the shared DFlash trace (
evidence/repair/one_step_recycling.json,draft_source_accuracy.csv). At the 18,525 cycle boundaries after a rejection (block 16), drafting the next block from the previous verify pass's target predictions accepts 0.52 drafts on average, against 4.44 for the fresh DFlash draft; keeping the previous draft's tail gives 1.11, and the best of the three chosen with hindsight 4.55 (+2.5%). Block 8: 0.45, 1.15 and 3.30 against 3.21. The target's prediction after a wrong draft token matches the continuation 14% of the time once that token is corrected (DFlash's first drafted token: 84%). This is the P2 Arm B sliding-recycling result; multi-sweep exact Jacobi is queued.What is in the PR
engine/sglang/patches/repair/0001: env-gated probes in SGLang's DFlash worker (CUDA-event phase timing without host syncs, reference-continuation injection, recycle/keep policies, and a probe mode that re-verifies the same prefix k times with the GDN conv/SSM state restored and checks the restored pass reproduces the first pass bit for bit; 0 mismatches in 66 smoke cycles).0002: a timing-only switch that verifies without per-position GDN states. All off by default.experiments/repair/:serve_probe.py(one server per run, startup lock, foreign-CPU recording),panel.py,analyze_timing.py,stage_a.py,analyze_jacobi.py,residual_eval.py(fixed-basis anchored evaluator on the HF model, two cascading replays against the original anchor, R_i, hazards, free-running repair audited exactly),summarize_residual.py,p3_gate.py(Sam's economic gate with a bytes-only repair-cost lower bound),nsys_kernels.py,gdn_state_bench.py, and the GPU session scripts inruns/.evidence/repair/README.md: exact commands, configuration and provenance.Exactness
Every committed token is a target-verified token; the probes never commit approximate state. Forced-acceptance runs commit meaningless tokens by design and are used only for cost. The exactness comparison of the policies against plain decoding (top-2 logprobs) is queued.
Not yet in this PR
Measured split of V(B) (no-state verify, nsys at B = 64/256); exact Jacobi sweeps at B = 16/32/64; decision-level anchored evaluator and the P3 economic gate; reference-continuation acceptance at each width and timed policy runs; output-equality check. The ReplaySSM spec protocol refuses DFlash on this model ("requires a KDA model"), and the GDN kernel microbenchmark stalled in kernel compilation, so neither contributes numbers.