Skip to content

[Rust Frontend] Add native GLM-5.3 / GLM-5.3-Flash chat rendering - #62424

Merged
Isotr0py merged 13 commits into
vllm-project:mainfrom
zRzRzRzRzRzRzR:glm53
Oct 30, 2026
Merged

Isotr0py merged 13 commits into
vllm-project:mainfrom
zRzRzRzRzRzRzR:glm53

Conversation

@zRzRzRzRzRzRzR

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Add native Rust GLM5Next chat rendering for GLM-5.3 and GLM-5.3-Flash, including tool calls and reasoning options. Rust auto selects it for the glm5_next model type (GLM-5.3-Flash); GLM-5.3 shares glm_moe_dsa with GLM-5 through GLM-5.2, so it uses --tokenizer-mode glm5_next explicitly.

Claims

  • Replace MiniJinja template interpretation with model-specific Rust rendering for both model templates.
  • Produce token IDs with control markers resolved through the added vocabulary, while literal text uses the base vocabulary.

Validation

After syncing upstream main through 94a29d316e on 2026-10-25:

  • cd rust && cargo test -p vllm-chat -p vllm-server -p vllm-cmd --lib --locked --offline -- --test-threads=1: 442 chat tests and 510 server tests passed.
  • cd rust && cargo test -p vllm-cmd --bin vllm-rs --locked --offline -- --test-threads=1: 93 CLI tests passed.
  • cd rust && cargo clippy -p vllm-chat -p vllm-server -p vllm-cmd --lib --bins --tests --locked --offline -- -D warnings: passed.
  • Pre-commit checks on the resolved and changed files, Rust formatting, and the PR diff whitespace check passed.

The tests cover rendered prompts, complete token IDs, auto renderer selection, and in-process HTTP routes with the existing scripted engine. The final additional upstream Preload commit does not change the tested Rust or GLM configuration files.

Tool-choice regression: fails before the fix, passes after

The initial merged tree passed 441 chat tests but failed the existing GLM/HF prompt parity test: with tool_choice="none", GLM omitted the tool definitions that HF rendered. The new HTTP render-route regression reproduced the same bug before removing the renderer's extra parsing gate:

cd rust
cargo test -p vllm-server --lib --locked --offline render_glm_tools_for_none_follow_server_exclusion_setting -- --exact routes::tests::render_glm_tools_for_none_follow_server_exclusion_setting
assertion `left == right` failed: exclude=false
  left: false
 right: true
test result: FAILED. 0 passed; 1 failed

After the fix, both the existing GLM/HF parity test and the new route test pass in the suites above. The route test checks that tool definitions remain by default and are removed when --exclude-tools-when-tool-choice-none is enabled. The Rust workspace Buildkite job selects this test.

Previous author-reported frontend benchmarks compared both templates against HF MiniJinja with identical requests, 4 server CPU cores, concurrency 64, and two 4-second runs per configuration:

Workload Native / HF throughput
Short tool conversations 1.50x
Parallel tool calls 1.75–1.79x
Long tool histories 1.77–1.86x

These measurements cover frontend rendering and tokenization, excluding model inference, and were not rerun for this upstream sync. GPU serving and model evaluations were not rerun on the local macOS host.

Details

This PR adds chat rendering; multimodal preprocessing is owned by llm-multimodal, with the GLM processor work handled in smg-project/smg#4036. The Python frontend continues to use the HF tokenizer and renderer. The tokenizer-mode docstring generates the user-facing argument reference, both GLM recipes include deployment examples, and the tool-calling guide documents the default tool-definition policy for the native GLM renderer.

Both glm5_next and upstream's alpamayo2_super tokenizer modes are preserved. GLM tool definitions follow the effective tool list; the server owns the exclusion policy, rather than the renderer's tool-parsing flag. Chat Completions conversion retains empty explicit reasoning strings; reasoning / reasoning_content are vLLM extensions absent from the OpenAI OpenAPI 2.3.0 assistant-message schema checked on 2026-10-25.

