Skip to content

Conversation

russellb
Copy link
Member

@russellb russellb commented Feb 13, 2025

We already support this in V1. This is just low hanging fruit to enable in V0 as well.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

Would it be a good idea to check xgrammar version and print out warning if they are using an old version?

@russellb
Copy link
Member Author

Would it be a good idea to check xgrammar version and print out warning if they are using an old version?

hm, I'm not sure we do that other places. We just assume the code has what we express is required in the requirements files. You're on your own if you veer outside of that!

Copy link

mergify bot commented Feb 15, 2025

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

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 Feb 15, 2025
Copy link

@Ubospica Ubospica left a comment

Choose a reason for hiding this comment

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

I think it should work fine with xgrammar. Thanks @russellb !

@mergify mergify bot removed the needs-rebase label Feb 18, 2025
@russellb russellb marked this pull request as ready for review February 18, 2025 02:08
@russellb russellb requested a review from mgoin as a code owner February 18, 2025 02:08
@russellb russellb marked this pull request as draft February 18, 2025 02:35
@russellb
Copy link
Member Author

marked as a draft again as the pin to 0.1.11 is intentional to avoid a bug introduced in 0.1.13. I'll revisit this again after a release that resolves the bug in question.

#13338

@russellb russellb changed the title [Core] Enable regex support with xgrammar [Core][V0] Enable regex support with xgrammar Mar 11, 2025
Copy link

mergify bot commented Mar 11, 2025

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

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 Mar 11, 2025
@russellb
Copy link
Member Author

This should be ready now

@russellb russellb marked this pull request as ready for review March 11, 2025 17:16
@mergify mergify bot removed the needs-rebase label Mar 11, 2025
@aarnphm
Copy link
Collaborator

aarnphm commented Mar 16, 2025

superseded by #14868

@aarnphm aarnphm closed this Mar 16, 2025
@aarnphm aarnphm reopened this Mar 17, 2025
@russellb russellb added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 17, 2025
@simon-mo
Copy link
Collaborator

Removing this from v0.8.0 because it is not a bugfix. We will release another version soon for features.

@simon-mo simon-mo removed this from the v0.8.0 milestone Mar 17, 2025
@aarnphm
Copy link
Collaborator

aarnphm commented Mar 17, 2025

wfm. we can have more time to fix bugs instead of rushing it in.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables regex support in xgrammar by updating the grammar configuration and modifying the guided decoding logic. Key changes include adding a new regex_str field to GrammarConfig, adding a branch to handle regex-guided decoding in from_guided_params and _ensure_ctx, and updating test cases and fallback logic accordingly.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
vllm/model_executor/guided_decoding/xgrammar_decoding.py Adds regex_str to configuration, handles regex-guided decoding in from_guided_params and _ensure_ctx
vllm/model_executor/guided_decoding/init.py Removes fallback check for regex support in favor of JSON validation
tests/entrypoints/llm/test_guided_generate.py Updates tests to verify failure when unsupported JSON schema features are provided
Comments suppressed due to low confidence (1)

vllm/model_executor/guided_decoding/xgrammar_decoding.py:253

  • To prevent ambiguity when multiple guided decoding options are provided, consider validating that only one of grammar, json, or regex is set in guided_params.
elif guided_params.regex:

Copy link

mergify bot commented Apr 3, 2025

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

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 Apr 3, 2025
@mergify mergify bot removed the needs-rebase label Apr 8, 2025
@russellb russellb requested review from mgoin and removed request for mgoin April 8, 2025 20:10
Now that we're on a new enough version of xgrammar, this can be turned
on.

Signed-off-by: Russell Bryant <[email protected]>
@DarkLight1337 DarkLight1337 merged commit dc1b4a6 into vllm-project:main Apr 14, 2025
42 checks passed
@Ubospica
Copy link

Thanks for your awesome work! @russellb @aarnphm @simon-mo @DarkLight1337

yangw-dev pushed a commit to yangw-dev/vllm that referenced this pull request Apr 21, 2025
heyselbi pushed a commit to red-hat-data-services/vllm that referenced this pull request Apr 24, 2025
SUMMARY:

