Repository navigation
Add serving benchmark harness, frozen workload and GSM8K quality check - #17
Conversation
bench/ holds declarative SGLang server arms (arms.toml), a launcher that records the exact command, source trees and /server_info and verifies from the log and the scheduler's resolved state that CUDA graphs cover decode and prefill up to capacity and that the overlap scheduler is on, an aiperf concurrency sweep runner, the per-point result parser (paper frontier metrics x and y, TTFT, ITL, per-request speculative acceptance from the sglext stream extension), and a Pareto aggregator. bench/workloads/mixed-v1 is a frozen, disjoint warmup/tune/confirm split of 1,857 chat, code and maths prompts from pinned public datasets (MT-Bench, OASST1, HumanEval, MBPP, GSM8K), rebuilt byte-identically by bench/build_workload.py. pyproject.toml adds bench to the mypy file list and the repository root to pytest's path so tests can import the package.
bench/quality.py freezes the GSM8K test split (1,319 problems, pinned revision, sgl-eval's answer parsing) and scores an arm with sgl-eval: greedy, thinking on, natural stopping up to 16,384 tokens. It also compares two runs pairwise (accuracy delta, exact McNemar test, identical answers and generations). bench/lengths.py summarises natural output lengths per domain, including the share of requests that would stop before a fixed output length. bench/token_map.py builds an FR-Spec-style hot-token draft vocabulary from the model's outputs on the tune split and reports coverage on other runs. The sweep now samples CPU time used by processes outside its own and the server's sessions, waits for it to fall below 2 cores before each point and records it: the GPU lock does not keep CPU-heavy jobs away, and the scheduler, tokenizer manager and client are CPU-bound. The default server memory fraction rises to 0.85 so a 5-step MTP chain fits at capacity 128. bench/README.md documents the workflow and metric definitions.
- arms.toml gains a DFlash arm (z-lab/Qwen3.5-4B-DFlash at a pinned revision, block 8) with the model card's GDN kernel, piecewise-prefill and plan-stream settings, adapted to sm_90 (flashinfer target attention). - The launch check knows that DFLASH has no EAGLE draft-extend graph; sweeps accept --no-strict for probing new algorithms. - Sweeps can drop per-chunk usage and raw export (to separate client from server streaming costs) and record per-process CPU peaks of the server and client alongside foreign load. - lengths.py locates greedy repetition loops. In a natural-stopping run on the tune split a quarter of thinking-mode greedy outputs loop until the 16,384-token limit, so the quality check now uses Qwen's recommended thinking-mode sampling (T 0.6, top-p 0.95, fixed seed) instead of greedy. - pareto.py also writes launches.csv: capacity, graph range, memory split, failed checks and source commits for every server launch.
torch.compile fails on Qwen3.5's residual-stream Contribution object during piecewise prefill graph capture at bd66ce34, so the DFlash arm keeps SGLang's default breakable prefill graph.
bench/campaigns/ holds the exact command sequences behind each evidence directory. evidence/bench/ starts with the natural-length measurement on the tune split (fixed 512-token panel is ~95% natural text; a quarter of greedy thinking outputs loop to the 16,384-token limit) and the capacity and draft-tree probes (1,024 concurrent plain requests with the radix cache off; trees run on the GDN hybrid; BF16 state at 512 fails at verify graph capture).
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: 63c25cfdd8
ℹ️ 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".
| measured = cycled(self.workload, requests) | ||
| prompts = [*cycled(self.warmup_pool, warmup), *measured] | ||
| point_dir = self.run_dir / f'r{repeat}' / f'c{concurrency:03d}' | ||
| flushed = self.flush_cache() |
There was a problem hiding this comment.
Abort a point when the prefix-cache flush fails
If /flush_cache remains unavailable after the retries, this stores False but proceeds with the measurement. Because each point reuses the same workload prefix, cached prompts from the preceding warmup or concurrency point can then materially inflate throughput and acceptance results; the later Pareto pipeline does not exclude points whose cache_flushed flag is false. Abort or retry the point instead of benchmarking known-contaminated cache state.
Useful? React with 👍 / 👎.
| for row in rows: | ||
| groups[(row['label'], int(row['concurrency']))].append(row) |
There was a problem hiding this comment.
Exclude unsuccessful points from frontier aggregation
When aiperf exits nonzero after producing partial artifacts, or when some requests fail, the point still reaches this grouping and its x_e2e/y values are computed from only the successful subset. Such a partial point can therefore look artificially fast and even be marked Pareto-optimal; a point with no finite metrics is also marked optimal because comparisons with NaN are false. Filter or explicitly invalidate points with request failures, OSL mismatches, nonzero aiperf status, failed cache flushes, or prompt mismatches before computing the frontier.
Useful? React with 👍 / 👎.
| a, b = load(run_a), load(run_b) | ||
| shared = sorted(set(a) & set(b)) | ||
| only_a = sum(1 for key in shared if a[key]['correct'] == 'True' and b[key]['correct'] != 'True') |
There was a problem hiding this comment.
Reject quality comparisons with different problem sets
If either quality run is partial or contains different IDs, intersecting the keys silently changes the evaluation population and can hide exactly the failed or omitted problems, producing a misleading accuracy delta and McNemar result. Since this function is presented as a paired comparison on the same GSM8K problems, require identical ID sets (and ideally the expected 1,319 IDs) rather than scoring only shared.
Useful? React with 👍 / 👎.
|
Verdict: REQUEST CHANGES Reviewed at What I ran and checked
Blocking1. 2. The GSM8K quality set overlaps the tune split, and this is not stated.
3. The probe numbers are labelled as pilots only in the README, not in the committed CSVs.
Suggestions (non-blocking)
|
- Workload mixed-v2 draws its maths prompts from GSM8K train, so no warmup, tune or confirm prompt is a GSM8K test problem (the quality set). mixed-v1 stays in history for the feasibility probes that used it. - The quality check now sends Qwen's full recommended thinking-mode sampling, including top-k 20: sgl-eval has no top-k option and the checkpoint ships no generation_config.json, so bench.quality runs sgl-eval's own pipeline with top_k added to each request body. - Probe evidence carries a status and the foreign CPU load per point and no longer has a frontier or Pareto flags; the README states that the plain-decode probes ran during a 41-47-core foreign job. - The DFlash arm holds only algorithm flags; GDN kernel backends and the plan-stream variable are tuned as shared flags for every arm, and the model card's settings become an explicit ablation in the probe script. - README quality command no longer says greedy.
|
Verdict: APPROVE Re-reviewed at
Also done:
The branch merges into Before the confirmation sweep:
|
This adds the serving benchmark harness that the baselines, the before/after comparisons and the moonshot and drafter arms run through, together with a frozen prompt set, the GSM8K quality check and the first feasibility evidence. Tuned baselines and the confirmation sweep will come in a follow-up PR.
What is here
bench/arms.toml,bench/arms.py: server arms as declarative launch flags (plain, MTP, DFlash), with--set/--unset/--env/--sglang-worktreeoverrides andlossy/require_full_graph_coveragedeclarations for arms that change numerics or exceed the CUDA-graph range.bench/server.py: launches an arm in its own process group, waits for/health_generate, and records the command, the SGLang tree actually imported (and its git state), this repository's commit,/server_infoand GPU state. It refuses to benchmark unless decode/verify CUDA graphs were captured up to capacity, prefill graphs were captured, the scheduler reports the overlap scheduler on (optionally confirmed by apy-spystack showingevent_loop_overlap), capacity was not capped by the GDN state cache, and the speculative settings and backend are the requested ones.bench/sweep.py: one server launch, then closed-loop aiperf 0.13.0 over client concurrency. Per point: prefix-cache flush, one warmup wave from a disjoint pool,max(64, 8c)measured requests,/metricsdeltas, log-segment stats, and foreign CPU load (it waits for other processes to use under two cores; see below).bench/results.py: the paper's frontier metrics. x = mean over requests of n_i / e_i (includes TTFT); y = total output tokens / (last completion - first send). Also the decode-only rate, a steady-state throughput that excludes the drain, latency percentiles, and per-request speculative statistics from SGLang'ssglext.spec_tokens_details.bench/pareto.py:points.csv,frontier.csv(mean/std/min/max over repeats, Pareto flag, ratios to a baseline),launches.csv, PGFPlots.datand a PNG.bench/workloads/mixed-v2/: 1,857 prompts from pinned MT-Bench, OASST1, HumanEval, MBPP and GSM8K train revisions, split per domain into disjoint warmup, tune and confirm sets; GSM8K test is reserved for the quality check, so no workload prompt is a quality problem.bench/build_workload.pyrebuilds the files byte for byte (checked).bench/quality.py+bench/quality/gsm8k_test.jsonl: full GSM8K test (1,319) via sgl-eval's pipeline, thinking on, T 0.6 / top-p 0.95 / top-k 20 with a fixed seed (top-k is added to the request body because sgl-eval has no option for it and the checkpoint has no generation_config.json), and a paired comparison (accuracy delta, exact McNemar, identical answers).bench/lengths.py,bench/token_map.py: natural-length and repetition-loop analysis; FR-Spec-style hot-token maps from tune-split outputs.bench/campaigns/: the command sequences behind each evidence directory.evidence/bench/: natural-length distribution on the (v1) tune split and the capacity/tree probes, markedfeasibility-probewith per-point foreign CPU load (README has commands, flags and which rows are contaminated).Findings so far (details in evidence/bench/README.md)
Validation
pytest tests/test_bench_harness.py: 18 passed (arm merging, log parsing and launch verification, hand-computed x/y/steady-state/acceptance on a synthetic aiperf export, Prometheus deltas, frontier dominance).Review round 1
Fixed: README quality description; GSM8K test no longer appears in any workload split (mixed-v2 uses GSM8K train); probe evidence has status and foreign-load columns and no Pareto flags; top-k 20 is now sent; the DFlash arm holds only algorithm flags, with backend/runtime flags to be chosen once for all arms on the tuning split (the card's GDN-kernel and plan-stream settings are an explicit ablation); the quality campaign runs the plain arm twice for the identical-answer noise floor. The frontend limit is diagnosed in the next exclusive slot, before any confirmation sweep.
Limitations and open issues
pyproject.tomlgainsbenchin the mypy file list and the repository root on pytest's path.