- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10.9k
[V1][Feature] Enable Speculative Decoding with Structured Outputs #14702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V1][Feature] Enable Speculative Decoding with Structured Outputs #14702
Conversation
…her.rollback) Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
… decoding Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
| 👋 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  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  🚀 | 
| This pull request has merge conflicts that must be resolved before it can be | 
…-outputs Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
| 
 Yeah, I'm good with it. I just wanted to give @WoosukKwon a chance to do a final review, given that it touches such sensitive code. | 
| also this needs to be updated against  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|  | ||
| def gen_prompt(index: int): | ||
| return f"Generate an example of a user profile given the following schema: {json.dumps(get_schema(index))}" # noqa: E501 | ||
| return f"Generate an example of a brief user profile given the following schema: {json.dumps(get_schema(index))}" # noqa: E501 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some models are endlessly repeating outputs on the benchmark prompt. this tweak was enough to tip the scales
| This pull request has merge conflicts that must be resolved before it can be | 
| @benchislett Thanks for the PR. Could you please merge from main? That will fix the docker build error. | 
…-decoding-with-structured-outputs Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai>
| merged again. | 
| Thank you for the hard work on this PR! | 
…lm-project#14702) Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai> Signed-off-by: Benjamin Chislett <chislett.ben@gmail.com>
…lm-project#14702) Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai> Signed-off-by: Benjamin Chislett <chislett.ben@gmail.com> Signed-off-by: Mu Huai <tianbowen.tbw@antgroup.com>
…lm-project#14702) Signed-off-by: Benjamin Chislett <benjamin.chislett@centml.ai> Signed-off-by: Benjamin Chislett <chislett.ben@gmail.com> Signed-off-by: Yuqi Zhang <yuqizhang@google.com>
…ar_bitmask` method (#2022) ### What this PR does / why we need it? Fix #2033 Sync vllm-project/vllm#14702 to solve `grammar_bitmask` IndexError caused by outdated `apply_grammar_bitmask` method ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Tested by upstream vllm - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@6e599ee Signed-off-by: ApsarasX <apsarax@outlook.com>
…rammar_bitmask` method (#2314) ### What this PR does / why we need it? Fix #2033 Sync vllm-project/vllm#14702 to solve `grammar_bitmask` IndexError caused by outdated `apply_grammar_bitmask` method ### Does this PR introduce _any_ user-facing change? No Signed-off-by: shen-shanshan <467638484@qq.com>
…ar_bitmask` method (vllm-project#2022) ### What this PR does / why we need it? Fix vllm-project#2033 Sync vllm-project/vllm#14702 to solve `grammar_bitmask` IndexError caused by outdated `apply_grammar_bitmask` method ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Tested by upstream vllm - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@6e599ee Signed-off-by: ApsarasX <apsarax@outlook.com>
…ar_bitmask` method (vllm-project#2022) ### What this PR does / why we need it? Fix vllm-project#2033 Sync vllm-project/vllm#14702 to solve `grammar_bitmask` IndexError caused by outdated `apply_grammar_bitmask` method ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Tested by upstream vllm - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@6e599ee Signed-off-by: ApsarasX <apsarax@outlook.com>
This PR changes the structured outputs behaviour in a few ways:
I also tweaked the benchmark file to fix some minor issues I had when running it locally, as well as modifying the prompt slightly to discourage infinite repetition when
temperature==0. After this fix, I get 100% correctness when benchmarking with speculative decoding enabled.NOTE: This PR is now compatible with both xGrammar and Guidance backends in V1.