Repository navigation
Conversation
A prompt chunked across steps kept every step's prompt logprobs on the device until its last chunk, then concatenated them, so device memory grew with the prompt length (about 1.2 MB per prompt token with full-vocab logprobs over a 152k vocab). Copy each step's rows into a pinned host buffer on the output copy stream instead, so the device holds no more than one step's logprobs, as the V1 runner does. 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>
This was referenced Nov 4, 2026
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 Model Runner V2, accumulate the prompt logprobs of a prompt chunked across steps in a pinned host buffer, copied each step on the output copy stream, instead of keeping every step's rows on the device until the final chunk and concatenating them. Follow-up to #64841 and #64914.
Claims
prompt_logprobs=-1) over a 152k vocab, each prompt token costs ~1.2 MB (int32 ids + fp32 scores), i.e. ~10 GB for an 8k-token prompt before this change.LogprobsTensors.cat, which briefly held both the per-step tensors and their concatenation.Validation
tests/v1/sample/test_logprobs.pyprompt-logprobs selection, including chunked prefill, 16 passed / 7 skipped (the skips are the by-design prefix-caching cases).Details
LogprobsTensors.empty_cpu(rows_left, width), whererows_left = prompt_len - 1 - max(prompt_logprob_start, num_computed_prefill). Each step writes atoffset = len(buffer) - rows_left, so the final chunk fills the buffer exactly and it is returned without slicing.copy_stream.wait_stream(main_stream), then non-blocking D2H copies on the output copy stream, withrecord_streamon the device sources. The step's output copy (AsyncOutput) runs on the same stream later and its completion event covers these copies;LogprobsTensors.to_cpu_nonblockingalready passes CPU tensors through.compute_prompt_logprobs.add_requestdrops any leftover buffer for a reused request id.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