Skip to content

[perf] [xgrammar] Import structural tag from xgrammar's builtin structural tag templates#43678

Closed
cjackal wants to merge 4 commits into
vllm-project:mainfrom
cjackal:import-xgrammar-builtin-stag
Closed

[perf] [xgrammar] Import structural tag from xgrammar's builtin structural tag templates#43678
cjackal wants to merge 4 commits into
vllm-project:mainfrom
cjackal:import-xgrammar-builtin-stag

Conversation

@cjackal

@cjackal cjackal commented May 26, 2026

Copy link
Copy Markdown
Contributor

Purpose

Stacked on #42904

I'd like this PR to be a migration-only change (no behavioral change / new model support) for the ease of review and to exploit the pre-existing unit tests. Further expanding the supported models is left as a follow-up, but as I mentioned above it is kind of trivial.

Test Plan

Check that existing unit tests pass.

Test Result

(To be updated after CI runs)


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.

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

Copy link
Copy Markdown
Contributor

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 updates the xgrammar dependency from 0.2.0 to 0.2.1 and refactors the structural tag registry to delegate model-specific structural tag building directly to xgrammar. It also enables support for patternProperties and propertyNames in JSON schemas, removing previous workarounds and updating tests accordingly. One review comment suggests adding defensive checks when calling model_dump on tools and tool choices to prevent potential AttributeErrors when raw dictionaries are passed.

Comment thread vllm/tool_parsers/structural_tag_registry.py
@cjackal

cjackal commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

cc. @Seven-Streams @Ubospica if this PR befits what xgrammar team had in mind

cjackal added 4 commits June 4, 2026 15:46
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
@cjackal cjackal force-pushed the import-xgrammar-builtin-stag branch from 7cb07cf to 20364c2 Compare June 4, 2026 15:47
@mergify

mergify Bot commented Jun 12, 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, @cjackal.

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

@mergify mergify Bot added the needs-rebase label Jun 12, 2026
@cjackal cjackal closed this Jun 12, 2026
@cjackal cjackal deleted the import-xgrammar-builtin-stag branch June 13, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant