Repository navigation
Paper §3-4 prose: the kernel paragraph explains candidate selection, §4 one job per sentence, condition names - #194
Conversation
…andidate is lost, S5 cites SGLang's sampler §3.1, the paragraph after Theorem 3.1: the error bound's name and meaning come first, then why the computed comparisons are sound, which hardware assumption the screen rests on, and how loose the bound is; the appendix pointer goes last without its jargon list. §3.3 ¶1: the seeded sampler's race cites SGLang's sampler (citation auditor S5); "as part of our engine patches" is dropped. §3.4: the kernel paragraph says what each GPU program keeps per chunk of vocabulary entries (the four largest upper ends and the largest upper end of the rest), how the selection step recovers a whole chunk when that remainder reaches the threshold, and that an overflowing list falls back. Facts from src/certified_head/kernels.py (epilogue 3 and the selection kernel); no number or evidence key changes.
…es, §4.3 points back to §2.2 §4.1: the capture split drops its jargon examples and says in one clause why the kernel replay draws from both halves; the fixed-configuration paragraph keeps "queues the rest" beside the 16-request cap (cold reader 3) and no longer repeats §2.3's batch-shape rule; MTP-4B's settings leave the parenthesis. §4.2: the kernel-replay count folds its model dependence into one sentence and gives the moved Table 3's appendix; the held-out paragraph splits its first sentence, drops the half-the-bytes repeat and the circular pointer to §3.1, and puts "gap condition only" beside the speculative-capture claim. §4.3: paragraph heads say "interval condition"; the kernel-replay paragraph points to §2.2 for the FP32-output variant (its 1/58 is stated there); the engine check no longer restates §4.3's per-position conclusion. §4.4: the microbenchmark paragraph takes the two details leaving Figure 3(c)'s caption (medians of 30 graph replays; under the Hopper model both expected times lie between the conservative ones and the all-certified time at every measured M, checked against head_path_time.csv) and fixes the unclear "that would shorten". §3.3 ¶2: "It changes the rule of SGLang's speculative sampler" replaces the "not X but Y" opening; "is unchecked for it".
…s the main text does The last uses of "gap rule" and "interval rule" were in the moved Table 2 (Appendix F) and Table 3's caption (Appendix A); one name per thing.
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Verdict: REQUEST CHANGES at c4c462e Reviewer 2 (paper fidelity and quality). I diffed every changed paragraph against main (6490520) and checked the new and changed facts against the code and the evidence. The PR is careful. Every number, condition and Checked and correct
Blocking
Optional
Build at c4c462e (my own, one core, niced, during an untimed hold): 0 LaTeX warnings, 0 overfull or underfull boxes. The paper is 50 pages and the notes 53. The Conclusion and the References heading are both on p10. |
…t sentence, and "half as often as that sampler" The second "it" could attach to SGLang's sampler, and "half as often" had lost its comparison, so the sentence could read as the reverse of App B.2. §3.1: the error bound's interval holds "under the theorem's assumptions".
|
Reviewer 2's change is in 2ca57a9. §3.3 ¶2 now opens: "Fixed-noise verification replaces the acceptance rule of SGLang's speculative sampler, which verifies drafts by rejection sampling: it can accept sampled drafts as little as half as often as that sampler, and deterministic drafts, SGLang's default, as often (Appendix B.2)." I checked it against Proposition B.2: the standard rule accepts with probability sum_i min(p_i, q_i), and fixed-noise acceptance is at least half that. The optional §3.1 point is also in: "under the theorem's assumptions, entry i's real logit lies in the interval". The build is clean, the main text ends on p10, and numdiff is unchanged. |
|
Verdict: APPROVE at 2ca57a9 Reviewer 2. I checked the delta from c4c462e to 2ca57a9. It changes two sentences in head.tex, and both are right. This approves the PR, which I reviewed in full at c4c462e (issuecomment-5949440580).
Build at 2ca57a9 (my own, one core, niced, during an untimed hold): 0 LaTeX warnings, 0 overfull or underfull boxes. The paper is 50 pages and the notes 53. The Conclusion and the References heading are both on p10. Codex was clean on c4c462e (09:40) but has not been re-requested on 2ca57a9. The delta is two prose sentences with no number, citation or evidence change. If main wants a Codex pass on this head before merging, I will confirm this approval afterwards. |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Why
This is the second pass of the main-text edit, after #183 (§1-2). It grades every unit of §3 and §4 as strong, uneven or weak; fixes the sentences that fail; and leaves strong units as they are. Two cold readers flagged §3.4's kernel paragraph as unparseable. §4 carried sentences doing four jobs, a circular pointer between §3.1 and §4.2, and repeated qualifications. One row per unit is at the end.
It is rebased onto main after #183 merged.
What changed
§3, The Certified Head
src/certified_head/kernels.py(epilogue 3 and the selection kernel). No number or evidence key changes.§4, Measurements
evidence/certified_head/head_path_time.csvat all nine M from 1 to 256, for both fallbacks. The paragraph's last sentence no longer has an unclear "that".Not touched: float blocks and captions (figures pass), §4.5 and Table 5 (results content). Targeted notes for §4.5 are in the ledger.
Checks
scripts/check_paper_references.py --rev HEADis clean.\evand\pendis still on its claim.Old and new text, unit by unit
head.tex
Old:
New:
head.tex
Old:
New:
head.tex
Old:
New:
head.tex
Old:
The certified head for $M$ head inputs runs as a short pipeline with grids fixed by $M$, recorded as a CUDA graph once per batch size together with its fallback. The int8 pass multiplies int8 weights by the BF16 head inputs (W8A16), accumulates on tensor cores in FP32, and evaluates the error bound in its epilogue with directed rounding. Instead of writing the $M\times V$ logits, each chunk of vocabulary entries it processes keeps its four largest upper bounds and one bound for the rest of the chunk; a chunk whose remaining bound still reaches the threshold has all its entries kept, so compaction into a candidate list of fixed capacity loses no candidate, and a position whose list overflows goes to the whole-batch fallback. A kernel inherits the error bound only if it computes the modelled arithmetic, which is checked, not proved: each compiled variant must pass a self-test before it certifies, and every call checks eight exactly computed vocabulary entries per position \ev{kernel-impl}. The checks have caught faulty compiled kernel configurations, which are now refused (Appendix~\ref{app:kernel-checks}) \ev{kernel-tma,triton-tma}. The int8 copy, 0.64~GB, is held in addition to the resident BF16 head (derived).New:
The certified head runs as a short pipeline of GPU launches whose grids depend only on $M$, recorded with its fallback as one CUDA graph per batch size. The int8 pass multiplies the int8 weights by the BF16 head inputs (W8A16), accumulates in FP32 on tensor cores and computes each interval in its epilogue with directed rounding. Instead of writing the $M\times V$ logits, each GPU program keeps, per position and per chunk of vocabulary entries, only the four largest upper ends and the largest upper end among the rest. Once each position's largest lower end is known, a selection step keeps every stored entry that reaches the screen's threshold. If the largest upper end among the rest of a chunk reaches it too, the step keeps the whole chunk, so no candidate is lost. A position whose candidates overflow the list's fixed capacity goes to the whole-batch fallback. A kernel inherits the error bound only if it computes the modelled arithmetic, which is checked, not proved: each compiled variant must pass a self-test before it certifies, and every call checks eight exactly computed vocabulary entries per position \ev{kernel-impl}. The checks have caught faulty compiled kernel configurations, which are now refused (Appendix~\ref{app:kernel-checks}) \ev{kernel-tma,triton-tma}. The int8 copy takes 0.64~GB beside the resident BF16 head (derived).setup.tex
Old:
New:
setup.tex
Old:
\paragraph{Capture} A capture-only engine patch records each position's head input as BF16 bit patterns, with the token the engine chose; under speculation it also records the drafter's head inputs and pairs each drafted token with the target head input that verifies it. The capture servers ran without CUDA graphs or the overlap scheduler, with at most 16 running requests in plain decoding (Appendix~\ref{app:transport-capture}). The 320 \emph{capture prompts} come from eight public datasets in four domains and were decoded greedily for 384 tokens. They were split by prompt into an analysis half, on which data-dependent choices were made (such as which columns of $h$ to compute exactly, or a rotation of $h$), and a held-out half. The deployed copy and its bound depend on the weights alone, so the kernel replay need not be held out, and it is not: its positions come from both halves. In plain decoding the FP64 argmax of the captured head input equals the engine's token at 99.51\% of positions, and every disagreement lies within one BF16 spacing of the FP64 winner \ev{alignment}. \paragraph{A fixed configuration}\label{sec:same-shape} Bit-equality is a useful test only within one configuration, because the stock engine's own output varies across configurations: on one server running at most 16 requests, plain greedy decoding with the client keeping 1 or 32 requests in flight differs within 256 tokens in 52\% of 320 \emph{divergence prompts}, a separate test set (Appendix~\ref{app:divergence}) \ev{state-noise}. A bit-exact trace places the first differences upstream of the head, in kernels whose results depend on the batch or the memory pools, never in the head GEMM or the tie rule \ev{state-mech}. Every comparison here therefore holds the serving configuration fixed and compares a speculative configuration with stock speculative verification, not with plain decoding; the contract also fixes the head's batch shape $M$ (Section~\ref{sec:kernel-fallback}).New:
setup.tex
Old:
New:
setup.tex
Old:
\paragraph{Held-out replay, \Rreal{} rule} This replay of 6,005 held-out plain-decoding positions, drawn as whole decode steps, compares copies of the head on the simpler \Rreal{} decision, whose screen needs no margin; no error bound was violated and the exact winner was always a candidate \ev{selfevidence,selfevidence-csv}. Int8 with one scale per entry reads half the BF16 head's bytes and needs 1.55 candidates on average. FP8 needs about three times as many, and int4 leaves tens of thousands (Figure~\ref{fig:candidates}a; Table~\ref{tab:candidates}). Int8 suffices because of the margins, not because its bound is tight (Section~\ref{sec:envelope}). Its intervals are about two logits wide, while the median gap between the two largest logits is 7.3 logits \ev{stats}, so tightening the bound helps little (Appendix~\ref{app:candidates}). On the verification positions of the speculative captures, the counts are about the same as in plain decoding (Appendix~\ref{app:candidates}) \ev{selfevidence-dflash,selfevidence-mtp}; there only the gap condition of Theorem~\ref{thm:stock} has been evaluated offline.New:
setup.tex
Old:
New:
setup.tex
Old:
\paragraph{Engine check, \Rstock{} interval rule}\label{sec:engine} The engine check ran the kernel inside SGLang, untimed and under the \modelcons, on plain decoding, greedy verification and the drafters' projections. In concurrent runs (up to 16 requests for plain decoding, 8 for speculation) none of 196,734 certified positions differed from the stock head at the same batch shape \ev{kernel-engine}. Runs with one request at a time gave identical certified and stock outputs on all 64 prompts for plain decoding and MTP-4B; DFlash-4B's outputs were not compared end to end. Every path used the whole-batch fallback except one plain-decoding run, which used the per-position fallback. Plain decoding fell back at 1.38\% of positions, close to the kernel replay's 1.46\%, and MTP-4B verification at 1.74\%. DFlash-4B verification sends up to 128 positions per call and left only 3.99\% of them open, yet ran the whole-batch fallback in 90\% of its verify head calls. We infer that the per-position fallback would have to carry the result there; the engine check exercised it only in plain decoding.New:
\paragraph{Engine check, \Rstock{}, interval condition}\label{sec:engine} The engine check ran the kernel inside SGLang, untimed and under the \modelcons, on plain decoding, greedy verification and the drafters' projections. In concurrent runs (up to 16 requests for plain decoding, 8 for speculation) none of 196,734 certified positions differed from the stock head at the same batch shape \ev{kernel-engine}. Runs with one request at a time gave identical certified and stock outputs on all 64 prompts for plain decoding and MTP-4B; DFlash-4B's outputs were not compared end to end. Every path used the whole-batch fallback except one plain-decoding run, which used the per-position fallback. Plain decoding fell back at 1.38\% of positions, close to the kernel replay's 1.46\%, and MTP-4B verification at 1.74\%. DFlash-4B verification sends up to 128 positions per call and left only 3.99\% of them open, yet ran the whole-batch fallback in 90\% of its verify head calls. The engine check exercised the per-position fallback only in plain decoding.setup.tex
Old:
In the microbenchmark (the head alone at $M=1$ to 256, CUDA graphs, warm L2 cache) a fully certified batch at $M=1$ takes 239.6~\textmu s, against 370.5~\textmu s for the stock head. Adding each fallback's measured cost at its measured rate gives an expected time of about 0.7 of the stock head's up to 16 positions, with the per-position fallback under the \modelcons{} (Figure~\ref{fig:candidates}c) \ev{kernel-rowwise,kernel-path}. From 128 positions every mode is slower, because the int8 pass alone is slower than the stock head there; with the whole-batch fallback, 77\% of calls also pay for the stock head. The pass is not bound by memory bandwidth: at one position its directed-rounding epilogue keeps the streaming multiprocessors 79\% busy while it draws 62--63\% of DRAM bandwidth, so its time grows with $M$ faster than the stock GEMM's \ev{kernel-micro}. At one position the expected time under the \modelcons{} is 0.66--0.67 of the stock head's with either fallback \ev{kernel-path}. Since the head takes 10.3\% of a plain decode step at batch 1, that would shorten the step by at most about 3.4--3.5\% (derived; the effect on served decoding is not yet measured \pend{bench-cert}).New:
In the microbenchmark (the head alone at $M=1$ to 256, CUDA graphs, warm L2 cache; medians of 30 graph replays) a fully certified batch at $M=1$ takes 239.6~\textmu s, against 370.5~\textmu s for the stock head. Adding each fallback's measured cost at its measured rate gives an expected time of about 0.7 of the stock head's up to 16 positions, with the per-position fallback under the \modelcons{} (Figure~\ref{fig:candidates}c) \ev{kernel-rowwise,kernel-path}. Under the \modelhopper{}, with its lower fallback rates, both expected times lie between these and the all-certified time at every measured $M$ \ev{kernel-path}. From 128 positions every mode is slower, because the int8 pass alone is slower than the stock head there; with the whole-batch fallback, 77\% of calls also pay for the stock head. The pass is not bound by memory bandwidth: at one position its directed-rounding epilogue keeps the streaming multiprocessors 79\% busy while it draws 62--63\% of DRAM bandwidth, so its time grows with $M$ faster than the stock GEMM's \ev{kernel-micro}. At one position the expected time under the \modelcons{} is 0.66--0.67 of the stock head's with either fallback \ev{kernel-path}, so with the head at 10.3\% of a plain decode step at batch 1, the step would shorten by at most about 3.4--3.5\% (derived; the effect on served decoding is not yet measured \pend{bench-cert}).app_register.tex
Old:
New:
app_register.tex
Old:
New:
app_proofs.tex
Old:
New:
Ledger: one row per unit