Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7891de7
test(provider): Gemma 4 JSON answers are grammar-constrained (red)
jonathan308 Nov 13, 2026
ab972c2
feat(provider): Gemma 4 JSON answers are grammar-constrained after th…
jonathan308 Nov 13, 2026
4f399c2
test(provider): strict Qwen 3.5-family tool calls follow their schema…
jonathan308 Nov 13, 2026
2a888f6
fix(provider): Gemma JSON answers share masks across indentation; rev…
jonathan308 Nov 13, 2026
c83fb9f
feat(provider): strict Qwen 3.5-family tool calls follow their schema…
jonathan308 Nov 13, 2026
d9e8d3a
test(provider): the strict grammar's generator does not clash with th…
jonathan308 Nov 13, 2026
8239bbc
test(provider): the Gemma fixture keeps the prompt's words whole; the…
jonathan308 Nov 13, 2026
db19ace
refactor(provider): Gemma JSON answers, the refactor pass
jonathan308 Nov 13, 2026
9ed42df
fix(provider): strict JSON values write no surrogate escape; the MTP …
jonathan308 Nov 13, 2026
13b7e28
test(provider): JSON answers on Bonsai 2 and Nemotron 3.5 Lightning a…
jonathan308 Nov 13, 2026
ce42f3f
refactor(provider): refactor pass on the strict tool grammar (no beha…
jonathan308 Nov 13, 2026
9e5a5d6
Merge #2069 (strict Qwen tool grammar, 9ed42df2b3) into #2071 (Gemma …
jonathan308 Nov 13, 2026
34442eb
fix(provider): JSON answers on Bonsai 2 and Nemotron 3.5 Lightning fo…
jonathan308 Nov 13, 2026
12cda52
test(provider): Gemma JSON masks equal their transitions; exact real-…
jonathan308 Nov 13, 2026
df173e7
Merge #2071's head 12cda52b6d into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
2baa9b5
test(provider): the mask oracle's array position sits inside the JSON…
jonathan308 Nov 13, 2026
23e0f7e
Merge #2071's head 2baa9b5e00 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
dbc5577
fix(provider): JSON answers on Bonsai and Lightning: answer-first pro…
jonathan308 Nov 13, 2026
6c1c6c3
fix(provider): strict tool grammar review round: a mention of the cal…
jonathan308 Nov 13, 2026
a2ab578
docs(provider): place the strict tool grammar's passthrough note besi…
jonathan308 Nov 13, 2026
ecfa075
feat(provider): Gemma JSON answers enforce Pydantic- and zod-style sc…
jonathan308 Nov 13, 2026
9a0a6fc
Merge #2071's head ecfa0750d8 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
154fd29
fix(provider): JSON answers on Bonsai and Lightning: 27B only, silent…
jonathan308 Nov 13, 2026
0829cad
fix(provider): the schema rewrite resolves only plain definition name…
jonathan308 Nov 13, 2026
73ef0ec
Merge #2069's head a2ab57870e (strict Qwen tool grammar) into the 0.1…
jonathan308 Nov 13, 2026
2bb78da
Merge #2071's head 0829cad4f9 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
e6bfd86
fix(provider): the schema rewrite stays shallow and reads only draft-…
jonathan308 Nov 13, 2026
26a4bcd
Merge #2071's head e6bfd86bf7 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
3810f18
refactor(provider): the schema rewrite's refactor pass (no behavior c…
jonathan308 Nov 13, 2026
2354404
fix(provider): the schema rewrite pays for what it copies
jonathan308 Nov 13, 2026
a1c9718
Merge #2071's head 2354404dc4 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
347dc46
fix(provider): the schema rewrite pays for the bytes it hashes
jonathan308 Nov 13, 2026
77d5339
Merge #2071's head 347dc46b00 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
e7ded92
docs(provider): JSON answers on Bonsai and Lightning: the cohort cost…
jonathan308 Nov 13, 2026
941157b
fix(provider): the schema rewrite compares only short keys
jonathan308 Nov 13, 2026
d8c3835
Merge #2071's head 941157b8ed into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
3502545
fix(provider): the schema rewrite bounds what the compiler reads per …
jonathan308 Nov 13, 2026
c8709d0
Merge #2071's head 3502545903 into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
cab7aed
refactor(provider): the schema rewrite's hardening, refactor pass (do…
jonathan308 Nov 13, 2026
59d434e
Merge #2071's head cab7aed23a into its 0.10.13 fold resolution (with …
jonathan308 Nov 13, 2026
97ea9cf
Merge the 0.10.13 candidate (a2652e06f2) into #2075 for the fold (fol…
jonathan308 Nov 13, 2026
08b2a6a
Merge #2071 + #2069's fold resolution (#2077, 59d434e7a3) into #2075'…
jonathan308 Nov 13, 2026
0c18951
docs(provider): JSON answers on Bonsai and Lightning: a cut answer is…
jonathan308 Nov 13, 2026
b6c797c
Merge #2082's docs fix (0c18951719) into #2075's resolution with #2077
jonathan308 Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/gemma-json-answer-grammar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Gemma 4 JSON answers follow the requested format

- A Gemma 4 26B request with a JSON `response_format` (`json_object`, or `json_schema` within the provider's supported subset) is now sampled under a grammar: after the model's thought, if any, the answer is exactly one JSON value of the requested format, with no code fences, surrounding prose or trailing text. Schemas as Pydantic, OpenAI's strict mode or zod write them (`$defs`/`$ref`, optional fields as `anyOf` with null, `$schema`) are enforced as written; a `json_schema` the grammar still does not cover is held to a JSON object when its root is an object. The thought is unchanged.
- Requests the grammar does not cover (tools, a `tool_choice` other than `auto` without tools, `stop` sequences, images, other schemas) and cluster pairs are answered as before; an answer cut at `max_tokens` still ends as `length`, never as an error. `DARKBLOOM_GEMMA_JSON_ANSWERS=off` turns the grammar off on a Mac.
16 changes: 16 additions & 0 deletions changelog.d/json-answer-grammar-bonsai-lightning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Valid JSON answers on Bonsai 2 27B and Nemotron 3.5 Lightning

- A tool-free JSON `response_format` request on Bonsai 2 27B or on Nemotron 3.5 Lightning, on one Mac, whose prompt
starts in the answer (thinking off, the JSON default on Bonsai), is now sampled under the JSON-answer grammar the
Qwen 3.5 family already uses: for schemas inside the constrained subset the answer is one JSON value of the
requested schema (no extra or missing keys, no raw newline inside a string). On our checks, Lightning answers with
thinking off missed the schema 8 times in 72 before and 0 times after.
- Requests whose prompt opens a thought (Lightning's default), requests served by a cluster pair, and the Bonsai 2 9B
keep today's prompt-only steering.
- Like Qwen's, these answers decode without MTP (a Lightning row sharing their decode step stops speculating
meanwhile), and the provider checks them when generation ends: an answer that misses the schema at a natural stop
is the typed `422` (`tool_noncompliance`); one cut at `max_tokens` ends as a normal `length` finish with its
content as generated.
- The grammar keeps an answer inside the schema, not on topic: a model that wants a forbidden key may keep writing the
string it is in until `max_tokens`.
- `DARKBLOOM_JSON_ANSWER_GRAMMAR=qwen` (or `0`/`off`) keeps the grammar to the Qwen types.
6 changes: 6 additions & 0 deletions changelog.d/qwen-strict-tool-call-grammar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Strict Qwen tool calls always match their schemas

- On Qwen 3.8 27B, Qwen 3.6 35B and Qwen 3.5 9B and 35B, a tool call to a function declared `strict: true` could miss the caller's schema (a quoted number, a wrong enum value, a missing required argument, a value inside a `$ref` definition of the wrong JSON type); the provider checks such a call when it closes, after the answer started streaming, and the response then failed partway. On one Mac the provider now constrains these calls while they are sampled: only a declared function, its declared parameters (each at most once, every required one), and values of the declared types and enums can be written, in the template's call format. Reasoning and text around the calls stay free (ordinary text, the reasoning and call markers and the end of the answer; other special tokens such as `<|im_start|>` are not sampled), text that only mentions `<tool_call>` stays text, and the choice whether to call, the prompt and the streamed call deltas are unchanged. With `parallel_tool_calls: false` an answer opens at most one call.
- It applies to `tool_choice` `auto` (or absent) requests that declare at least one `strict` function; every call of such a request is held to its schema, as the check already holds it. Local `$ref`/`$defs` are inlined, `anyOf` of a type and `null` is supported, and a request whose schemas use a keyword the grammar cannot hold exactly (`pattern`, `minimum`, `minLength`, unions of several types, recursive references, ...) is served unconstrained, as before, never refused. Cluster pairs keep the previous behavior.
- As with constrained JSON answers, MTP drafting stops while a constrained answer is decoding: it drafts nothing itself, and on these models no other answer decoding beside it on the same Mac drafts either. Qwen 3.8 and Qwen 3.5 9B draft while up to 8 answers decode at once, so their decode slows while a strict-tool answer is running; Qwen 3.6 and 3.5 35B, whose cards set a presence penalty, do not draft anyway.
- `DARKBLOOM_STRICT_TOOL_GRAMMAR=off` turns it off on a Mac; a list of model types or model-id parts (`qwen3.8-27b,qwen3_5_moe`) limits it to those builds. `DARKBLOOM_STRICT_TOOL_GRAMMAR_ALL_TOOLS=on` also constrains the calls of requests without `strict` functions. Both reach a provider started by `darkbloom start`.
Loading
Loading