Rejecting --chat-template and request chat_template for native renderers, including glm5_next, is handled generically in #64274.

Duplicate-work check: this continues the existing native GLM renderer PR; the earlier GLM/Rust/tokenizer search found no other PR implementing the same renderer.

Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR changed the title Add native Rust GLM5Next tokenizer support Add native Rust GLM-5.3 / GLM-5.3-Flash tokenizer support Oct 19, 2026
@mergify

mergify Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @zRzRzRzRzRzRzR.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

pub const INKLING_LITERAL: &str = "inkling";
pub const INKLING_MODEL_TYPE: &str = "inkling_mm_model";
pub const KIMI_K3_LITERAL: &str = "kimi_k3";
pub const GLM5_NEXT_LITERAL: &str = "glm5_next";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think it would also be good to enhance resolve so that auto can be resolved to Glm5Next as well?

@zRzRzRzRzRzRzR

Copy link
Copy Markdown
Contributor Author

This PR involves significant changes; I have forced the push. After discussing with @Isotr0py, it was decided that the multimodal part will be handled in smg, and the llm-multimodal component will be updated accordingly. Here, only the language part is being dealt with.

Add a `glm5_next` renderer that renders GLM-5.3 and GLM-5.3-Flash prompts
natively instead of through MiniJinja, emitting token IDs directly with
control tokens split from literal text.

`--tokenizer-mode auto` selects it when the checkpoint ships one of the
GLM-5.3 / GLM-5.3-Flash templates it reproduces; GLM-5 through GLM-5.2 share
the `glm_moe_dsa` model type with other templates and keep the `hf` renderer.
`--tokenizer-mode glm5_next` selects it explicitly.

