Repository navigation
[Frontend] Add the Beam reasoning and tool parsers - #62052
Merged
Merged
Conversation
Preparation for Reflection Beam (#61978). Adds `--reasoning-parser beam` and `--tool-call-parser beam` in Python and the Rust frontend. Like `hf`, they parse with the checkpoint's `response_template` metadata; unlike `hf`, they derive a structural-tag grammar from the template to constrain tool calls, tool choice and structured outputs. ParserManager now selects any response-template parser, not only `hf`. The renderer gives the parser the prompt token IDs before `adjust_request`. Co-authored-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> Co-authored-by: neilkg <33635204+neilkg@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
WoosukKwon
requested review from
BugenZhao,
DarkLight1337,
aarnphm,
bbrowning,
chaunceyjiang,
njhill and
sfeng33
as code owners
October 16, 2026 17:31
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
|
Documentation preview: https://vllm--62052.org.readthedocs.build/en/62052/ |
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #95456 for commit |
6 tasks done
WoosukKwon
added a commit
that referenced
this pull request
Oct 16, 2026
Adds Beam-1.0 (BeamForCausalLM, 501B total / 23B active, NVFP4) and its DFlash2 drafter (DFlash2BeamDraftModel), with model-local Blackwell kernels under vllm/models/beam/nvidia: attention, fused all-reduce + norms, and DFlash2 context ops. FusedMoEConfig.defer_moe_finalize gains allow_ep so that a consumer that reduces across a replicated-token EP group can take the TRTLLM-Gen top-k finalize under TP=1, EP>1. Builds on #62042 (router GEMMs, BF16 ll_bf16_gemm output), whose commit is included below this one. The beam reasoning/tool parsers are in #62052; MegaMoE support follows in #62073. Co-authored-by: Lain <fusiyuan2000@gmail.com> Co-authored-by: kaiwu-reflection <kai@reflection.ai> Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
WoosukKwon
added a commit
that referenced
this pull request
Oct 16, 2026
Adds Beam-1.0 (BeamForCausalLM, 501B total / 23B active, NVFP4) and its DFlash2 drafter (DFlash2BeamDraftModel), with model-local Blackwell kernels under vllm/models/beam/nvidia: attention, fused all-reduce + norms, and DFlash2 context ops. FusedMoEConfig.defer_moe_finalize gains allow_ep so that a consumer that reduces across a replicated-token EP group can take the TRTLLM-Gen top-k finalize under TP=1, EP>1. Builds on #62042 (router GEMMs, BF16 ll_bf16_gemm output), whose commit is included below this one. The beam reasoning/tool parsers are in #62052; MegaMoE support follows in #62073. Co-authored-by: Lain <fusiyuan2000@gmail.com> Co-authored-by: kaiwu-reflection <kai@reflection.ai> Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
6 tasks done
6 tasks done
kotwal-itpro
added a commit
to kotwal-itpro/vllm
that referenced
this pull request
Oct 17, 2026
vllm-project#62052 replaced ResponseTemplateParser.count_reasoning_tokens, which used to return 0 for --reasoning-parser hf. Add unit tests for the four cases usage depends on: a closed thinking region, a region opened by the prompt, an unclosed region, and no thinking at all. Delimiters are not counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ZBQVsXRmKT8WXDr2qSfbd Signed-off-by: Ankur Kotwal <kotwal.itpro@gmail.com>
12 tasks done
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
Signed-off-by: Woosuk Kwon <woosuk@inferact.ai> Co-authored-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> Co-authored-by: neilkg <33635204+neilkg@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
Second slice of #61978 (Reflection Beam), after #62042: the
beamreasoning and tool parsers, in Python and in the Rust frontend. They take effect only with--reasoning-parser beamor--tool-call-parser beam. This does not enable the model end to end.Claims
--reasoning-parser beamand--tool-call-parser beamparse output with the checkpoint'sresponse_templatemetadata, ashfdoes. They also derive a structural-tag grammar from the template, which constrains:VLLM_BEAM_ALWAYS_CONSTRAIN_OUTPUT=0turns this off.docs/features/tool_calling.mddocuments the parser.Validation
Results on this branch next to upstream main (fa75d34), on the same machine:
pytest tests/parser tests/reasoning tests/tool_parsers --ignore=tests/parser/coherecargo test -p vllm-parsercargo test -p vllm-chat --libtests/parser/mistraland the Step-3.5 parser tests, because their tokenizers can't be downloaded into the read-only shared HF cache.vllm-chatroundtripandgrammar_replaytests, because they need write access to a lock file or that same HF cache.tests/parser/cohereneeds the optionalcohere_melodypackage, which isn't installed here.Details
ParserManagernow picks any response-template parser, not justhf. A parser opts in throughunified_parser_cls(). Thehfbehavior is unchanged except for error messages, which now name the selected flags.OnlineRendererpasses the prompt token IDs to the parser beforeadjust_request. Beam needs this to see whether the prompt already opened reasoning or an answer. Only the response-template parsers (hf,beam) overrideset_prompt_token_ids; for all other parsers the base class method does nothing.ResponsesRequestgets two private attributes, so a parser-built grammar can replacetext.formatwithout changing the request's public fields.hf:vllm/parser/response_template_grammar.py) and the Rustbeamparser.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.
🤖 Generated with Claude Code