Skip to content

[Renderer] Move InputPreprocessor into Renderer (1/2)#34510

Merged
vllm-bot merged 24 commits into
vllm-project:mainfrom
DarkLight1337:mv-mm-processor-1
Feb 14, 2026
Merged

[Renderer] Move InputPreprocessor into Renderer (1/2)#34510
vllm-bot merged 24 commits into
vllm-project:mainfrom
DarkLight1337:mv-mm-processor-1

Conversation

@DarkLight1337
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 commented Feb 13, 2026

Purpose

Towards #22880

  • Define default TokenizeParams in the Renderer, and let each MM model define its own defaults via BaseProcessingInfo.get_default_tok_params. This allows tokenization for MM models to be handled by Renderer instead of inside MM processor, even for offline APIs. It should also solve the minor accuracy discrepency between offline and online APIs because of different handling of add_special_tokens.
  • Update InputPreprocessor._tokenize_prompt and InputProcessor._truncate_inputs to use Renderer.
  • Moved contains_only_strings check from InputPreprocessor to InputProcessor.

Misc changes:

  • Move StreamingInput from inputs file to engine protocol to avoid circular import.
  • Move get_timing_stats_from_engine_client to benchmarks since it's only used there.
  • Renamed InputProcessor.close to InputProcessor.shutdown.
  • Add convenience method MultiModalCacheStats.record.

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 13, 2026
@mergify mergify Bot added frontend llama Related to Llama models multi-modality Related to multi-modality (#4194) performance Performance-related issues v1 labels Feb 13, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant refactoring that moves the logic from InputPreprocessor into the Renderer class. This centralization of input processing logic is a good architectural improvement. The changes include defining default tokenization parameters in the Renderer and allowing multimodal models to provide their own defaults, which helps resolve inconsistencies. The movement of StreamingInput to avoid circular imports and the relocation of benchmark-specific utilities are also positive changes.

I've found one issue where a method is called redundantly, which could impact performance. Please see my specific comment for details.

Comment thread vllm/renderers/base.py
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant refactoring that moves the responsibility of tokenization parameter management and multi-modal processing from various components into the Renderer. This centralization simplifies the LLM and InputProcessor classes and improves the overall code structure. The changes are well-executed and consistent with the goal of the PR. I've identified a few places where a None check for the multi-modal processor is missing, which could lead to a crash if multimodal data is passed to a non-multimodal model. Please see my detailed comments.

Comment thread vllm/benchmarks/mm_processor.py
Comment thread vllm/inputs/preprocess.py
Comment thread vllm/v1/engine/input_processor.py
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 13, 2026 10:20
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Comment thread vllm/model_executor/models/siglip.py Outdated
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Comment thread vllm/model_executor/models/clip.py Outdated
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Comment thread vllm/model_executor/models/clip.py Outdated
Comment thread vllm/model_executor/models/siglip.py Outdated
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@vllm-bot vllm-bot merged commit 73391a1 into vllm-project:main Feb 14, 2026
60 of 64 checks passed
@DarkLight1337 DarkLight1337 deleted the mv-mm-processor-1 branch February 14, 2026 18:14
jiangkuaixue123 pushed a commit to jiangkuaixue123/vllm that referenced this pull request Apr 28, 2026
…4510)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
mystous pushed a commit to mystous/vllm_hybrid that referenced this pull request May 10, 2026
…4510)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend llama Related to Llama models multi-modality Related to multi-modality (#4194) performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants