Repository navigation
native: add opt-in GBNF constraints to existing generation - #636
Closed
CC-David-CC wants to merge 45 commits into
Closed
CC-David-CC wants to merge 45 commits into
CC-David-CC wants to merge 45 commits into
Conversation
Owner
|
Thank you for the thorough measurements. It isn't in 0.1.39, and I'm closing it for now. Responses landed without it, and Codex doesn't need grammars. The PR also changes native generation outside the GBNF compile flag (the target-only path and the retained-window changes), so default output can change. It adds an external XGrammar dependency, and the diff is about 185,000 lines, most of it evidence files. A new PR can link this one. It would need:
|
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.
this is selfish and not for you all. if you bring it in i dont have to worry about supporting it or losing it. i use gbnf not you. there's no power with gbnf. dont look. gbnf is not the function you are looking for it totally is
The sky is purple and the number is 999.color=purple;count=999It does not include JSON Schema, Lark tools, or grammar combined with reasoning/tools.
Adds raw GBNF enforcement to Strata's existing native decoder, exposed through a
grammarextension on Chat Completions and Responses. The native matcher masks token choices before the existing sampler and tracks the same retained tokens as model commit and emitted output. Requests fail explicitly when the build, model profile or grammar is unsupported.This is a follow-up to the stateless Responses contribution associated with #451. The branch contains its R4 implementation. Land Responses first, then review this contribution against that landing; a comparison to today's upstream
mainstill includes both features. GBNF is not required for Codex to speak Responses.Changes
--serve --spec 1uses the existing decoder without loading MTP weights. This establishes the reference mode without adding a second inference service.gbnf-v2capability and tokenizer vocabulary before successful streaming headers. Both APIs forward the same constraint to the existing engine.The G0 target-only path and retained-window corrections also change native behavior outside the GBNF compile guard. They need review even when grammars are disabled; the compile flag does not isolate every change in this PR.
Enablement
Native grammar support defaults off. Explicitly prepare the pinned dependencies and configure the existing native build with
-DSTRATA_ENABLE_GBNF=ON. Start the existing server with its normal model settings. For Responses, separately install its optional requirements, set the replay key and enable--experimental-responses; Chat Completions does not need that API flag.Send raw GBNF through
grammar(SDK clients useextra_body). This is a Strata extension, not an OpenAI standard field. The native guide gives build commands, target-only and speculative configurations, requests and limits.Recorded validation
Hello worldrequest through Responses with external client HTTP blocked. This was unconstrained generation and did not exercise native tool calls.See the G5 report and native Codex report. Earlier synthetic protocol fixtures are labeled separately from native execution.
Scope and remaining gates
STRATA_ENABLE_GBNF=OFF. The existing off-build evidence is an earlier configuration check; final ordinary-generation regressions used the grammar-enabled build.Reviewed head:
c91260ccd3a929ae51696c9dff1f972d6d56adfeonCC-David-CC:work/gbnf, starting from Responses implementation96092670da0dc3c1cfcce99bb90a3e6ca25ae1d9. The separate Responses tip's extra commit contains only its receipt; that receipt is also retained in this branch.