sync to upstream `v0.8.4` and cherry-pick of
`7eb42556281d30436a3a988f2c9184ec63c59338`. the cherry-pick is
@LucasWilkinson 's llama4 patch.

GIT LOG:
```bash
commit b197179 (HEAD -> sync-upstream-v0.8.4, origin/sync-upstream-v0.8.4)
Author: Lucas Wilkinson <[email protected]>
Date:   Fri Apr 18 01:13:29 2025 -0400

    [BugFix] Accuracy fix for llama4 int4 - improperly casted scales (vllm-project#16801)
    
    Signed-off-by: Lucas Wilkinson <[email protected]>

commit 60267cc
Author: andy-neuma <[email protected]>
Date:   Mon Apr 21 14:57:52 2025 -0400

    remove duplicate entries

commit 9d18b50
Merge: db0e117 dc1b4a6
Author: andy-neuma <[email protected]>
Date:   Mon Apr 21 14:50:01 2025 -0400

    Merge remote-tracking branch 'upstream/v0.8.4' into sync-upstream-v0.8.4

commit db0e117
Author: andy-neuma <[email protected]>
Date:   Mon Apr 21 14:35:23 2025 -0400

    Revert "Revert "[V1] DP scale-out (1/N): Use zmq ROUTER/DEALER sockets for input queue (vllm-project#15906)""
    
    This reverts commit 296c657.

commit dc1b4a6 (tag: v0.8.4, upstream/v0.8.4)
Author: Russell Bryant <[email protected]>
Date:   Sun Apr 13 22:13:38 2025 -0400

    [Core][V0] Enable regex support with xgrammar (vllm-project#13228)
    
    Signed-off-by: Russell Bryant <[email protected]>
```

COMMANDS:
```bash
git fetch upstream
git checkout -b sync-upstream-v0.8.4
git revert 296c657
git merge upstream/v0.8.4
git cherry-pick 7eb4255
```

TEST PLAN:

accept sync ...
https://github.com/neuralmagic/nm-cicd/actions/runs/14581880024

release ...
https://github.com/neuralmagic/nm-cicd/actions/runs/14596026989

---------

