Repository navigation
Appendices: scope seeded truncated sampling to the pinned sampler; trim run chronology and the pending list - #130
Conversation
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: 252e525c7f
ℹ️ 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".
| Two further conditions complete the random-number contract of Section~\ref{sec:decisions}. Equality in distribution, as opposed to seeded equality, needs i.i.d.\ noise with the correct marginal that is independent of the proposal draw, the acceptance uniform and the scores; a residual race (Appendix~\ref{app:residual}) also needs independence from the acceptance event. And a hash with $2^{32}$ levels makes the law exact only for the idealized continuous field; the stock seeded sampler shares that approximation. | ||
|
|
||
| \paragraph{Truncated sampling} The Gumbel-max identity has a top-$k$ form that samples $k$ tokens without replacement~\cite{kool2019}. Top-$k$ sampling applies the ladder to membership (drop $i$ when $hi_i$ is below the $k$-th largest $lo$) and races over the certified set; equality then also needs the engine's tie semantics at the $k$-th position. Min-$p$ admits $i$ when $z_i\ge z_{\max}+T\log(\text{min-}p)$, which intervals decide without a partition function. Top-$p$ admission depends on the mass above each token relative to the partition function $Z$, so it needs partition bounds and is usually cheaper to hand to the ordinary path. Fused samplers take the other route and make the dense path cheap: FlashInfer samples top-$k$, top-$p$ and min-$p$ without sorting and implements chain speculative sampling~\cite{flashinfer,flashinfersamplingblog}, and SonicSampler fuses the post-logit sampling and verification kernels over a bounded top-128 pool and describes top-$p$ under that pool as theoretically lossy~\cite{sonic}. The closest precedent for sampling from bounded scores, Mussmann, Levy and Ermon's lazy Gumbel sampling, draws noise only for a retrieved top set and, with an approximate top set, widens the cutoff by the approximation error~\cite{mussmann2017,mussmann2016}; the certified race differs in bounding every row with a dense cheap pass and in keying the noise by token, which gives pathwise equality with the dense race. | ||
| \paragraph{Truncated sampling}\label{app:truncated} The Gumbel-max identity has a top-$k$ form that samples $k$ tokens without replacement~\cite{kool2019}. Top-$k$ sampling applies the ladder to membership (drop $i$ when $hi_i$ is below the $k$-th largest $lo$) and races over the certified set. With noise keyed by token, as in the full-vocabulary race, this gives equality in distribution with top-$k$ sampling from the reference scores and, once the engine's tie semantics at the $k$-th position are matched, pathwise equality with a token-keyed dense race over the same set. It does not give seeded equality with SGLang's sampler at the pin. That sampler's seeded top-$k$, top-$p$ and min-$p$ path sorts the probabilities, keys each token's Gumbel noise by the token's position in the sorted row rather than by its index, and maps the winner back to a token through the sort's permutation, so the noise a token receives depends on its rank~\cite{sglangsampler}. Seeded equality with that path therefore needs, beyond membership, the complete order within the certified set: enclosures of the FP32 probabilities the sampler sorts that are strictly separated for every pair of members whose ranks could otherwise differ, and \code{torch.sort}'s order where probabilities are equal. The pinned sampler also refuses min-$p$ with a seed. Its full-vocabulary seeded path keys the noise by token index, and that is the case the certified race of Section~\ref{sec:decisions} covers. Min-$p$ admits $i$ when $z_i\ge z_{\max}+T\log(\text{min-}p)$, which intervals decide without a partition function. Top-$p$ admission depends on the mass above each token relative to the partition function $Z$, so it needs partition bounds and is usually cheaper to hand to the ordinary path. Fused samplers take the other route and make the dense path cheap: FlashInfer samples top-$k$, top-$p$ and min-$p$ without sorting and implements chain speculative sampling~\cite{flashinfer,flashinfersamplingblog}, and SonicSampler fuses the post-logit sampling and verification kernels over a bounded top-128 pool and describes top-$p$ under that pool as theoretically lossy~\cite{sonic}. The closest precedent for sampling from bounded scores, Mussmann, Levy and Ermon's lazy Gumbel sampling, draws noise only for a retrieved top set and, with an approximate top set, widens the cutoff by the approximation error~\cite{mussmann2017,mussmann2016}; the certified race differs in bounding every row with a dense cheap pass and in keying the noise by token, which gives pathwise equality with a dense race keyed the same way, not with the stock sampler's rank-keyed truncated path. |
There was a problem hiding this comment.
Scope the main seeded-sampler contract too
For any fixed-seed request with top-k or top-p enabled, this paragraph now correctly establishes that the stock sampler is rank-keyed, but the central contract still says the stock noise is token-keyed and that every certified token equals the stock seeded token (paper/sections/contract.tex:13,83 and paper/sections/head.tex:36-41). Consequently, the paper still promises seeded/pathwise equality for a common truncated-sampling configuration that its own appendix shows the current certified race cannot reproduce. Restrict those main claims to full-vocabulary sampling or carry the rank-order certification into the stated contract.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6aaf11a (head c62fb5e). The main-text seeded-sampler contract is now scoped to untruncated sampling in all three places: Section 2.1 ("Without top-k or top-p the seeded sampler is already a race"), the sampling row of the assumptions table ("Untruncated seeded noise is a function of (seed, absolute position, token)"), and Section 4's fixed-noise paragraph ("with a seed and no truncation every committed token is the stock seeded sampler's token"). Appendix B, Truncated sampling, gives the rank-keyed truncated path and what seeded equality with it would need. The edit is length-neutral: the main text still ends on p10 with References on p11.
Codex P1 on #130: Section 2.1, the sampling row of the assumptions table and Section 4's fixed-noise paragraph state that stock seeded noise is token-keyed and that certified tokens equal the stock seeded sampler's. At the pin that holds only without top-k or top-p, which key the stock noise by sorted rank (Appendix B, Truncated sampling). Three scope phrases, no other change; the main text still ends on p10 with References on p11.
252e525 to
c62fb5e
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 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". |
Codex P1 on #130: Section 2.1, the sampling row of the assumptions table and Section 4's fixed-noise paragraph state that stock seeded noise is token-keyed and that certified tokens equal the stock seeded sampler's. At the pin that holds only without top-k or top-p, which key the stock noise by sorted rank (Appendix B, Truncated sampling). Three scope phrases, no other change; the main text still ends on p10 with References on p11.
c62fb5e to
77e3203
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77e3203ade
ℹ️ 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".
| "urls": [ | ||
| "https://github.com/sgl-project/sglang/blob/bd66ce343e4f6e2f2b75d7e820fe4d0718a8d824/python/sglang/srt/layers/sampler.py#L746-L800" | ||
| ], | ||
| "accessed": "2026-10-01", |
There was a problem hiding this comment.
Advance the audit date for the new source
This source is recorded as accessed and verified on 2026-10-01, but the manifest's top-level audit_date and the audit declaration in sources/citation_audit.md still say 2026-09-30. Consequently, consumers relying on the declared audit cutoff cannot tell that the newly cited sampler source is covered by the audit; update both audit dates when adding this row.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a987427. The manifest's audit_date is now 2026-10-01, and its scope says that sglangsampler was added on 1 October 2026 after reading the pinned file. sources/citation_audit.md keeps its original 30 September date for the 34 audited entries and its header now names the one later entry checked on 1 October. The paper and its PDF are unaffected.
|
Verdict: APPROVE (provisional, on 77e3203: Codex is still running on this head. I will confirm or withdraw once it finishes.) Review of the exact head 77e3203, rebased on main after #129: 1f816bc (sampling scope), a6f8b2d (trim and G.3), 2962631 (main-text scope) and the PDFs.
Note. P4's third void attempt and its explanation (#123) are not on main yet. When #123 merges, "Two attempts have been void" needs the same update. |
Codex P2 on #130: the manifest's audit_date and the citation audit's declared date still said 30 September while sglangsampler was read and added on 1 October. The manifest's audit_date is now 2026-10-01 and its scope names the addition; the audit's header keeps its original date and names the one later entry.
|
@codex review |
|
Verdict: APPROVE (provisional, on a987427: Codex is still running on this head. I will confirm or withdraw once it finishes.) a987427 changes only |
|
@codex review |
Codex P1 on #130: Section 2.1, the sampling row of the assumptions table and Section 4's fixed-noise paragraph state that stock seeded noise is token-keyed and that certified tokens equal the stock seeded sampler's. At the pin that holds only without top-k or top-p, which key the stock noise by sorted rank (Appendix B, Truncated sampling). Three scope phrases, no other change; the main text still ends on p10 with References on p11.
Codex P2 on #130: the manifest's audit_date and the citation audit's declared date still said 30 September while sglangsampler was read and added on 1 October. The manifest's audit_date is now 2026-10-01 and its scope names the addition; the audit's header keeps its original date and names the one later entry.
a987427 to
2b71cd6
Compare
|
Verdict: APPROVE (provisional, on 2b71cd6: Codex is still running on this head. I will confirm or withdraw once it finishes.) Re-review after the rebase onto main (after #132, #123 and #128).
Everything else stands from my reviews of 77e3203 and a987427. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b71cd6c46
ℹ️ 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".
| \path{srt/models/qwen3_5_text.py} & The Qwen3.5 head is tied to \code{embed\_tokens}, which is not a \code{ParallelLMHead}, so SGLang's quantized-head paths do not apply; a low-precision copy must be separate, and the BF16 head stays resident for re-scoring and fallback.\\ | ||
| \path{srt/models/qwen3_5_mtp.py} & \code{set\_embed\_and\_head} skips the head when embeddings are tied, so a reduced draft head from \code{-{}-speculative-token-map} does not reach the MTP drafter while indices are still remapped (Appendix~\ref{app:levers}).\\ | ||
| \path{srt/layers/sampler.py} & Unseeded sampling is an exponential race; seeded sampling is a Gumbel race keyed by (seed, position, token) in FP64 (\code{multinomial\_with\_seed}). The certified race uses the same field.\\ | ||
| \path{srt/layers/sampler.py} & Unseeded sampling is an exponential race; seeded sampling over the full vocabulary is a Gumbel race keyed by (seed, position, token) in FP64 (\code{multinomial\_with\_seed}), and the certified race uses the same field. The seeded top-$k$, top-$p$ and min-$p$ path keys the same hash by position in the sorted probabilities instead, and refuses min-$p$ with a seed~\cite{sglangsampler}.\\ |
There was a problem hiding this comment.
Exclude min-p from the rank-keyed seeded path
When a request combines a seed with min-p, the pinned sampler asserts before sampling, so there is no seeded min-p path that keys noise by sorted position. Listing min-p alongside seeded top-k and top-p both misstates the engine behavior and contradicts the end of this same sentence; retain the refusal but restrict the rank-keyed-path claim to top-k/top-p.
Useful? React with 👍 / 👎.
| The second question has a better answer. A decoder that keeps a dense anchor and the recent actual FP32 operands of each step, and replays them in the reference kernel's order, reproduces every state word bit for bit by induction, while reading the dense state once per step and writing it once every $m$ steps. That reduces information movement, not information, and it is what replay-based rollback already does~\cite{replayssm,gdncode}. The paragraphs below treat it as a lever with a pre-registered test (P4), and the opposite idea, sharing exact computation across requests (P5). | ||
|
|
||
| \paragraph{Writing the recurrent state less often (P4, hypothesis)} Rounding-preserving live replay is exact and cuts dense-state traffic per step from $2D$ (read and write) to $D+D/m$ when the state is flushed every $m$ steps, 0.625 of the original at $m=4$, for a few percent more storage (derived). If the recurrent kernel is a fraction $f$ of a decode step, a kernel twice as fast gives at most $1/(1-f/2)$, removing it entirely $1/(1-f)$, and the $m=4$ traffic cut alone $1/(1-0.375f)$. The measured share at $B=128$ and a 418-token mean context is $f=0.416$ (Table~\ref{tab:profile-plain}), which gives $1.26\times$, $1.71\times$ and $1.18\times$ (derived from a measured share). The pre-registered test has two parts. A kernel check compares every state word and GDN output of the replayed and dense paths, one layer at a time, and one differing word rejects bit-exactness (below). The served timing decodes 512 tokens greedily at batch 128 from 2,048-token prompts with FP32 state and no speculation, with the threshold at $1.10\times$; through the server only the output probe below checks exactness. The served timing's design, metric and decision rule were declared before its first run~\ev{p4-declared}. Dense decoding and replay at $m=4$ run as four server pairs in the order A B B A A B B A with identical memory pools, and the primary metric, amended before the run started, is the server's decode rate at exactly 128 running requests in the measured phase. The scheduler logs one generation throughput per 40 decode passes; a window counts when it shows 128 running requests, the previous decode line also shows 128, no prefill batch lies between the two (a window containing a prefill pass mixes prefill time into its rate), and both lines fall inside the AIPerf profiling phase (first request start to last request end), which excludes the AIPerf warm-up wave and the ramp and drain. Windows carry equal token counts (128 per pass, no speculation), so the rate is the harmonic mean of the window rates; fewer than 8 such windows in any arm voids the run. The metric measures decode only, which is what the lever changes; client throughput, which includes the 2,048-token prefills, is reported beside it. The four log ratios give a 95\% $t$ interval, and the claim is rejected if its upper end is below $1.10$, supported if its lower end reaches $1.10$, and inconclusive otherwise; a supported result is a served decode throughput at 128 running requests, not an end-to-end speedup. A server output probe compares greedy tokens and top-20 log-probabilities at concurrency 1 with dense decoding: a difference refutes end-to-end exactness, and a pass does not establish it; a second dense server is the noise control, and if it differs too the probe is undecided. The verdict states both results, and if the probe refutes exactness, P4's exact claim is not supported whatever the throughput interval. A run that fails its completeness, workload, pool, environment or provenance checks is void and repeated, and its numbers are not reported. One of those checks was corrected after the first run and before its verdict was computed or looked at: the check of the sent prompts compared the benchmark's request ids, which differ from the declared ones for this workload even when the right texts are sent, and it now compares the prompt texts' hashes exactly, a check no weaker than the declared one; the first run failed the old check in all eight arms and passes the corrected one. That run is void all the same: in every arm at most 127 requests were admitted, so the validator stopped before any ratio was computed and no verdict exists; the cause then judged likely was SGLang's admission budget, which reserves each request's full 512 output tokens. A rerun was declared before it started, with a pinned attention cache of 655,360 tokens in both arms instead of 360,448, a required admission preflight that stops the job unless 128 requests run in the measured phase, the one-layer kernel steps reused from the first run because they cannot depend on a server's pools, and the output probe and the paired timing run again. That second attempt was void at its preflight: both arms again peaked at 127 running requests, with the attention cache at 40\% use, so the cache was not the limit. Likely, from the log, the recurrent-state slots were: the 128th request stayed queued with 127 slots in use and the free slot not schedulable, while prompts were admitted five at a time under chunked prefill. Before any further run, both arms were amended to pin 132 recurrent-state slots, four of headroom, with the other pools unchanged, and the preflight now runs on its own before the full job is queued. No result of either attempt is reported. SGLang's own replay path qualifies only if it passes the bit-exactness check. The replay kernel is committed as an engine patch with a one-layer test that compares every output and state word against the stock decode kernel (\code{tests/test\_gdn\_exact\_replay.py}~\ev{moonshot-patches}). | ||
| \paragraph{Writing the recurrent state less often (P4, hypothesis)} Rounding-preserving live replay is exact and cuts dense-state traffic per step from $2D$ (read and write) to $D+D/m$ when the state is flushed every $m$ steps, 0.625 of the original at $m=4$, for a few percent more storage (derived). If the recurrent kernel is a fraction $f$ of a decode step, a kernel twice as fast gives at most $1/(1-f/2)$, removing it entirely $1/(1-f)$, and the $m=4$ traffic cut alone $1/(1-0.375f)$. The measured share at $B=128$ and a 418-token mean context is $f=0.416$ (Table~\ref{tab:profile-plain}), which gives $1.26\times$, $1.71\times$ and $1.18\times$ (derived from a measured share). The pre-registered test has two parts. A kernel check compares every state word and GDN output of the replayed and dense paths, one layer at a time, and one differing word rejects bit-exactness (below). The served timing decodes 512 tokens greedily at batch 128 from 2,048-token prompts with FP32 state and no speculation, with the threshold at $1.10\times$; through the server only the output probe below checks exactness. The served timing's design, metric and decision rule were declared before its first run, and every later change before the run it governs~\ev{p4-declared}. Dense decoding and replay at $m=4$ run as four server pairs in the order A B B A A B B A with identical memory pools. The primary metric is the server's decode rate at exactly 128 running requests: the harmonic mean of the scheduler's generation-throughput windows (one per 40 decode passes) that show 128 running requests on that line and the previous one, with no prefill batch between them, inside the AIPerf profiling phase, which excludes warm-up, ramp and drain; fewer than 8 such windows in any arm voids the run. It measures decode only, which is what the lever changes, and client throughput, which includes the 2,048-token prefills, is reported beside it. The four log ratios give a 95\% $t$ interval, and the claim is rejected if its upper end is below $1.10$, supported if its lower end reaches $1.10$, and inconclusive otherwise; a supported result is a served decode throughput at 128 running requests, not an end-to-end speedup. A server output probe compares greedy tokens and top-20 log-probabilities at concurrency 1 with dense decoding, with a second dense server as the noise control: a difference refutes end-to-end exactness, a pass does not establish it, and a refuted probe leaves P4's exact claim unsupported whatever the throughput interval. A run that fails its completeness, workload, pool, environment or provenance checks is void and its numbers are not reported. One check was corrected after the first run and before any verdict was computed: the sent prompts are now matched by the hashes of their texts, because the benchmark's request ids differ from the declared ones for this workload, a check no weaker than the declared one. Two attempts have been void, because in every arm at most 127 of the 128 requests were admitted; the amendments declared after each, a pinned attention cache of 655,360 tokens, 132 pinned recurrent-state slots and an admission preflight that must show 128 running requests, are recorded with the declaration. No served result exists. SGLang's own replay path qualifies only if it passes the bit-exactness check. The replay kernel is committed as an engine patch with a one-layer test that compares every output and state word against the stock decode kernel (\code{tests/test\_gdn\_exact\_replay.py}~\ev{moonshot-patches}). |
There was a problem hiding this comment.
Restore the noise-control outcome
When the replay-vs-dense probe differs and the second dense server also differs, the control shows that the probe cannot attribute the difference to replay. The prior decision rule explicitly classified this case as undecided, but the shortened text now says that a difference refutes exactness without specifying how the control changes that verdict, allowing ordinary dense-server noise to reject P4; preserve the undecided outcome for a differing control.
Useful? React with 👍 / 👎.
| # Citation audit of `paper/paper.tex` | ||
|
|
||
| Audit date: 30 September 2026. Scope: all 34 `\bibitem` entries in `paper/paper.tex` | ||
| Audit date: 30 September 2026; one later entry (`sglangsampler`) was added and checked on 1 October 2026. Scope: all 34 `\bibitem` entries in `paper/paper.tex` |
There was a problem hiding this comment.
Update the audit scope to 35 entries
Adding sglangsampler increases the audit table from 34 to 35 source rows, but the scope declaration still claims that all 34 entries are covered. Readers using this declaration to determine audit completeness now receive a stale count; update it alongside the newly added entry.
Useful? React with 👍 / 👎.
…ded case; audit row count Codex on #130 (2b71cd6): - P2: the pinned sampler refuses seeded min-p, so the rank-keyed seeded path is top-k/top-p only (App B and the code-path table). - P2: the trimmed P4 paragraph dropped the declared undecided outcome of the output probe; a difference refutes exactness unless the second dense server also differs, in which case the probe is undecided. - P3: the citation audit covers 35 rows (the 34 original entries plus sglangsampler).
|
@codex review |
|
Verdict: APPROVE (provisional, on 919613d: Codex is still running on this head. I will confirm or withdraw once it finishes.) fe34665 fixes Codex's three comments on 2b71cd6, and each has a reply:
Rebuild in place at 919613d: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 919613de6f
ℹ️ 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".
|
|
||
| \subsection{What the Engine Computes}\label{sec:stock} | ||
| Qwen3.5-4B ties its output head to its input embedding: $W\in\BF^{V\times D}$ with $V=248{,}320$ and $D=2{,}560$, where $\BF$ denotes the BF16 numbers. At the pinned commit SGLang computes the head as \code{torch.matmul} of the BF16 head inputs with $W^\top$, a cuBLAS GEMM that accumulates in FP32, rounds each output to BF16 and chooses its kernel by the batch shape $M$. The logits are widened exactly to FP32, and greedy decoding and greedy verification take \code{torch.argmax}, which returns the smallest maximal index. BF16 keeps eight significant bits, so logits in $[16,32)$ are $0.125$ apart, and two real logits closer than about one spacing can round to the same value, leaving the index to decide. The seeded sampler is already a race: after an FP32 softmax and logarithm it returns $\argmax_i(\log p_i+G_i)$ in FP64, with Gumbel noise $G_i$ computed from a 32-bit hash of (seed, position, token), a \emph{counter-keyed field} that can be recomputed for any token in any order. It exists only with \code{-{}-enable-deterministic-inference}, whose batch-invariant \code{mm} runs, at the pin's defaults on this GPU, DeepGEMM's deterministic BF16 GEMM (one FP32 \code{wgmma} accumulator, no split-$K$, round-to-nearest output); with a seed the stock head is that kernel. Table~\ref{tab:terms} fixes the terms used below. | ||
| Qwen3.5-4B ties its output head to its input embedding: $W\in\BF^{V\times D}$ with $V=248{,}320$ and $D=2{,}560$, where $\BF$ denotes the BF16 numbers. At the pinned commit SGLang computes the head as \code{torch.matmul} of the BF16 head inputs with $W^\top$, a cuBLAS GEMM that accumulates in FP32, rounds each output to BF16 and chooses its kernel by the batch shape $M$. The logits are widened exactly to FP32, and greedy decoding and greedy verification take \code{torch.argmax}, which returns the smallest maximal index. BF16 keeps eight significant bits, so logits in $[16,32)$ are $0.125$ apart, and two real logits closer than about one spacing can round to the same value, leaving the index to decide. Without top-$k$ or top-$p$ the seeded sampler is already a race: after an FP32 softmax and logarithm it returns $\argmax_i(\log p_i+G_i)$ in FP64, with Gumbel noise $G_i$ computed from a 32-bit hash of (seed, position, token), a \emph{counter-keyed field} that can be recomputed for any token in any order. It exists only with \code{-{}-enable-deterministic-inference}, whose batch-invariant \code{mm} runs, at the pin's defaults on this GPU, DeepGEMM's deterministic BF16 GEMM (one FP32 \code{wgmma} accumulator, no split-$K$, round-to-nearest output); with a seed the stock head is that kernel. Table~\ref{tab:terms} fixes the terms used below. |
There was a problem hiding this comment.
Exclude min-p from the seeded-race condition
When a request enables min-p with a seed but leaves top-k and top-p disabled, this condition still claims that the stock sampler runs the token-keyed race, even though the pinned sampler rejects seeded min-p, as the newly added Appendix B text states. Describe this as the fully untruncated path, or explicitly exclude min-p too, so the main engine contract does not promise behavior for a configuration that asserts before sampling.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bf4ae34 (head 652c62e). Section 2.1 now reads "With no top-k, top-p or min-p the seeded sampler is already a race". The assumptions-table row ("Untruncated seeded noise") and Section 4 ("with a seed and no truncation") use the same scope. The main text still ends on p10, with References on p11.
|
@codex review |
…pler At the pin, SGLang's seeded top-k/top-p/min-p path sorts the probabilities and keys each token's Gumbel noise by its position in the sorted row (multinomial_with_seed hashes arange(m) over that row), then maps back through the sort's permutation; min-p with a seed is refused. Membership and the k-th tie are therefore not enough for seeded equality with the stock truncated sampler: it also needs the complete order within the certified set and torch.sort's order on ties. The token-keyed race gives equality in distribution and pathwise equality with a token-keyed dense race, which is what the full-vocabulary seeded path uses. Rewrites App B's truncated-sampling paragraph, splits the consumer table's seeded rows (full vocabulary vs stock top-k/top-p), and scopes the sampler row of the engine code-path table. Cites the pinned sampler.py (new source sglangsampler, added to the paper bib, the full bib, the manifest and the citation audit).
…per pending entry - D.4 opens with the established findings, each with its register entry. - P4 (E.5): the declared served test in one pass; the two void attempts and the amendments declared after them in two sentences, without the causes then judged likely; the post-run prompt-check correction kept as a disclosed deviation. - Smaller cuts of how runs unfolded: the deterministic-mode patch switch, the pre-pinning remark, the ordering candidate, the failed kernel-trace launch, the one-step chain and the sensitivity workload's timing. - G.3: every pending entry on one line with its evidence path; what each result decides stays beside its marker in the text.
Codex P1 on #130: Section 2.1, the sampling row of the assumptions table and Section 4's fixed-noise paragraph state that stock seeded noise is token-keyed and that certified tokens equal the stock seeded sampler's. At the pin that holds only without top-k or top-p, which key the stock noise by sorted rank (Appendix B, Truncated sampling). Three scope phrases, no other change; the main text still ends on p10 with References on p11.
Codex P2 on #130: the manifest's audit_date and the citation audit's declared date still said 30 September while sglangsampler was read and added on 1 October. The manifest's audit_date is now 2026-10-01 and its scope names the addition; the audit's header keeps its original date and names the one later entry.
…ded case; audit row count Codex on #130 (2b71cd6): - P2: the pinned sampler refuses seeded min-p, so the rank-keyed seeded path is top-k/top-p only (App B and the code-path table). - P2: the trimmed P4 paragraph dropped the declared undecided outcome of the output probe; a difference refutes exactness unless the second dense server also differs, in which case the probe is undecided. - P3: the citation audit covers 35 rows (the 34 original entries plus sglangsampler).
|
Verdict: APPROVE (provisional, on 652c62e: Codex is still running on this head. I will confirm or withdraw once it finishes.) bf4ae34 fixes the Codex P2 on 919613d, and the thread has a reply. Section 2.1 now reads "With no top-k, top-p or min-p the seeded sampler is already a race", which matches the pinned sampler (seeded min-p is refused at Rebuild in place: |
652c62e to
31810b8
Compare
|
@codex review |
|
Verdict: APPROVE (provisional, on 31810b8: Codex is still running on this head. I will confirm or withdraw once it finishes.) Rebased onto main 6135d9d (#139), with only |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
Based on main after #129 merged (2f1b274). Two appendix fixes from an outside read of the paper, both checked by the integrator, plus a length-neutral main-text scope for Codex's P1 (
2962631). The rebase onto main resolved one conflict, in the pending list: #129'sbackbone-servedentry is kept, shortened to one line like the others.1. Seeded truncated sampling (App B, App D tables)
At the pin
bd66ce34,top_k_top_p_min_p_sampling_from_probs_torch(python/sglang/srt/layers/sampler.py, lines 746-800) does three things in order:multinomial_with_seedon the sorted row. That function hashes each column by its index in that row (col_indices = torch.arange(m), lines 899-902).probs_idx.So a token's Gumbel noise depends on its rank, not its id. The function also refuses min-p with a seed (assert, line 776). The full-vocabulary seeded path (
_sample_from_logprobs, lines 594-611, and the untruncated seeded path) keys by token index.The old text said top-k needs only membership plus the tie semantics at the k-th position. That is too weak for seeded equality with the stock sampler. Changes:
app:truncated).torch.sort's order on equal probabilities.sglangsampler: a permalink to the pinned file, lines 746-800. It is added topaper/references.bib,sources/references_full.bib,sources/source_manifest.json(count 224) and asources/citation_audit.mdrow recording the lines read.The main text is not changed. Flagged to main for the author:
contract.tex:83says seeded noise is keyed by (seed, absolute position, token), which holds only without top-k/top-p.2. Less run chronology; findings first; a short pending list
No result or pending marker is removed, and D numbering is unchanged. The only numbers dropped are details of the void P4 attempts: the first run's 360,448-token pool and the second's 40% cache use.
Checks
latexmk -pdf: 0 warnings, 79 pages (81 on main), main text ends on p10, References on p11.scripts/check_paper_references.py: clean, including the new bib entry against the full bib and the manifest.