Multimodal preprocessing for GLM-5.3-Flash is left to llm-multimodal
(smg-project/smg#4036); until the dependency includes it, image and video
requests on the Rust frontend are rejected.

Signed-off-by: zRzRzRzRzRzRzR <Yuxuan.Zhang2@liverpool.ac.uk>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mergify mergify Bot removed the needs-rebase label Oct 28, 2026

@BugenZhao BugenZhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

github-actions Bot added a commit to vllm-project/recipes that referenced this pull request Oct 28, 2026
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
vllm-project#64274 rejects --chat-template and request chat_template for every native renderer with dedicated errors, so the GLM renderer no longer needs its own checks reporting them as template-thrown errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCcGvxthRCnUBx9uvW3oU5
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@Isotr0py

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #97961 for commit 5ce9826f5c5c.

ℹ️ This PR is 1 commit behind upstream main. Merged upstream main into this branch as 5ce9826f5c5c before starting CI. Pull the branch before pushing more changes.

github-actions Bot added a commit to vllm-project/recipes that referenced this pull request Oct 29, 2026
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Isotr0py
Isotr0py enabled auto-merge (squash) October 30, 2026 05:04
@Isotr0py

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #98574 for commit 2c393c6cd53e.

ℹ️ This PR is 29 commits behind upstream main. Merged upstream main into this branch as 2c393c6cd53e before starting CI. Pull the branch before pushing more changes.

github-actions Bot added a commit to vllm-project/recipes that referenced this pull request Oct 30, 2026
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Isotr0py
Isotr0py merged commit d14f72c into vllm-project:main Oct 30, 2026
183 checks passed
vllm-recipes-publisher Bot pushed a commit to vllm-project/recipes that referenced this pull request Oct 30, 2026
vllm-project/vllm@main:recipes d0d3005affa3 → d14f72c7fe13 [latest.vllm]
vllm-project/vllm@d0d3005...d14f72c

Commits:
- vllm-project/vllm@d14f72c7fe13 [Rust Frontend] Add native GLM-5.3 / GLM-5.3-Flash chat rendering (vllm-project/vllm#62424)

Recipes:
- zai-org/GLM-5.3-Flash (modified): https://recipes.vllm.ai/zai-org/GLM-5.3-Flash
- zai-org/GLM-5.3 (modified): https://recipes.vllm.ai/zai-org/GLM-5.3

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit to Yogaraj-Alamenda/recipes that referenced this pull request Oct 30, 2026
vllm-project/vllm@main:recipes f81a414faed6 → a20280f30e31 [latest.vllm]
vllm-project/vllm@f81a414...a20280f

Commits:
- vllm-project/vllm@d14f72c7fe13 [Rust Frontend] Add native GLM-5.3 / GLM-5.3-Flash chat rendering (vllm-project/vllm#62424)
- vllm-project/vllm@d0d3005affa3 [Doc] Kimi-K3: move the GB300 AgentX presets to the Oct 26 points with KV-balanced decode (vllm-project/vllm#64665)

Recipes:
- moonshotai/Kimi-K3 (modified): https://recipes.vllm.ai/moonshotai/Kimi-K3
- zai-org/GLM-5.3-Flash (modified): https://recipes.vllm.ai/zai-org/GLM-5.3-Flash
- zai-org/GLM-5.3 (modified): https://recipes.vllm.ai/zai-org/GLM-5.3

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit to yiminghub2024/recipes that referenced this pull request Oct 30, 2026
vllm-project/vllm@main:recipes f81a414faed6 → 617135eed34b [latest.vllm]
vllm-project/vllm@f81a414...617135e

Commits:
- vllm-project/vllm@d14f72c7fe13 [Rust Frontend] Add native GLM-5.3 / GLM-5.3-Flash chat rendering (vllm-project/vllm#62424)
- vllm-project/vllm@d0d3005affa3 [Doc] Kimi-K3: move the GB300 AgentX presets to the Oct 26 points with KV-balanced decode (vllm-project/vllm#64665)

Recipes:
- moonshotai/Kimi-K3 (modified): https://recipes.vllm.ai/moonshotai/Kimi-K3
- zai-org/GLM-5.3-Flash (modified): https://recipes.vllm.ai/zai-org/GLM-5.3-Flash
- zai-org/GLM-5.3 (modified): https://recipes.vllm.ai/zai-org/GLM-5.3

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit to monkeyLoveding/recipes that referenced this pull request Oct 30, 2026
…mni@cda4a1ef83b2

vllm-project/vllm@main:recipes 8084f0624dba → 24420b7a341a [latest.vllm]
vllm-project/vllm@8084f06...24420b7

Commits:
- vllm-project/vllm@d14f72c7fe13 [Rust Frontend] Add native GLM-5.3 / GLM-5.3-Flash chat rendering (vllm-project/vllm#62424)
- vllm-project/vllm@d0d3005affa3 [Doc] Kimi-K3: move the GB300 AgentX presets to the Oct 26 points with KV-balanced decode (vllm-project/vllm#64665)

Recipes:
- moonshotai/Kimi-K3 (modified): https://recipes.vllm.ai/moonshotai/Kimi-K3
- zai-org/GLM-5.3-Flash (modified): https://recipes.vllm.ai/zai-org/GLM-5.3-Flash
- zai-org/GLM-5.3 (modified): https://recipes.vllm.ai/zai-org/GLM-5.3

vllm-project/vllm-omni@main:recipes e45e43bcc1d4 → cda4a1ef83b2 [latest.vllm-omni]
vllm-project/vllm-omni@e45e43b...cda4a1e

Commits:
- vllm-project/vllm-omni@b5a6fd836185 [Model] MiniMax-H3: Continue a previous video from cached latents across requests (vllm-project/vllm-omni#9342)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@zRzRzRzRzRzRzR
zRzRzRzRzRzRzR deleted the glm53 branch November 1, 2026 23:34

This branch was previously deployed

1 inactive deployment
recipes-preview — 2c393c6c Deployed Oct 30, 2026 by Isotr0py via dispatch #186
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 glm ready ONLY add when PR is ready to merge/full CI is needed recipe rust tool-calling

Projects

Status: Unsorted queue

Development

Successfully merging this pull request may close these issues.

4 participants