Repository navigation
Appendix E: backbone switches served, exact up to rounding; 3.4% at c = 1 on tuned plain decoding (#153) - #157
Conversation
… = 1 on tuned plain decoding (#153) From evidence/backbone/README.md "Served results" and served/ (#153): - Exactness on the 320 divergence prompts: every switch off and the packed GDN input projection give identical tokens and top-5 logprob arrays at c = 1 (packed projection: prefill only); the Hopper GEMV backend 3.75/1K against the 3.42 floor at cap 16; the routing table, pools pinned at cap 8, 3.40 and 3.82/1K against 0.63 at cap 8; all rounding-level. - Paired serving on tuned plain decoding, one session B A A B: 1.035/1.034 at c = 1 (step -116 us against the 197 us bound), 1.004 at 8 (-10 us against 90-98 predicted, untraced), no claim at 32, 1.010 at 128 (-86 us against 81 predicted for the packed projection). - Folding variants (single-pass norm, SiLU-only) also lose from M = 2 to 16. Levers table class becomes exact up to rounding; H6 row cites the served result; backbone-served narrows to serving against tuned MTP and a trace of the served engine's GEMM kernels; the backbone evitem gains served/, the fold variants, the hold-2 GPU tests and their scripts.
|
@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. |
|
Verdict: REQUEST CHANGES (af624a7; 2 blocking, both one-word fixes. The build of this head is queued in the CPU window, because a timed exclusive hold is running.) Blocking
Checked against
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af624a73ca
ℹ️ 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".
| Concurrency and state & One state slot per request (lifts the 133-request cap) & exact & \pend{bench-capacity}\\ | ||
| & FP16 state; replayed decoding; rounding-preserving replay (P4) & lossy, exact up to rounding, exact & FP16: $1.24\times$ at $c=128$ (single run, quality pending); replayed decoding: $1.08\times$ at $c=128$ on the confirmation split in one session~\ev{bench-frontier}, outputs rounding-level~\ev{bench-equality}, more sessions \pend{bench-replayssm}; P4: kernel $1.22\times$ at $B=128$, derived about $1.08\times$ per decode step~\ev{p4-replay}; served test \pend{moonshot-p4}\\ | ||
| Backbone GEMMs and norms & Kernel routing per projection and $M$ (Hopper GEMV, Triton with programmatic dependent launch, cuBLASLt); packed GDN input projection; norm and SiLU folded into the GEMM & pending & Isolated microbenchmarks, best kernel per call up to $M=16$: 0.77--0.92 of cuBLAS's time on the output projections, 0.91--1.00 on the other large ones; packed projection bitwise equal per GEMM; folding 12--90~\textmu s per layer slower up to $M=32$, more above~\ev{backbone}; served \pend{backbone-served}\\ | ||
| Backbone GEMMs and norms & Kernel routing per projection and $M$ (Hopper GEMV, Triton with programmatic dependent launch, cuBLASLt); packed GDN input projection; norm and SiLU folded into the GEMM & exact up to rounding (packed projection alone: identical outputs at $c=1$) & Isolated microbenchmarks, best kernel per call up to $M=16$: 0.77--0.92 of cuBLAS's time on the output projections, 0.91--1.00 on the other large ones; no folding variant pays; served on tuned plain decoding, one session: 3.4\% faster at $c=1$, 0.4\% at 8, 1.0\% at 128~\ev{backbone}; against tuned MTP \pend{backbone-served}\\ |
There was a problem hiding this comment.
Keep unserved backbone variants pending
This class applies to every lever named in the row, but the committed exactness pairs only exercise merge, GEMV, and lever_v1; that routing table uses GEMV, Triton, and merge, not cuBLASLt or either SGLANG_BACKBONE_FUSE_* path. In particular, the evidence README says the scaled norm prologue changes operand rounding, so its served exactness cannot be inferred from the tested routing table. Readers could therefore admit the untested cuBLASLt and norm/SiLU-folding variants into the exact stack; split this row or retain pending for variants absent from the exactness runs.
Useful? React with 👍 / 👎.
… = 2 Reviewer on #157: the c = 32 pair gains (0.27% and 0.13%) are about, not within, the 0.11% spread of the A runs; the stock and Triton layers' range from M = 2 to 16 starts at 31.88 us.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af624a73ca
ℹ️ 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".
| Concurrency and state & One state slot per request (lifts the 133-request cap) & exact & \pend{bench-capacity}\\ | ||
| & FP16 state; replayed decoding; rounding-preserving replay (P4) & lossy, exact up to rounding, exact & FP16: $1.24\times$ at $c=128$ (single run, quality pending); replayed decoding: $1.08\times$ at $c=128$ on the confirmation split in one session~\ev{bench-frontier}, outputs rounding-level~\ev{bench-equality}, more sessions \pend{bench-replayssm}; P4: kernel $1.22\times$ at $B=128$, derived about $1.08\times$ per decode step~\ev{p4-replay}; served test \pend{moonshot-p4}\\ | ||
| Backbone GEMMs and norms & Kernel routing per projection and $M$ (Hopper GEMV, Triton with programmatic dependent launch, cuBLASLt); packed GDN input projection; norm and SiLU folded into the GEMM & pending & Isolated microbenchmarks, best kernel per call up to $M=16$: 0.77--0.92 of cuBLAS's time on the output projections, 0.91--1.00 on the other large ones; packed projection bitwise equal per GEMM; folding 12--90~\textmu s per layer slower up to $M=32$, more above~\ev{backbone}; served \pend{backbone-served}\\ | ||
| Backbone GEMMs and norms & Kernel routing per projection and $M$ (Hopper GEMV, Triton with programmatic dependent launch, cuBLASLt); packed GDN input projection; norm and SiLU folded into the GEMM & exact up to rounding (packed projection alone: identical outputs at $c=1$) & Isolated microbenchmarks, best kernel per call up to $M=16$: 0.77--0.92 of cuBLAS's time on the output projections, 0.91--1.00 on the other large ones; no folding variant pays; served on tuned plain decoding, one session: 3.4\% faster at $c=1$, 0.4\% at 8, 1.0\% at 128~\ev{backbone}; against tuned MTP \pend{backbone-served}\\ |
There was a problem hiding this comment.
Exclude untested folds from the exactness class
This class applies to the whole row, including the norm and SiLU folds, but the exactness matrix in evidence/backbone/README.md only exercises off, merge, gemv, and lever v1; lever v1 enables routing/PDL/merge, not SGLANG_BACKBONE_FUSE_NORM or SGLANG_BACKBONE_FUSE_ACT. The scaled norm evidence even notes that it rounds differently from stock, so there is no served-output comparison supporting “exact up to rounding” for these switches. Narrow the class to routing/merge or leave the folding switches pending.
Useful? React with 👍 / 👎.
| \paragraph{Backbone GEMMs and RMSNorm} The weight GEMMs' time above the head GEMM's bandwidth and the 65 RMSNorm launches are the fourth and seventh rows of Table~\ref{tab:profile-ranked}. Isolated microbenchmarks under CUDA graphs locate the slow GEMMs and test faster kernels that read the same BF16 weights~\ev{backbone}. Each timed call multiplies every layer's own checkpoint weight by its own input, so the weights stream from HBM as in the model; times are medians of 30 timings of 10 graph replays each, in one exclusive session, include any split-$K$ reduction and the gap to the next kernel, and are compared only within these files. The three projections with 2,560 outputs, the GDN and attention output projections and the MLP down-projection, run as split-$K$ kernels followed by a reduction kernel up to $M=32$ (128 for the down-projection) and reach 49\% (output projections) and 68\% (down-projection) of the measured 3.79~TB/s read bandwidth~\ev{profile-bw} at $M=1$, against 80--87\% for the large projections; disabling cuBLAS's reduced-precision reduction changes neither their time nor any output bit. At $M=1$ SGLang's own Hopper GEMV is the fastest kernel for every projection: it takes 0.77 of cuBLAS's time on the output projections (8.57 against 11.20~\textmu s per call for the GDN one), 0.91 on the down-projection, 0.95--0.97 on the other large projections and 0.51 on the 64-row GDN projection, which cuBLAS runs on a single block. At the pin it is unreachable: \code{-{}-bf16-gemm-backend gemv} loads it, but the unquantized linear layers call the dispatcher only for another backend (code reading; patch \path{engine/sglang/patches/backbone/0001} lets them reach it). At $M=2$--16 a Triton skinny GEMM pays only with programmatic dependent launch, at 0.88--0.92 of cuBLAS's time on the output projections and 0.96--0.99 on the GDN input and MLP projections, with no gain on the attention QKV projection; in this benchmark each call overlaps its successor, which in the model is a different kernel. From $M=64$ cuBLAS, or a cuBLASLt algorithm within 2--5\% of it, is best, except on the down-projection, where PyTorch's cuBLASLt choice takes 0.92 of the time. None of these routes leaves the target's arithmetic unchanged in general: the GEMV and the Triton kernel are bitwise equal to cuBLAS on 99.6 to 100\% of output elements, and the cuBLASLt choice differs from it on the down-projection from $M=16$, while all arms lie within the same distance of a float64 product. If every projection ran at its best isolated time, a plain step's backbone GEMMs would take 197~\textmu s less at $M=1$, at most 5.7\% of the 3,460~\textmu s step, and 92 to 120~\textmu s less at $M=2$--16 (derived from the microbenchmarks, not a served result). | ||
|
|
||
| SGLang's packed GDN input projection, one GEMM over the concatenated $12{,}352\times2{,}560$ weight instead of a $12{,}288$-row and a 64-row GEMM, gives every output element bitwise equal to the separate pair's at each tested $M$, the powers of two from 1 to 1,024, with the real weights of all 24 GDN layers and random BF16 inputs, under cuBLAS 13.1 on this GPU~\ev{backbone}. That is a statement about one isolated GEMM, not about served tokens. Against the stock pair, which runs the 64-row GEMM on a side stream, it is as fast up to $M=16$, 3\% slower at 32 and 5 to 13\% faster from 64. The stock fused add-RMSNorm takes 1.47~\textmu s per launch at $M=1$ and 2.0 to 2.2~\textmu s at $M=4$--32 inside a graph of 64 norms. Folding the norm and the SiLU into the next GEMM's prologue reproduces the stock norm bit for bit up to $M=32$ (one element in $10^5$ is one BF16 step away at $M=64$ and 128) and the stock SiLU bit for bit, but as built it makes each layer slower in MLP and GDN layer skeletons, by 12 to 90~\textmu s up to $M=32$, with or without programmatic dependent launch, and by 82 to 543~\textmu s at $M=64$ and 128, far more than the two launches of about 1.5 to 2~\textmu s that it removes. In the same skeletons the Triton kernel with programmatic dependent launch saves 1.2 to 2.3~\textmu s per MLP layer and 1.4 to 1.8~\textmu s per GDN layer up to $M=16$, except the GDN layer at $M=4$, and loses at 32. The engine patches that route each projection by a table are committed and off by default; the exactness class of each switch, from greedy outputs against stock plain decoding compared with the noise floor, and paired serving runs against the tuned arms are \pend{backbone-served}. | ||
| SGLang's packed GDN input projection, one GEMM over the concatenated $12{,}352\times2{,}560$ weight instead of a $12{,}288$-row and a 64-row GEMM, gives every output element bitwise equal to the separate pair's at each tested $M$, the powers of two from 1 to 1,024, with the real weights of all 24 GDN layers and random BF16 inputs, under cuBLAS 13.1 on this GPU~\ev{backbone}. That is a statement about one isolated GEMM, not about served tokens. Against the stock pair, which runs the 64-row GEMM on a side stream, it is as fast up to $M=16$, 3\% slower at 32 and 5 to 13\% faster from 64. The stock fused add-RMSNorm takes 1.47~\textmu s per launch at $M=1$ and 2.0 to 2.2~\textmu s at $M=4$--32 inside a graph of 64 norms. Folding the norm and the SiLU into the next GEMM's prologue reproduces the stock norm bit for bit up to $M=32$ (one element in $10^5$ is one BF16 step away at $M=64$ and 128) and the stock SiLU bit for bit, but as built it makes each layer slower in MLP and GDN layer skeletons, by 12 to 90~\textmu s up to $M=32$, with or without programmatic dependent launch, and by 82 to 543~\textmu s at $M=64$ and 128, far more than the two launches of about 1.5 to 2~\textmu s that it removes. Two further variants, a single-pass norm prologue that scales the product and the SiLU fold alone, also lose: from $M=2$ to 16 they take 103 to 257~\textmu s per layer against 31 to 52~\textmu s for the stock and Triton layers, and at $M=1$ only the SiLU fold ties. In the same skeletons the Triton kernel with programmatic dependent launch saves 1.2 to 2.3~\textmu s per MLP layer and 1.4 to 1.8~\textmu s per GDN layer up to $M=16$, except the GDN layer at $M=4$, and loses at 32. The engine patches that route each projection by a table are committed and off by default. Served, each switch was compared with stock plain decoding on the 320 divergence prompts (256 greedy tokens, top-five log-probabilities, prefix cache on)~\ev{backbone}. With every switch off, and with the packed GDN input projection alone, all 320 prompts return the same output tokens and the same top-five log-probability arrays as stock at concurrency 1; for the packed projection that covers prefill only, since decode at concurrency 1 stays below its 64-row cutoff. SGLang's Hopper GEMV backend diverges at 3.75 per 1,000 compared tokens (164 ties, 8 one-step and 2 near events, none large), against the 3.42 floor at a cap of 16, and the routing table (the Hopper GEMV at $M=1$, the Triton kernel with programmatic dependent launch at $M=2$--16, the packed projection from 64 rows), with pools pinned at a cap of 8, diverges at 3.40 at concurrency 1 and 3.82 at 32, five to six times the 0.63 floor at that cap. Both are exact up to rounding, and no run committed a token that was not its own top-1. In one session of paired serving on tuned plain decoding (order B A A B, the routing table against the same engine with every switch off), the routing table delivered 1.035 and 1.034 times the throughput at concurrency 1, a decode step 116~\textmu s shorter against the 197~\textmu s the microbenchmarks bound; 1.004 in both pairs at concurrency 8, where the decode step is 10~\textmu s shorter against 90 to 98~\textmu s predicted, for a reason not yet traced; 1.003 and 1.001 at 32, within the 0.11\% spread of the two baseline runs, so no claim; and 1.010 in both pairs at 128, where only the packed projection acts and the step is 86~\textmu s shorter against 81 predicted. These are two pairs from one session; serving against tuned MTP and a trace of the GEMM kernels the served engine runs are \pend{backbone-served}. |
There was a problem hiding this comment.
Avoid calling the c=32 gain within the baseline spread
At concurrency 32, the committed paired results report B/A ratios of 1.0027 and 1.0013 while the two baseline runs differ by 0.11%; the first observed gain is therefore 0.27%, not within that spread. The decision to make no claim may still be conservative, but this stated justification contradicts served/plain_v1/pairs.csv and should instead describe the ratios as merely comparable to the spread or provide another reason.
Useful? React with 👍 / 👎.
|
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". |
|
Verdict: APPROVE (cdc731f) The fix is right: c = 32 now reads "about" the 0.11% spread, and the M = 2 to 16 range starts at 32 µs. My build of cdc731f with |
Folds #153 (
evidence/backbone/README.md, section "Served results", andevidence/backbone/served/) into Appendix E. This resolves most ofbackbone-served. Source-only. The items come from the backbone agent; I checked each against the merged README and recomputed the throughput ratios fromserved/plain_v1/points.csv.Appendix E, "Backbone GEMMs and RMSNorm"
Exactness. Each switch was compared with stock plain decoding on the 320 divergence prompts (256 greedy tokens, top-5 logprobs, prefix cache on).
bitwise_runs.py. For the packed projection this covers prefill only, because decode at c = 1 stays below its 64-row cutoff.Paired serving on tuned plain decoding. One session, order B A A B, routing table against the same engine with every switch off.
These are two pairs from one session, and the text says so.
Folding. Two further variants, the single-pass norm prologue and the SiLU fold alone, take 103-257 µs per layer from M = 2 to 16, against 31-52 µs for the stock and Triton layers. At M = 1 only the SiLU fold ties. The same sentence is added under "What did not work".
Levers table, H6 row and register
backbone-servedis narrowed to the two things still pending: paired serving against tuned MTP, and a trace of the GEMM kernels the served engine runs.backboneevitem. Its files gainchain_fold_variants_microbench.json,gpu_tests_hold2.logandserved/. Its producers gainbitwise_runs.py,experiments/state_safety/compare.pyandbench/pareto.py.Checks
scripts/check_paper_references.pyis clean.