Add guided grammar model setting#995
Open
MrNiceRicee wants to merge 1 commit intojundot:mainfrom
Open
Conversation
Author
|
I tested this locally on Qwen3.6-27B-MLX-8bit; grammar-constrained run reduced output from 400 tokens / 29.4s to 94 tokens / 7.6s on one coding prompt. got the idea from if possible, would love to have a guided grammar setting |
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.
Summary
Adds guided grammar support as a first-class model setting in the admin dashboard.
This exposes a generic
guided_grammarcontrol without adding model-specific presets. The request path normalizesguided_grammarinto the existingstructured_outputs.grammarflow, so constrained decoding continues to use the current xgrammar-backed implementation.Changes
guided_grammarrequest field as a compatibility aliasguided_grammar_enabledandguided_grammarto persisted model settings/admin/api/modelsand model settings update APIpreserve_thinkingas profile-excluded to keep model settings field classification completeNotes
Actual constrained decoding still requires the optional grammar dependency,
xgrammar, as before. Without it, structured output requests return the existing dependency error.Validation
14 passedfocused guided grammar tests71 passedsettings/profile regression tests157 passednearby request/admin/settings suite59 passed, 3 skipped, 5 deselectedgrammar suite excluding optional structural-tag patch testsgit diff --check