Skip to content

[Docs] Update the ngram speculative decoding notes: devices, overlap scheduler, external corpus flags - #42687

Open
7konigsberg wants to merge 1 commit into
sgl-project:mainfrom
7konigsberg:docs/ngram-spec-decoding-notes
Open

7konigsberg wants to merge 1 commit into
sgl-project:mainfrom
7konigsberg:docs/ngram-spec-decoding-notes

Conversation

@7konigsberg

@7konigsberg 7konigsberg commented Oct 6, 2026 •

Copy link
Copy Markdown

Motivation

While working on #42313 I read the Ngram section of speculative_decoding.mdx next to the code, and four things on the page no longer match it. Small page, but it is the first thing someone turning on NGRAM reads, so I think it is worth keeping right.

Modifications

  • "only supports CUDA": _handle_ngram in arg_groups/speculative_hook.py accepts cuda, cpu and xpu, and ngram_worker.py has CPU and XPU paths. Note and feature-table row updated.
  • "disables the overlap scheduler": the only place that happens is _disable_overlap_schedule_for_cpu, so CPU only. A CUDA NGRAM server starts with disable_overlap_schedule: False in its printed server args. Mixed chunked prefill is still disabled, kept that part.
  • --speculative-num-draft-tokens "defaults to min(--speculative-ngram-max-trie-depth, 12)": _handle_ngram sets 12 unconditionally. There is no clamp against the trie depth anywhere.
  • The parameter table stopped at --speculative-ngram-capacity: added the three external-corpus flags from arg_groups/fields/spec.py (-external-corpus-path, -external-sam-budget, -external-corpus-max-tokens), with the descriptions already used in server_arguments.mdx, plus the two validation rules _handle_ngram enforces on the budget.

Defaults in the table (1, 10, 18, 10,000,000) match the code and are unchanged. Nothing outside the Ngram section was touched.

Accuracy Tests

N/A, docs only.

Speed Tests and Profiling

N/A, docs only.

Checklist


CI States

Latest PR Test (Base): ✅ Run #37395407191
Latest PR Test (Extra): ❌ Run #37395406980
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.

@github-actions github-actions Bot added documentation Improvements or additions to documentation speculative-decoding labels Oct 6, 2026
…scheduler, external corpus flags

Four statements in the Ngram section no longer match the code:

- "only supports CUDA": `_handle_ngram` in `arg_groups/speculative_hook.py`
  accepts cuda, cpu and xpu, and `ngram_worker.py` has CPU and XPU paths.
- "disables the overlap scheduler": only `_disable_overlap_schedule_for_cpu`
  does that, on CPU. A CUDA NGRAM server runs with the overlap scheduler on
  (`disable_overlap_schedule: False` in its printed server args). Mixed
  chunked prefill is still disabled, which the note keeps.
- `--speculative-num-draft-tokens` "defaults to min(max-trie-depth, 12)":
  `_handle_ngram` sets 12 unconditionally.
- The parameter table stopped at `--speculative-ngram-capacity`; the three
  external-corpus flags from `arg_groups/fields/spec.py`, which
  `server_arguments.mdx` already documents, were missing here.

The feature table row for NGRAM is updated to match the notes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

This branch has not been deployed

No deployments
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 speculative-decoding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant