Repository navigation
Moonshot Phase 1: serving ceilings, composable levers and first measurements - #27
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. |
Levers are composable flag/env overrides on the bench arms (levers.py), run through bench.sweep (lever_sweep.py), bench.quality (gsm8k_arms.py), a logit-level quality probe (logit_probe.py, quality_arms.py) and a static-batch decode ceiling sweep (decode_ceiling_sweep.py). ceilings.py derives per-stack roofline floors from the config and the measured HBM peak. Engine patches (engine/moonshot): untie a reduced MTP draft head for --speculative-token-map on tied Qwen3.5, relaxed greedy chain verification for MTP and DFlash (off by default), and an experimental FP8 GDN state.
… and hot-vocab levers transformers 5 returns a BatchEncoding from apply_chat_template(tokenize=True), which the probe sent as two string ids; template to text and encode instead. Levers gain DFlash (z-lab and nota-ai drafters), the INT4 QAD target, bench's hot-vocabulary maps, relaxed acceptance, plan-stream/glue-graph host levers and the Triton FP8 GEMM route (the aarch64 CUTLASS FP8 kernel aborts here). The ceiling sweep parses one_batch logs and stops runaway runs.
gdn_exact_replay_check.py compares SGLang's packed decode, ReplaySSM and the rounding-preserving replay (engine/moonshot patch 0007) on every output and state word at every step, and times one layer per step at batch 32-256. quality_arms gains a probe-concurrency option for bitwise end-to-end checks; summarise.py gains the four-way interaction table.
lever_sweeps_quick.csv: plain, FP16 GDN state (+24% at c=128), FP8 W8A8 via the Triton route (no gain; the aarch64 CUTLASS FP8 GEMM aborts), FP8 KV (no gain at ~334-token contexts). ReplaySSM levers now set the no_buffer radix strategy, and NGRAM arms run bench's launch checks non-strictly (no draft graph exists).
49f3313 to
eb96688
Compare
mixed-v1 left the tree with the bench harness merge; v2 keeps GSM8K test out of the workload. Monkeypatches of bench entry points go through vars() so mypy, which now sees bench's types, accepts them.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49f3313987
ℹ️ 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".
| replayssm_d = layer_cache.replayssm_d | ||
| replayssm_k = layer_cache.replayssm_k | ||
| replayssm_g = layer_cache.replayssm_g | ||
| + replayssm_beta = layer_cache.replayssm_beta |
There was a problem hiding this comment.
Attach the beta ring to each layer cache
Patch 0007 allocates replayssm_beta only as a local in MambaPool, but never adds it to the per-layer cache structure or initializes a None field when exact replay is disabled. Consequently this unconditional dereference can make ordinary GDN serving fail with AttributeError after the patch is applied; even if the cache tolerates a missing value, SGLANG_GDN_EXACT_REPLAY=1 cannot receive the allocated tensor and silently misses the new kernel path. Wire the per-layer beta slice into the cache alongside replayssm_d/k/g.
Useful? React with 👍 / 👎.
| 'y_tok_s_gpu': round(statistics.fmean(ys), 1) if ys else '', | ||
| 'y_std': round(statistics.stdev(ys), 1) if len(ys) > 1 else '', | ||
| 'accept_len': round(statistics.fmean(spec), 3) if spec else '', | ||
| 'ttft_p50_ms': round(plist[-1].get('ttft_ms', {}).get('p50', float('nan')), 1), |
There was a problem hiding this comment.
Aggregate TTFT across repeated sweeps
When multiple sweep.json files contribute to the same label and concurrency, throughput and acceptance are aggregated across plist, but TTFT is taken only from plist[-1]. Thus any run with --repeats > 1 reports an arbitrary final run's p50 while labeling the row with the combined run count and combined throughput statistics, so run ordering can change the committed TTFT result. Aggregate the per-run TTFT values or emit them separately.
Useful? React with 👍 / 👎.
|
Verdict: REQUEST CHANGES Reviewed at What I checked
Blocking1. The branch conflicts with 2. Numbers rest on evidence that is not on
Fix. Mark each as pending its PR (profile #13, drafter #22), or wait until they merge and cite the committed files. Label the ceilings "derived with a bandwidth from PR #13, pending" until then. 3. The strict replay (P4, patch 0007) is called exact without a committed check.
4. One claim contradicts its CSV.
5. Reproduction uses personal worktrees.
Suggestions (non-blocking)
|
…s review Per the per-workstream patch convention, the series moves to engine/sglang/patches/moonshot/0001-0007 and engine/sglang/README.md keeps the geometry section with a moonshot section below it. Figures from unmerged PRs are marked as under review (profile PR #13), the drafter's tau cites evidence/drafter on main, strict replay is described as designed to be bit-identical with validation pending, the FP8 W8A8 sentence matches the CSV, and reproduction uses repository paths (bench is on main).
|
Verdict: APPROVE Re-reviewed at
Rechecked at this commit: Note for merging. The "PR #13, under review" labels are acceptable while #13 is open. At merge time they cite an unmerged branch, so either merge #13 first or replace them with the committed file paths. Suggestions (non-blocking):
|
Profile workstream figures (bandwidth, kernel attribution, idle share) become stated assumptions or pending markers until its evidence merges; bench's capacity statement cites evidence/bench/README.md; single-run FP8 wording no longer claims a noise band. ceilings.json and ceilings.csv regenerate identically.
Phase 1 of the moonshot workstream: what bounds Qwen3.5-4B serving on the GH200 at both
ends of the Pareto curve, a composable set of engine levers, the first measurements, and a
ranked portfolio. Results that are still queued on the GPU are marked pending in
evidence/moonshot/README.md; this PR will be updated as they land.What is here
experiments/moonshot/levers.py: every lever as a separate flag/environment override onthe bench arms, with its lossy label and conflicts, so stacks compose as lists
(baseline, A, B, A+B).
bench/on main):lever_sweep.py(timed,bench.sweep),gsm8k_arms.py(
bench.quality),quality_arms.py+logit_probe.py(greedy divergence, top-20 KL,teacher-forced agreement against a reference server),
decode_ceiling_sweep.py(static-batch
sglang.benchmark.one_batchup to B = 1,024),summarise.py(tables,paired speedups with t intervals, four-way interaction factors).
ceilings.py->evidence/moonshot/ceilings.{json,csv}: derived roofline floors perlever stack from the checkpoint sizes and the measured HBM peak.
gdn_exact_replay_check.py: bit-exactness (every output and state word at every step)and kernel time of write-avoiding GDN decode against SGLang's packed decode (proposal P4).
engine/sglang/patches/moonshot/0001-0007(branchengine/moonshot), alloff by default:
--speculative-token-map(the tied Qwen3.5 head madethe flag silently wrong at the pin);
(
SGLANG_SPEC_RELAXED_GREEDY_LOGIT_GAP);--speculative-token-mapfor the DFlash captured draft head;SGLANG_GDN_EXACT_REPLAY): the packeddecode's own FP32 operands replayed from a dense anchor written every L steps;
designed to be bit-identical, validation pending.
Findings so far
state read and written every step) pass the 8.41 GB of weights at B = 74-84; the
kernel-time measurement of the crossover is the profile workstream's (pending).
quality pending).
on sm_90) and shows no consistent gain through the Triton route (0.96-1.06x, single
runs); FP8 KV gives nothing at these context lengths. Both are recorded as negative
results.
QAD target is a ready lossy arm.
Testing
pre-commit runon the changed files passes (ruff, mypy, codespell).pytest tests/test_moonshot_levers.py: lever composition in the repo venv; the enginetests (relaxed verification, reduced draft head) pass in the SGLang venv with the
worktree on
PYTHONPATHand skip elsewhere.git amonbd66ce343eand reproduce the branch treeexactly.