Skip to content

[Frontend] Support strict MiMo-V2.6 tool calling - #58019

Merged
BugenZhao merged 3 commits into
vllm-project:mainfrom
Ubospica:feat/mimo-v26-xgrammar-schema
Sep 29, 2026
Merged

BugenZhao merged 3 commits into
vllm-project:mainfrom
Ubospica:feat/mimo-v26-xgrammar-schema

Conversation

@Ubospica

@Ubospica Ubospica commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

MiMo-V2.6 Pro/Flash emit compact XML tool calls, but --tool-call-parser mimo currently selects Qwen3-Coder structural tags with mandatory newlines. Strict required/named calls therefore use the wrong wire format. The Qwen argument converter also removes a leading/trailing newline that MiMo emits as part of the string value.

Introduce a MiMo variant of the existing parser engine that preserves parameter whitespace, with a thin tool adapter selecting mimo structural tags. Prefer the new XGrammar builtin (mlc-ai/xgrammar#916); keep a schema-constrained compatibility builder for the currently pinned 0.2.7 wheel. Honor parallel_tool_calls=False, retain server/per-tool strictness controls, and leave reasoning to the serving gate. No dependency change is required.

The shared registry change only declares the supported key. MiMo parsing and compatibility behavior live in the model's own modules. Document the existing --tool-call-parser mimo --reasoning-parser mimo --enable-auto-tool-choice flags and strictness options.

Duplicate-work check: open #54393 and #57933 add Rust frontend MiMo support. This PR changes the Python parser/structural-tag path; neither existing PR covers it. Also searched open MiMo/XGrammar/strict-tool PRs before submission.

Test Plan

.venv/bin/python -m pytest -q \
  tests/tool_parsers/test_structural_tag_registry.py \
  tests/parser/engine/test_qwen3.py \
  tests/parser/engine/test_qwen3_reasoning.py \
  tests/parser/engine/test_deepseek_v41.py --tb=short
.venv/bin/pre-commit run --files <changed files>

The local environment used the current checkout plus an isolated XGrammar build. Repeated MiMo cases with the actual 0.2.7 wheel first on PYTHONPATH. Supplemental replay loads revision-pinned official tokenizers, renders chat-template completions, checks each native token mask and EOS boundary, and parses the resulting calls in both non-streaming and token-streaming modes.

Test Result

  • Development XGrammar: 340 passed. Pre-commit passed.
  • Actual XGrammar 0.2.7 wheel, MiMo subset (-k mimo across the registry/Qwen parser suites): 34 passed, no skipped native tests.
  • Official-template protocol replay with both development XGrammar and 0.2.7: 36 cases and 2,776 next-token masks per run, all passed. Covers both checkpoints, reasoning on/off, auto/required/named choice, multiple calls, nullable values, nested JSON, verbatim strings, and non-strict parameters.

Official revisions:

  • XiaomiMiMo/MiMo-V2.6-Pro-RL@54b10491b1811c76aa9681a9d0ff872396a4064c
  • XiaomiMiMo/MiMo-V2.6-Flash-RL@3b38d063180c3e4aed9691fdc735f3d10b266ee4

These are CPU grammar/parser protocol evaluations. Model weights were not loaded; inference accuracy/throughput was not measured. No model layers or kernels changed.

AI assistance: Codex implemented the change, ran local validation, and prepared this draft. Human line-by-line review and independent test execution are pending.

CI after submission: DCO passed. The upstream pre-run gate requires a verified/ready label or at least four merged contributions (the gate reports one), so remote pre-commit has not run. Local pre-commit and tests passed. The gate explicitly asks AI agents not to request authorization labels.

Use compact XML structural tags with a schema-constrained 0.2.7 fallback. Preserve raw parameter whitespace through the MiMo parser and honor single-call requests.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Ubospica <ubospica@gmail.com>
@mergify

mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--58019.org.readthedocs.build/en/58019/

@mergify mergify Bot added documentation Improvements or additions to documentation qwen Related to Qwen models tool-calling labels Sep 21, 2026
@Ubospica
Ubospica marked this pull request as ready for review September 24, 2026 06:39

@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.

Signed-off-by: yuchuan <yuchuan.7streams@gmail.com>
@mergify mergify Bot added ci/build rocm Related to AMD ROCm labels Sep 25, 2026
@mergify mergify Bot added the cpu Related to CPU backends label Sep 25, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Sep 25, 2026
@mergify

mergify Bot commented Sep 25, 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, @Ubospica.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>

@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.

LGTM, thanks @Ubospica

I'm also syncing the Rust library with upstream v0.2.8 to enable the correct whitespace grammar there in #59148.

@BugenZhao BugenZhao added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 29, 2026
@BugenZhao

Copy link
Copy Markdown
Member

/ci run --allow-stale

@github-actions

Copy link
Copy Markdown

✅ @Ubospica, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • Your branch must contain every commit currently on its upstream target branch. Merge or rebase onto the latest target branch, then rerun the command. Append --allow-stale to a run command to test an outdated branch at your own risk.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #91771 for commit 5c28553f391f.

⚠️ This PR is 1 commit behind upstream main. Running CI at your own risk because --allow-stale was requested; outdated CI configuration may cause failures. Before merging, merge or rebase onto the latest main, then rerun /ci run on the latest PR commit.

@BugenZhao
BugenZhao enabled auto-merge (squash) September 29, 2026 07:21
@mergify mergify Bot removed the needs-rebase label Sep 29, 2026
@chaunceyjiang

Copy link
Copy Markdown
Contributor

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 1 failed job(s) for retry in Buildkite CI #91771.

@BugenZhao
BugenZhao merged commit dfc8e0f into vllm-project:main Sep 29, 2026
447 of 448 checks passed
sfeng33 added a commit to Ostring24/vllm that referenced this pull request Sep 29, 2026
The previous commit bounds the generic JSON schema, but parsers with a
structural_tag_model install a structural tag first and never reach it,
so with VLLM_ENFORCE_STRICT_TOOL_CALLING=1 (the default) the grammar
still allowed any number of calls.

When parallel_tool_calls is false, DelegatingParser._apply_structural_tag
now sets stop_after_first on every tool-call list in the tag, and raises
the strict level to at least FUNCTION so auto with non-strict tools gets
the call envelope in the grammar. This covers every tag builder,
including hy_v4, which overrides get_structural_tag without super(), and
replaces the MiMo-only override from vllm-project#58019.

The Responses API has no post-hoc filter, so for structural-tag parsers
this is now its only enforcement.

Signed-off-by: sfeng33 <4florafeng@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends documentation Improvements or additions to documentation qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm tool-calling

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants