Skip to content

Backbone: routing table against tuned MTP, and which GEMM kernels the served engine runs - #166

Merged
SamMausberg merged 6 commits into
mainfrom
backbone/mtp-insitu
Oct 1, 2026
Merged

SamMausberg merged 6 commits into
mainfrom
backbone/mtp-insitu

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

This adds hold 3's two results to evidence/backbone/ ("Paired serving: lever v1 against MTP with FlashInfer attention" and "Which GEMM kernels the served engine runs"): paired serving of the routing table (lever v1) against MTP with FlashInfer attention (mtp-tuned), and an nsys trace of plain decoding. The trace accounts for part of the gap #153 left open: at c = 8, plain decoding gained 0.4%, against about 90-98 µs of isolated savings predicted. No code changes. The analysis script, experiments/backbone/insitu_gemm.py, merged with #153 and ran at main 43dd775.

Lever v1 against MTP with FlashInfer attention (mtp-tuned)

One exclusive session, order B A A B. Both arms run the backbone engine and A has every switch off. The arm is mtp-tuned, measured at c = 1, 8, 32 and 128. bench/arms.toml tunes mtp-tuned for high concurrency; at c = 1-32 bench serves MTP faster with mtp-tuned-triton (532 against 456 tok/s at c = 1). The routing table is untested against that arm. Foreign CPU averaged 0.19-0.36 cores, and no point is invalid.

c B/A, the two pairs A1-A2 spread Tokens per verify cycle, A and B
1 0.993, 0.989 0.85% 3.279, 3.273
8 1.005, 1.000 1.30% 3.272, 3.270
32 1.012, 0.999 2.37% 3.260, 3.261
128 0.996, 0.984 0.81% about equal
  • No gain at any c on mtp-tuned.
  • At c = 1 the table is 0.9% slower in both pairs. One pair exceeds the spread. About 0.2% of the loss is fewer accepted tokens per cycle; the rest is not traced.
  • At c = 8 and 32 the pairs straddle 1. A itself moved by 1.3-2.4% within the session; bench's confirmation sessions of the same arm differ by 2.2% at c = 32.
  • At c = 128 there is no claim: both pairs are below 1, but only one exceeds the spread.
  • Lever v1's exactness class under MTP was not measured, so the frontier file marks it pending.

In-situ trace (plain decoding, c = 1 and 16, A then B)

insitu_gemm.py labels every complete decode-graph replay of a 2-second window with node-level graph tracing.

  • Routes: every route dispatches as tabled.
    • M = 1: 152 Hopper GEMV calls replace A's 216 cuBLAS kernels.
    • M = 16: 120 Triton calls cover in_proj_qkvz, out_proj, o_proj, gate_up and down; qkv_proj and in_proj_ba stay on cuBLAS.
  • GPU time per step (replay span):
    • M = 1: -102 µs, against 197 µs predicted from the isolated microbenchmarks (52%).
    • M = 16: -45 µs, against 120 µs predicted (37%).
  • Unprofiled step, one 5-second window per point:
  • Per-kernel sums: they are not additive under PDL, because an early-launched norm or SiLU kernel waits inside itself. In B at M = 16 these sums are 784 µs and 970 µs longer, so only spans compare steps.

Also

  • README.md, evidence/README.md and engine/sglang/README.md are updated.
  • Exact commands are in the README.
  • TASKS.md: the backbone rows (H6, the workstream table and the task list) record PR Backbone: served exactness of each switch and paired plain serving of the routing table #153 and this PR, and name the one item not run.
  • The nsys reports stay in ~/vp-data/backbone/nsys/. The unprofiled windows' records are committed as served/nsys_windows_plain_{A,B}.jsonl.

Not covered

  • Lever v1's exactness under MTP.
  • Paired serving against mtp-tuned-triton at c = 1-32. It is queued as hold 4 (exclusive, normal lane), and its result will come in a later PR.
  • Where the c = 16 step loses two thirds of its GPU saving.
  • Why mtp-tuned at c = 1 is slower.

Except for hold 4, none of these is queued.

