Repository navigation
Conversation
… budget idle In align cache mode, intermediate prefill chunks end on the Mamba block grid, so a long prompt prefills only the largest block multiple of the token budget per step. With large hybrid blocks (e.g. 1152 tokens) and the 2048-token API server default on GPUs below 70 GiB, each step prefills 1152 tokens and 44% of the budget stays idle. Warn from validate_block_size() once the block size is final when more than a quarter of the budget would stay idle, suggest a block-aligned value with decode headroom, and document the interaction in the hybrid section of the prefix caching guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Contributor
|
Documentation preview: https://vllm--61878.org.readthedocs.build/en/61878/ |
0z5a
marked this pull request as ready for review
October 20, 2026 14:47
0z5a
requested review from
ProExpertProg,
WoosukKwon,
houseroad,
mgoin,
robertgshaw2-redhat,
tlrmchlsmth,
yewentao256 and
youkaichao
as code owners
October 20, 2026 14:47
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
In Mamba prefix-caching (
mamba_cache_mode="align") mode, intermediate prefill chunks end on the block grid. With the large blocks hybrid models get after page-size alignment, a sizeable part of--max-num-batched-tokenscan silently stay idle on every prefill step. This PR warns at startup when that happens, suggests a block-aligned value, and documents the interaction. It does not change scheduling behavior.Claims
VllmConfig.validate_block_size()now logs a warning when align-mode chunking would leave more than a quarter of the prefill budget idle. That method runs once the block size is final and already holds the align-mode constraints. The warning suggests the next block multiple plus decode headroom.Validation
Unit tests (CPU-only environment, upstream main
a9e90b9d+ this change):The full
tests/test_config.pywas run with and without this change in the same offline CPU environment. Both runs had the same 106 failures (tests that need the HF hub or a GPU) and 7 skips. Without the change, 339 tests passed. With it, 341 passed: the same tests plus the 2 new ones. No new failures.ruff checkandruff formatare clean.Why it matters: serving data (GLM-5.3-Flash, vLLM 0.31.0, 2 × 4 H100 64GB, TP8 + EP, MTP k=3,
--max-model-len 1048576, fp8 KV cache). Metric: 1/P90 of per-request (E2E s / output tokens), 16 concurrent sessions replaying two-turn agentic-coding traces with ~230K-token prompts. GLM-5.3-Flash serves with 1152-token blocks here, and the API-server default budget on GPUs below 70 GiB is 2048.--max-num-batched-tokens--max-cudagraph-capture-size 128 --language-model-only. Those two flags alone gave +2% (3.53, n=2).This serving data was collected on vLLM 0.31.0, setting the flag by hand. The warning itself is verified by the unit test; it was not exercised in a GPU server run on main.
Details
Scheduler._mamba_block_aligned_splitfloors intermediate chunk ends toblock_sizeso the cached SSM state stays block-aligned. A long prompt therefore prefillsfloor(budget / block) * blocktokens per step, and decode tokens in the same step can lower this further. With 1152-token blocks and a 2048 budget, 44% of the budget goes unused, and nothing in the logs says so.max_num_batched_tokens(profiling run, CUDA graph and compile ranges, backend workspaces), so raising the budget at that point would be unsafe.--long-prefill-token-thresholdis set, because the user is then deliberately tuning chunk sizes.cache_config.block_size.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
Draft: opened for early feedback; the submitter will review every line before marking it ready.
🤖 Generated with Claude Code