Signed-off-by: Tristan Leclercq <[email protected]>
Signed-off-by: yihong0618 <[email protected]>
Signed-off-by: reidliu41 <[email protected]>
Signed-off-by: Harry Mellor <[email protected]>
Signed-off-by: chaunceyjiang <[email protected]>
Signed-off-by: Jinzhen Lin <[email protected]>
Signed-off-by: Jonghyun Choe <[email protected]>
Signed-off-by: Lu Fang <[email protected]>
Signed-off-by: Hyesoo Yang <[email protected]>
Signed-off-by: Ben Jackson <[email protected]>
Signed-off-by: Roger Wang <[email protected]>
Signed-off-by: Isotr0py <[email protected]>
Signed-off-by: rongfu.leng <[email protected]>
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
Signed-off-by: paolovic <[email protected]>
Signed-off-by: Chengji Yao <[email protected]>
Signed-off-by: Kay Yan <[email protected]>
Signed-off-by: Woosuk Kwon <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: shen-shanshan <[email protected]>
Signed-off-by: YamPengLi <[email protected]>
Signed-off-by: WangErXiao <[email protected]>
Signed-off-by: Aston Zhang <[email protected]>
Signed-off-by: Chris Thi <[email protected]>
Signed-off-by: drisspg <[email protected]>
Signed-off-by: Jon Swenson <[email protected]>
Signed-off-by: Keyun Tong <[email protected]>
Signed-off-by: Lu Fang <[email protected]>
Signed-off-by: Xiaodong Wang <[email protected]>
Signed-off-by: Yang Chen <[email protected]>
Signed-off-by: Ye (Charlotte) Qi <[email protected]>
Signed-off-by: Yong Hoon Shin <[email protected]>
Signed-off-by: Zijing Liu <[email protected]>
Signed-off-by: Lu Fang <[email protected]>
Signed-off-by: Lucia Fang <[email protected]>
Signed-off-by: Gregory Shtrasberg <[email protected]>
Signed-off-by: NickLucche <[email protected]>
Signed-off-by: Benjamin Chislett <[email protected]>
Signed-off-by: Nick Hill <[email protected]>
Signed-off-by: Leon Seidel <[email protected]>
Signed-off-by: mgoin <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: Miles Williams <[email protected]>
Signed-off-by: mgoin <[email protected]>
Signed-off-by: Siyuan Liu <[email protected]>
Signed-off-by: Kebe <[email protected]>
Signed-off-by: simon-mo <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Tianyuan Wu <[email protected]>
Signed-off-by: imkero <[email protected]>
Signed-off-by: Lucas Wilkinson <[email protected]>
Signed-off-by: Russell Bryant <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Yue <[email protected]>
Signed-off-by: tjtanaa <[email protected]>
Signed-off-by: kliuae <[email protected]>
Signed-off-by: luka <[email protected]>
Signed-off-by: lvfei.lv <[email protected]>
Signed-off-by: Ajay Vohra <[email protected]>
Signed-off-by: Guillaume Calmettes <[email protected]>
Signed-off-by: zh Wang <[email protected]>
Signed-off-by: Chendi Xue <[email protected]>
Signed-off-by: Joe Runde <[email protected]>
Signed-off-by: zRzRzRzRzRzRzR <[email protected]>
Signed-off-by: Aaron Ang <[email protected]>
Signed-off-by: Benjamin Kitor <[email protected]>
Signed-off-by: Michael Goin <[email protected]>
Signed-off-by: Chenyaaang <[email protected]>
Signed-off-by: cyy <[email protected]>
Signed-off-by: wineandchord <[email protected]>
Signed-off-by: LiuXiaoxuanPKU <[email protected]>
Signed-off-by: Chih-Chieh-Yang <[email protected]>
Signed-off-by: look <[email protected]>
Signed-off-by: jadewang21 <[email protected]>
Signed-off-by: alexey-belyakov <[email protected]>
Signed-off-by: jiang.li <[email protected]>
Signed-off-by: DefTruth <[email protected]>
Signed-off-by: chaow <[email protected]>
Signed-off-by: Tomasz Zielinski <[email protected]>
Signed-off-by: rzou <[email protected]>
Signed-off-by: Travis Johnson <[email protected]>
Signed-off-by: Christian Sears <[email protected]>
Signed-off-by: Gogs <[email protected]>
Signed-off-by: Yuan Tang <[email protected]>
Signed-off-by: Tianer Zhou <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Jie Fu <[email protected]>
Signed-off-by: snowcharm <[email protected]>
Signed-off-by: Ryan McConville <[email protected]>
Co-authored-by: Tristan Leclercq <[email protected]>
Co-authored-by: Kevin H. Luu <[email protected]>
Co-authored-by: yihong <[email protected]>
Co-authored-by: Reid <[email protected]>
Co-authored-by: reidliu41 <[email protected]>
Co-authored-by: Harry Mellor <[email protected]>
Co-authored-by: Chauncey <[email protected]>
Co-authored-by: Jinzhen Lin <[email protected]>
Co-authored-by: Jonghyun Choe <[email protected]>
Co-authored-by: Lucia Fang <[email protected]>
Co-authored-by: Hyesoo Yang <[email protected]>
Co-authored-by: Ben Jackson <[email protected]>
Co-authored-by: Roger Wang <[email protected]>
Co-authored-by: Paul Schweigert <[email protected]>
Co-authored-by: Isotr0py <[email protected]>
Co-authored-by: rongfu.leng <[email protected]>
Co-authored-by: Varun Sundar Rabindranath <[email protected]>
Co-authored-by: Varun Sundar Rabindranath <[email protected]>
Co-authored-by: paolovic <[email protected]>
Co-authored-by: paolovic <[email protected]>
Co-authored-by: Chengji Yao <[email protected]>
Co-authored-by: Woosuk Kwon <[email protected]>
Co-authored-by: Martin Hoyer <[email protected]>
Co-authored-by: Kay Yan <[email protected]>
Co-authored-by: Cyrus Leung <[email protected]>
Co-authored-by: Shanshan Shen <[email protected]>
Co-authored-by: YamPengLi <[email protected]>
Co-authored-by: Cyrus Leung <[email protected]>
Co-authored-by: Robin <[email protected]>
Co-authored-by: Lu Fang <[email protected]>
Co-authored-by: Lu Fang <[email protected]>
Co-authored-by: Roger Wang <[email protected]>
Co-authored-by: Gregory Shtrasberg <[email protected]>
Co-authored-by: Nicolò Lucchesi <[email protected]>
Co-authored-by: Benjamin Chislett <[email protected]>
Co-authored-by: Nick Hill <[email protected]>
Co-authored-by: leon-seidel <[email protected]>
Co-authored-by: Driss Guessous <[email protected]>
Co-authored-by: Michael Goin <[email protected]>
Co-authored-by: youkaichao <[email protected]>
Co-authored-by: Miles Williams <[email protected]>
Co-authored-by: Satyajith Chilappagari <[email protected]>
Co-authored-by: mgoin <[email protected]>
Co-authored-by: Jennifer Zhao <[email protected]>
Co-authored-by: zxfan-cpu <[email protected]>
Co-authored-by: Yong Hoon Shin <[email protected]>
Co-authored-by: Siyuan Liu <[email protected]>
Co-authored-by: Kebe <[email protected]>
Co-authored-by: Simon Mo <[email protected]>
Co-authored-by: Alex Brooks <[email protected]>
Co-authored-by: TY-AMD <[email protected]>
Co-authored-by: wang.yuqi <[email protected]>
Co-authored-by: Kero Liang <[email protected]>
Co-authored-by: Lucas Wilkinson <[email protected]>
Co-authored-by: Russell Bryant <[email protected]>
Co-authored-by: Jee Jee Li <[email protected]>
Co-authored-by: yueshen2016 <[email protected]>
Co-authored-by: TJian <[email protected]>
Co-authored-by: Hongxia Yang <[email protected]>
Co-authored-by: kliuae <[email protected]>
Co-authored-by: Luka Govedič <[email protected]>
Co-authored-by: Accelerator1996 <[email protected]>
Co-authored-by: ajayvohra2005 <[email protected]>
Co-authored-by: Guillaume Calmettes <[email protected]>
Co-authored-by: zh Wang <[email protected]>
Co-authored-by: Chendi.Xue <[email protected]>
Co-authored-by: Joe Runde <[email protected]>
Co-authored-by: Yuxuan Zhang <[email protected]>
Co-authored-by: Aaron Ang <[email protected]>
Co-authored-by: Jintao <[email protected]>
Co-authored-by: Benjamin Kitor <[email protected]>
Co-authored-by: Chenyaaang <[email protected]>
Co-authored-by: cyyever <[email protected]>
Co-authored-by: Ye (Charlotte) Qi <[email protected]>
Co-authored-by: wineandchord <[email protected]>
Co-authored-by: Nicolò Lucchesi <[email protected]>
Co-authored-by: Lily Liu <[email protected]>
Co-authored-by: Chih-Chieh Yang <[email protected]>
Co-authored-by: Yu Chin Fabian Lim <[email protected]>
Co-authored-by: look <[email protected]>
Co-authored-by: WWW <[email protected]>
Co-authored-by: Alexey Belyakov <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: DefTruth <[email protected]>
Co-authored-by: chaow-amd <[email protected]>
Co-authored-by: Tomasz Zielinski <[email protected]>
Co-authored-by: Richard Zou <[email protected]>
Co-authored-by: Travis Johnson <[email protected]>
Co-authored-by: Kai Wu <[email protected]>
Co-authored-by: Christian Sears <[email protected]>
Co-authored-by: Gogs <[email protected]>
Co-authored-by: Yuan Tang <[email protected]>
Co-authored-by: Tianer Zhou <[email protected]>
Co-authored-by: Huazhong Ji <[email protected]>
Co-authored-by: Jie Fu (傅杰) <[email protected]>
Co-authored-by: SnowCharm <[email protected]>
Co-authored-by: Ryan McConville <[email protected]>
Co-authored-by: andy-neuma <[email protected]>
jikunshang pushed a commit to jikunshang/vllm that referenced this pull request Apr 29, 2025
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Apr 29, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build ready ONLY add when PR is ready to merge/full CI is needed structured-output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants