Skip to content

# feat(bench): add SPEED-Bench dataset support to bench_serving#24149

Merged
kpham-sgl merged 12 commits into
sgl-project:mainfrom
jmamou:speed-bench-dataset
May 28, 2026
Merged

# feat(bench): add SPEED-Bench dataset support to bench_serving#24149
kpham-sgl merged 12 commits into
sgl-project:mainfrom
jmamou:speed-bench-dataset

Conversation

@jmamou

@jmamou jmamou commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Add nvidia/SPEED-Bench as a new dataset option in bench_serving.

Motivation

SPEED-Bench (SPEculative Evaluation Dataset) is a unified benchmark specifically designed to evaluate Speculative Decoding (SD) algorithms across diverse semantic domains and realistic serving regimes (paper). It combines two purpose-built dataset splits:

  • Qualitative split — 880 semantically diverse prompts across 11 task domains (Coding, Math, Reasoning, RAG, etc.) to measure drafter acceptance rates and acceptance lengths.
  • Throughput split — fixed-length input sequences (1K–32K tokens) categorized by output entropy (low_entropy / mixed / high_entropy) to assess system-level throughput under high concurrency across the compute-bound → memory-bound transition that governs speculative decoding cost-benefit trade-offs.

Adding it as a native dataset option enables reproducible, category-specific speculative decoding throughput benchmarking directly via bench_serving, without requiring custom preprocessing scripts.

Modifications

  • New SpeedBenchDataset plugin (python/sglang/benchmark/datasets/speed_bench.py) that reads a pre-downloaded throughput_1k JSONL file, optionally filters by category (low_entropy / mixed / high_entropy), applies the model's chat template, and fixes the output length.
  • Registers "speed-bench" in DATASET_MAPPING (python/sglang/benchmark/datasets/__init__.py).
  • Adds --speed-bench-category and --speed-bench-output-len CLI args to bench_serving.py.

Example usage:

python -m sglang.bench_serving \
  --dataset-name speed-bench \
  --dataset-path /path/to/throughput_1k.jsonl \
  --speed-bench-category mixed \
  --speed-bench-output-len 512 \
  --num-prompts 80

Accuracy Tests

N/A — this PR only adds a dataset loader; it does not modify any model forward or kernel code.

Speed Tests and Profiling

N/A — this PR does not affect inference speed. The dataset plugin is used to drive existing bench_serving infrastructure.

Checklist

  • Format your code according to the Format code with pre-commit. (all pre-commit hooks passed)
  • Add unit tests according to the Run and add unit tests. Added to test/registered/bench_fn/test_benchmark_datasets_api.py: test_speed_bench_sampler, test_speed_bench_category_filter, test_speed_bench_output_len_override, test_speed_bench_empty_category_raises, test_speed_bench_no_path_raises, and coverage in test_dataset_mapping_and_dispatch.
  • Update documentation according to Write documentations. Updated docs_new/docs/developer_guide/bench_serving.mdx: added speed-bench to the dataset list with a description, added its CLI flags (--speed-bench-category, --speed-bench-output-len), and added a numbered example for speculative decoding throughput benchmarking.
  • Accuracy and speed benchmark results: N/A (dataset loader only).
  • Follow the SGLang code style guidance.

CI States

Latest PR Test (Base): ✅ Run #26535922407
Latest PR Test (Extra): ❌ Run #26535921652

jmamou added 2 commits April 30, 2026 07:05
Add nvidia/SPEED-Bench (https://huggingface.co/datasets/nvidia/SPEED-Bench)
as a new dataset option in bench_serving.

Changes:
- New SpeedBenchDataset plugin (python/sglang/benchmark/datasets/speed_bench.py)
  reading a pre-downloaded throughput_1k JSONL, optionally filtering by
  category (low_entropy / mixed / high_entropy) and fixing output length.
- Register 'speed-bench' in DATASET_MAPPING.
- Add --speed-bench-category and --speed-bench-output-len CLI args.

Example usage:
  python -m sglang.bench_serving \
    --dataset-name speed-bench \
    --dataset-path /path/to/throughput_1k.jsonl \
    --speed-bench-category mixed \
    --speed-bench-output-len 512 \
    --num-prompts 80
- Add 5 unit tests for SpeedBenchDataset in test_benchmark_datasets_api.py:
  test_speed_bench_sampler, test_speed_bench_category_filter,
  test_speed_bench_output_len_override, test_speed_bench_empty_category_raises,
  test_speed_bench_no_path_raises
- Add speed-bench coverage to test_dataset_mapping_and_dispatch
- Document speed-bench in docs_new/docs/developer_guide/bench_serving.mdx:
  dataset list entry, CLI flags section, and speculative decoding example

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the SPEED-Bench dataset in the benchmark serving utility. The changes include documentation updates, new CLI arguments for category filtering and output length, the implementation of the SpeedBenchDataset class, and new unit tests. A review comment identifies opportunities to optimize the load method by tokenizing unique prompts before sampling, improving benchmark quality through shuffling during oversampling, and increasing robustness by specifying UTF-8 encoding when reading the dataset file.

Comment thread python/sglang/benchmark/datasets/speed_bench.py
- Tokenize unique prompts once before sampling to avoid redundant work
- Shuffle oversampled rows for a realistic request distribution
- Add encoding='utf-8' when opening the dataset file for robustness

@kpham-sgl kpham-sgl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @jmamou this will be quite useful

@kpham-sgl

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@jmamou
jmamou requested a review from zijiexia as a code owner May 20, 2026 09:05
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 20, 2026
@kpham-sgl

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@zijiexia
zijiexia enabled auto-merge (squash) May 20, 2026 20:33
@zijiexia
zijiexia disabled auto-merge May 25, 2026 20:48
@jmamou

jmamou commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci extra

1 similar comment
@jmamou

jmamou commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci extra

@jmamou

jmamou commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci extra

@kpham-sgl
kpham-sgl merged commit 97d129f into sgl-project:main May 28, 2026
232 of 249 checks passed
@jmamou
jmamou deleted the speed-bench-dataset branch May 29, 2026 13:05
mqhc2020 pushed a commit to mqhc2020/sglang that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants