Skip to content

[Frontend] Use new Renderer for Completions and Tokenize API#32863

Merged
vllm-bot merged 114 commits intovllm-project:mainfrom
DarkLight1337:init-renderer-2
Jan 31, 2026
Merged

[Frontend] Use new Renderer for Completions and Tokenize API#32863
vllm-bot merged 114 commits intovllm-project:mainfrom
DarkLight1337:init-renderer-2

Conversation

@DarkLight1337
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 commented Jan 22, 2026

Purpose

Follow-up to #30200
Towards #22880

  • Add render_completions and tokenize_prompt to Renderer API.
    • Async versions are backed by AsyncMicrobatchTokenizer which is internally managed by Renderer.
  • Remove legacy CompletionRenderer and related code from serving engine.
  • Add _preprocess_completion to serving engine which has the same function as _preprocess_chat.
  • Introduce ChatParams and TokenizeParams which are passed to the Renderer to apply the corresponding steps, greatly reducing the number of arguments that need to be passed to _preprocess_completion and _preprocess_chat.
    • Each request definition should implement build_chat_params and/or build_tok_params for the corresponding steps.
    • Replace _validate_truncation_size with TokenizeParams handling.
    • Deprecate passing truncate_prompt_tokens and params.truncate_prompt_tokens to offline APIs; users should pass tokenization_kwargs instead which are internally mapped to TokenizeParams.

After this PR:

  • Add wrapper methods over preprocess_chat and _preprocess_completion.
  • Use Renderer for IO Processor, Score API and Beam Search API.
  • Incorporate InputProcessor into Renderer, including MM part.
  • Allow per-prompt tokenization_kwargs by adding it to _CommonKeys and handling it accordingly (similar to mm_processor_kwargs ).

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>
@mergify mergify bot added the frontend label Jan 22, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337
Copy link
Copy Markdown
Member Author

cc @noooop @chaunceyjiang what do you think so far of this design?

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

The pull request introduces a new rendering architecture by refactoring the prompt processing logic into vllm/renderers/protocol.py and vllm/renderers/params.py. This change centralizes the handling of tokenization, chat template formatting, and multimodal input, leading to a more modular and maintainable codebase. The RendererLike protocol now defines the interface for rendering and tokenizing prompts, and request objects implement build_tok_params and build_chat_params methods to provide necessary configuration. While the overall refactoring is positive, there are a few critical issues related to parameter handling in chat template construction and error handling that need to be addressed.

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>
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>
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>
@DarkLight1337
Copy link
Copy Markdown
Member Author

DarkLight1337 commented Jan 31, 2026

It was added fairly recently by #29794, I think we can change the interface later to pass TokenizeParams directly, similar to SamplingParams. Another way would be to let users pass any keyword arguments to the LLM APIs and try to separate them into the individual params (which is how HF does it)

@vllm-bot vllm-bot merged commit f0a1c84 into vllm-project:main Jan 31, 2026
128 of 131 checks passed
DarkLight1337 added a commit to DarkLight1337/vllm that referenced this pull request Jan 31, 2026
…ect#32863

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
vllm-bot pushed a commit that referenced this pull request Jan 31, 2026
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337 DarkLight1337 deleted the init-renderer-2 branch February 2, 2026 05:59
PiratePai pushed a commit to PiratePai/epd_shm that referenced this pull request Feb 3, 2026
…oject#32863)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Pai <416932041@qq.com>
PiratePai pushed a commit to PiratePai/epd_shm that referenced this pull request Feb 3, 2026
…ect#32863 (vllm-project#33475)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Pai <416932041@qq.com>
wangxiyuan added a commit to vllm-project/vllm-ascend that referenced this pull request Feb 5, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Feb 12, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: momochenchuw <chenchuw@huawei.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Feb 28, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Mar 4, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
LCAIZJ pushed a commit to LCAIZJ/vllm-ascend that referenced this pull request Mar 7, 2026
### What this PR does / why we need it?
1. Fix `TypeError: FusedMoEParallelConfig.__init__() missing 1 required
positional argument: 'is_sequence_parallel'` due to
vllm-project/vllm#32567
2. Fix ` TypeError: '>' not supported between instances of 'MagicMock'
and 'int'` due to vllm-project/vllm#33035
3. Fix `TypeError: Can't instantiate abstract class AscendMLAImpl with
abstract methods forward_mha, forward_mqa` and AttributeError: 'bool'
object has no attribute 'process_weights_after_loading' due to
vllm-project/vllm#33284
4. Fix `'AscendSharedFusedMoE' object has no attribute
'_routed_input_transform'`due to
vllm-project/vllm#32790
5. Fix `NPUModelRunner._dummy_run() got an unexpected keyword argument
'num_active_loras'` due to
vllm-project/vllm#32005
6. Fix the problem caused by` 'tuple' object has no attribute 'job_id'`
due to vllm-project/vllm#27492
7. Fix the problem that all_moe_layers is not equal to vllm.moe_forward,
vllm.moe_forward_shared due to
vllm-project/vllm#33184
8. Add patch to fix the problem "got multiple values for keyword
argument 'add_special_tokens'" due to
vllm-project/vllm#32863
### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main: https://github.com/vllm-project/vllm/commit/v0.15.0

---------

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: hfadzxy <starmoon_zhang@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation frontend ready ONLY add when PR is ready to merge/full CI is needed ready-run-all-tests Trigger CI with all tests for wide-ranging PRs v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants