Repository navigation
Conversation
When return_mm_kwargs is false, use exact processor metadata so families whose prompt updates already ignore processed kwargs skip HF tensor construction, and fail closed to full apply otherwise. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Guy Girmonsky <guygir@gmail.com>
6 tasks done
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
When
/renderis called withreturn_mm_kwargs=false, skip encoder-tensorconstruction if the processor can still emit exact
token_ids,mm_hashes,and
mm_placeholders. Complements vllm-project#60728 and vllm-project#46722; it does not changereturn_mm_kwargs=true.Production code under
vllm/(this PR only, basemain): +227 / −10 (approx).Claims
/rendercan avoid materializing encoder tensors.full preprocessing.
routing_metadata_only=not return_mm_kwargs.Validation
Local/cluster tests on the rebased commit. Result: 7 passed.
CI should cover
tests/multimodal(misc.yaml) andtests/entrypoints/scale_out(entrypoints.yaml).This PR is the generic path only. Family speedups are in the follow-up
adapter PRs.
Details
return_mm_kwargs=falsealready drops tensors from the HTTP response(vllm-project#60728), but
MultiModalProcessor.apply()can still build them. Cache-awarerouters never use those tensors.
apply_routing_metadata()reuses existing prompt updates when they do notread processed kwargs. Tensor-dependent updates, custom
apply, customprompt finalization, encoder-decoder processors, and direct kwargs-data
access fall back to full
apply().No model-runner, scheduler, or KV-cache code changes. Default generate
behavior is unchanged.
AI assistance was used to implement and validate this change. A human
submitter reviewed the diff.
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.