Repository navigation
[ModelRunner V2] Reduce peak memory of chunked prompt logprobs - #64841
Merged
WoosukKwon merged 4 commits intoOct 31, 2026
Merged
Conversation
Prompt logprobs are computed in chunks of 1024 rows, but every chunk's results were kept and then concatenated, so the step held them twice at its end. With full-vocab prompt logprobs on a 2048-token prompt of a 152k-vocab model that is ~7 GiB. Write the chunks into outputs preallocated after the first chunk, and return the token ids as int32, which takes ids plus fp32 scores from 12 to 8 bytes per entry. Single-chunk prompts still return the chunk as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xgy3B2NXY4GnQaw2WwsqpC Signed-off-by: Nick Hill <nickhill123@gmail.com>
Member
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98905 for commit ℹ️ This PR is 15 commits behind upstream |
Member
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98907 for commit ℹ️ This PR is 1 commit behind upstream |
njhill
enabled auto-merge (squash)
October 31, 2026 06:18
WoosukKwon
approved these changes
Oct 31, 2026
This was referenced Oct 31, 2026
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
Reduce the peak GPU memory of Model Runner V2's chunked prompt-logprobs computation, which dominates step memory when a request asks for full-vocab prompt logprobs.
Claims
compute_prompt_logprobs_with_chunkingno longer holds every chunk's results twice: chunks are written into outputs preallocated after the first chunk instead of being concatenated at the end.Validation
On GB200 (1 GPU):
The new
test_chunked_prompt_logprobs_match_unchunked(full vocab and top-3) runs 2×1024+3 rows through the chunked path and checks ids, logprobs and ranks against a single unchunkedcompute_topk_scorespass.Details
max_logprobsequal to the vocab size reserved ~7.5 GiB for this transient on an 18 GB MIG slice, leaving no room for KV cache (tests/entrypoints/openai/chat_completion/test_chat_echo.py, which sets--max-logprobs 151936). The breakdown: ~3.5 GiB of accumulated chunk outputs, the same again for the finaltorch.cat, plus one chunk's fp32 logits..tolist(); V1'sLogprobsTensors.empty_cpualready uses int32 ids.torch.topkindices are still int64; they are bounded by the chunk size and cast when copied into the output.vllm/v1/worker/cpu/logprob.py) is left unchanged.PromptLogprobsWorkerstill keeps each step's results on device until the last step and concatenates them.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.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xgy3B2NXY4GnQaw2WwsqpC