Review rounds

  • Codex on 459bf2d. r4161209128 and r4161209135 (P2): the README's commands block showed only the first B sweep and only the A profiling run. Fixed in c022937, which gives all four sweeps of each paired hold with their labels and sessions, and the B profiling run with the lever variables in its environment. Hold 2's block in the same README had the same gap and is fixed too.
  • Reviewer nits on 81dd77e. The c = 128 spread is now 0.81% on the mean basis. The README and engine summaries now say that only one of the two c = 1 MTP pairs is beyond the spread.
  • Codex on c022937. r4161235048 (P1): the MTP result was stated for "tuned MTP", but hold 3 ran mtp-tuned (FlashInfer), which bench tunes for high concurrency, not mtp-tuned-triton. Fixed by scoping in 471ffa1, with no rerun in this PR. Every statement in the evidence README, README.md, evidence/README.md, engine/sglang/README.md, TASKS.md and this body now names the arm, MTP with FlashInfer attention (mtp-tuned), and says the routing table is untested against mtp-tuned-triton at c = 1-32. The B-A-A-B on mtp-tuned-triton at c = 1, 8 and 32 is queued as hold 4 (exclusive ticket 5-1790894464300992200, linted).

…ed engine runs

Hold 3, one exclusive session. On tuned MTP the routing table gains nothing:
B/A per pair 0.993 and 0.989 at c = 1 (0.2% of that is fewer tokens per
verify cycle, 3.273 against 3.279), and the c = 8-128 pairs straddle 1 within
the session's 0.8-2.4% spread.

An nsys trace of plain decoding (node-level graph trace, c = 1 and 16) read by
insitu_gemm.py shows every route dispatching as tabled (152 GEMV calls at
M = 1, 120 Triton calls at M = 16), and the decode-graph span shrinking by
102 us at M = 1 and 45 us at M = 16 against isolated predictions of 197 and
120 us. Unprofiled windows of the same servers shorten the step by 111 and
15 us. This accounts for part of the c = 8 shortfall reported in #153.
@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-01T22:44:26.793158Z 9c3e6c2 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.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 81dd77e: Codex has not reviewed this head yet. I will confirm once it does.)

MTP serving (served/mtp_v1/)

  • Points. Every A and B rate, pair ratio and tokens-per-cycle value matches points.csv and pairs.csv:
    • the pairs are 0.9932 / 0.9894 at c = 1, 1.0048 / 0.9995 at 8, 1.0123 / 0.9988 at 32 and 0.9963 / 0.9842 at 128;
    • tokens per cycle are 3.2794 against 3.2729 at c = 1 in both sessions, the 0.2%;
    • foreign CPU means are 0.19-0.36 cores, the largest single sample is 1.17, and no point is invalid.
  • Spreads. The A1-A2 spreads are the mean-based 0.85 / 1.30 / 2.37%. Nit: on the same basis c = 128 is 0.81% (0.82% is relative to the lower run).
  • Bench comparison. bench's mtp-tuned confirmation sessions at c = 32 span 2.22% (evidence/bench/confirm/points.csv).
  • The reading follows the data. There is no gain at any c, c = 1 is slower in both pairs with one beyond the spread, and there is no claim at c = 128.

In-situ trace (served/insitu_gemm.json, nsys_windows_plain_*.jsonl)

  • Routes. At M = 1, 152 GEMV calls (in_proj 48, out_proj 24, qkv 8, o_proj 8, gate_up 32, down 32) replace 216 cuBLAS kernels including the split-K reductions. At M = 16 there are 120 Triton calls, with qkv_proj and the 24 in_proj_ba GEMMs on cuBLAS.
  • Spans. 3,474.9 to 3,373.0 us (-102) at M = 1 and 4,313.3 to 4,268.6 us (-45) at M = 16, over 573-589 and 463-466 complete replays.
  • Predictions. Recomputed from gemm_microbench.json's summary (cuBLAS minus the routed arm's best configuration, times calls per step, in_proj_ba excluded), they are 197.0 us at M = 1 and 119.7 us at M = 16, so 52% and 37%. The c = 8 analogue is 98.3 us, matching Backbone: served exactness of each switch and paired plain serving of the routing table #153's 98.
  • PDL. B16's norm and SiLU sums are +783.7 and +969.6 us while its span is shorter, which is why only spans compare.
  • Unprofiled 5 s windows. 3.4536 to 3.3424 ms (-111 us) and 4.3108 to 4.2960 ms (-15 us). The README says the span and the step come from different single windows.

Checks. The README, engine README, evidence index and TASKS rows match. Pre-commit from main is clean, and there is no hostname or AI attribution.

Optional. README.md's summary says "On tuned MTP the table gains nothing (0.9% slower at concurrency 1)". The evidence README's qualifier, that one of the two pairs is beyond the 0.85% spread, would keep the summary from reading as a firm loss.

