mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #636] [CLOSED] native: add opt-in GBNF constraints to existing generation #2736
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2736
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/636
Author: @CC-David-CC
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:work/gbnf📝 Commits (10+)
0fc5140responses R0: pin client capture and upstream baseline evidence88a63bcresponses R1: add stateless request boundary and local assembler53c4f9fresponses R2: stream typed events and verify cancellation cleanup5cb5746Support client-owned functions and honest Responses reasoning9609267Qualify the Responses client profile and freeze R4 acceptanceb7e2336Enable and qualify persistent target-only native servinga2e6544Record the G0 native qualification receipt83c93e4feat(gbnf): pin native compiler and bounded sequence matcherbd4c3b9docs(gbnf): record passing G1 source and evidence receipt7cec5cafeat(gbnf): enforce native legality before target-only selection📊 Changes
1284 files changed (+318338 additions, -141 deletions)
View changed files
📝
.gitattributes(+8 -0)📝
.gitignore(+3 -0)📝
CMakeLists.txt(+17 -0)📝
README.md(+64 -7)➕
cmake/xgrammar.cmake(+63 -0)➕
data/grammars/actions.gbnf(+1 -0)➕
data/grammars/ambiguous.gbnf(+3 -0)➕
data/grammars/balanced.gbnf(+1 -0)➕
data/grammars/boolean.gbnf(+1 -0)➕
data/grammars/cases.json(+109 -0)➕
data/grammars/escaped.gbnf(+1 -0)➕
data/grammars/expression.gbnf(+5 -0)➕
data/grammars/overlapping.gbnf(+1 -0)➕
data/grammars/route.gbnf(+1 -0)➕
data/grammars/unicode.gbnf(+1 -0)➕
docs/CODEX_LOCAL.md(+432 -0)➕
docs/CODEX_TOOL_SCHEMAS.md(+60 -0)➕
docs/GBNF_INSPECTION.md(+189 -0)➕
docs/JSON_OUTPUT.md(+97 -0)➕
docs/NATIVE_GBNF.md(+275 -0)...and 80 more files
📄 Description
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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.