@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: 459bf2d72e

ℹ️ 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/backbone/README.md Outdated
Comment on lines +431 to +434
python -m bench.sweep --arm mtp-tuned --label backbone-mtp-v1-B --session abba-1 \
--sglang-worktree ~/sglang-wt/backbone --env SGLANG_BACKBONE_GEMM=1 --env SGLANG_BACKBONE_PDL=1 \
--env SGLANG_BACKBONE_MERGE_IN_PROJ=1 --env SGLANG_BACKBONE_GEMM_TABLE=<table> \
--concurrency 1 8 32 128 --repeats 1 --port 30471 --out ~/vp-data/backbone/e2e/mtp-v1

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 all four paired sweep invocations

This block launches only backbone-mtp-v1-B for session abba-1, while the following bench.pareto command consumes B/A/A/B directories spanning both abba-1 and abba-2. Merely removing the environment switches, as the comment suggests, would retain the B label and first session, so the three remaining runs behind the committed points, launches, and pairs cannot be regenerated; include their exact labels, sessions, and invocations.

AGENTS.md reference: AGENTS.md:L15-L18

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 c022937. The commands block now gives all four sweeps of each paired hold as a loop with their labels and sessions (B1/A1 abba-1, A2/B2 abba-2), and the B profiling run with SGLANG_BACKBONE_GEMM, _PDL, _MERGE_IN_PROJ and _GEMM_TABLE in run_profiles.py's environment, writing to plain-B. Hold 2's sweep block had the same gap and is fixed the same way.

Comment thread evidence/backbone/README.md Outdated
Comment on lines +441 to +443
python experiments/profiling/run_profiles.py --arm plain --mode nsys --concurrency 1 16 \
--out-dir ~/vp-data/backbone/nsys/plain-A --port 30472 \
--extra-server-args "--disable-radix-cache --max-mamba-cache-size 128 --max-running-requests 128 --stream-interval 4"

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 missing B profiling command

Following this block produces only the A reports under plain-A, but the analysis immediately consumes plain-B/plain_bs{1,16}.nsys-rep and the commit includes nsys_windows_plain_B.jsonl. The preceding comment does not provide an executable B invocation, its output directory, or how the four lever variables are applied, so half of the in-situ evidence cannot be reproduced from the documented commands; add the exact B command.

AGENTS.md reference: AGENTS.md:L15-L18

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 c022937. The commands block now gives all four sweeps of each paired hold as a loop with their labels and sessions (B1/A1 abba-1, A2/B2 abba-2), and the B profiling run with SGLANG_BACKBONE_GEMM, _PDL, _MERGE_IN_PROJ and _GEMM_TABLE in run_profiles.py's environment, writing to plain-B. Hold 2's sweep block had the same gap and is fixed the same way.

Codex on 459bf2d: the commands block showed only the first B sweep and only
the A profiling run. It now gives all four sweeps of each paired hold, with
their labels and sessions, and the B profiling run with the lever variables
in its environment. Reviewer nits: the c = 128 MTP spread is 0.81% on the
mean basis of the other rows, and the summaries say that only one of the two
c = 1 MTP pairs is beyond the session's spread.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on c022937: Codex has not reviewed this head yet. I will confirm once it does.)

c022937 changes only text and resolves both Codex P2s and my two nits.

  • Commands. Each paired hold's README block is now a loop over B A A B with the lever variables applied to B only. The MTP loop assigns sessions abba-1 to runs 1-2 and abba-2 to runs 3-4, which matches points.csv (B1 and A1 abba-1, A2 and B2 abba-2). The plain hold's block says bench.pareto assigns its sessions by run directory. The in-situ block runs A, then B with the four variables in run_profiles.py's environment, into plain-A and plain-B.
  • Wording. The c = 128 spread now reads 0.81%, the mean basis like the other rows. The README.md and engine/sglang/README.md summaries say the c = 1 MTP loss shows in both pairs with only one beyond the spread.
  • Checks. No evidence file changed, and pre-commit from main is clean. My checks of 81dd77e stand.

@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: c0229372de

ℹ️ 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/backbone/README.md Outdated
Comment on lines +304 to +305
The same design in one exclusive hold (2026-10-01, 22:05-22:23 UTC): arm `mtp-tuned` (native MTP,
three-step chain, buffered GDN verify, radix cache off, 128 GDN slots), both arms on the backbone

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Test against the actually tuned low-concurrency MTP arm

For c = 1, 8, and 32 this uses mtp-tuned, although bench/arms.toml explicitly defines that arm as high-concurrency and mtp-tuned-triton as the low-concurrency tuned arm. The confirmation evidence shows the latter is substantially faster at these points (for example, 532 vs. 456 tok/s at c = 1 and 3,009 vs. 2,682 at c = 8). Because the routing kernels can interact with the different attention backend through GPU scheduling, these runs do not establish the repeated repository-wide claim that the routing table gains nothing against tuned MTP at those concurrencies; rerun the pairs with mtp-tuned-triton or narrow the conclusion to the FlashInfer/high-concurrency configuration.

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 claim was wider than the run. Fixed by scoping in 471ffa1, with no rerun in this PR. Every statement of the result (evidence/backbone/README.md, README.md, evidence/README.md, engine/sglang/README.md, TASKS.md and the PR body) now names the arm, MTP with FlashInfer attention (mtp-tuned), and says the routing table is untested against mtp-tuned-triton at c = 1-32. The same B-A-A-B on mtp-tuned-triton at c = 1, 8 and 32 is queued as an exclusive hold, and its result will come in a later PR.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (c022937; withdraws my provisional approval. Codex r4161235048 (P1) is valid.)

bench/arms.toml defines mtp-tuned as "tuned for high concurrency" with FlashInfer attention, and mtp-tuned-triton as the low-concurrency tuned arm with Triton attention. The pairs ran mtp-tuned only, so "against tuned MTP it gains nothing" (evidence README, README.md, engine/sglang/README.md) claims more than was tested at c = 1, 8 and 32, where bench's tuned arm is the Triton one.

Narrow every such sentence to the arm measured, for example: "against bench's high-concurrency MTP arm (mtp-tuned, FlashInfer attention): no gain at c = 1-128 ...". Add that the low-concurrency tuned arm (mtp-tuned-triton) was not tested, and list it under the README's "not covered". Rerunning on mtp-tuned-triton would also resolve this, but is not required for this PR.

Codex P1 on c022937: bench/arms.toml tunes mtp-tuned for high concurrency and
mtp-tuned-triton for c = 1-32, where it serves MTP faster (532 against 456
tokens/s at c = 1). Hold 3 ran mtp-tuned only, so every statement of its
result now names the arm, MTP with FlashInfer attention (mtp-tuned), and says
the routing table is untested against mtp-tuned-triton at c = 1-32. That
pairing is queued as hold 4.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 471ffa1: Codex has not reviewed this head yet. I will confirm once it does.)

471ffa1 resolves Codex r4161235048 (P1). Every MTP sentence is now scoped to the arm measured: mtp-tuned, FlashInfer attention, which bench/arms.toml tunes for high concurrency. This covers the evidence README's heading, table preamble, bullets and summary, README.md, engine/sglang/README.md, the evidence index and TASKS.md. Each says that bench's low-concurrency arm, mtp-tuned-triton, is untested at c = 1-32. The contrast quoted, 532 against 456 tokens/s at c = 1, matches bench's confirmation (532.0-532.8 against 456.0). The README gives the reason these runs say nothing about the Triton arm, and lists its paired serving as not covered.

Pre-commit from main is clean, and the commit has no AI attribution. My number checks of 81dd77e and c022937 stand.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 9c3e6c2: Codex has not reviewed this head yet. I will confirm once it does.)

9c3e6c2 changes one line of the README pending list, naming mtp-tuned there too. My review of 471ffa1 stands.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 9c3e6c219f

ℹ️ 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".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on 9c3e6c2)

This confirms my provisional approval. Codex found no issues on this head (22:44 UTC).

@SamMausberg
SamMausberg merged commit 9b5fda2 into main Oct 1, 2026
SamMausberg added a commit that referenced this pull request Oct 1, 2026
…backbone routing against MTP and the in-situ GEMM trace (#166)

P2 Test 2 now gives the engine's exact recycle and keep sweeps at B = 16 and 32 and P2's
rejection; a new P12 subsection reports the static screen on the head compiled through the
last FFN. The backbone paragraph adds the Nsight trace of the served decode step and the
session against mtp-tuned, and narrows backbone-served to mtp-tuned-triton and exactness
under MTP. Register entries repair-jacobi and repair-p12 added; status rows P2, P12 and H6.
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