Skip to content

0.10.13: strict Qwen 3.5-family tool calls follow their schemas in the sampler (DARKBLOOM_STRICT_TOOL_GRAMMAR) - #2069

Merged
jonathan308 merged 17 commits into
devfrom
feat/qwen-strict-tool-grammar
Nov 13, 2026
Merged

jonathan308 merged 17 commits into
devfrom
feat/qwen-strict-tool-grammar

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Draft, 0.10.13 candidate (behind DARKBLOOM_STRICT_TOOL_GRAMMAR; on by default for Qwen 3.8 27B, Qwen 3.6 35B and Qwen 3.5 35B, opt-in for Qwen 3.5 9B; central kill: darkbloom-platform #938, EIGENINFERENCE_STRICT_TOOLS_UNMARK_MODELS). Grammar-constrained arguments for strict tool calls on the Qwen 3.5 template family on one Mac: the model can only write calls whose function, parameters and values validate against the declared schema.

Why

  • strict tool calls that miss the caller's schema are now the main remaining uptime cause on OpenRouter (UPTIME §3): ≈ 1,360/day on Qwen 3.8, refused after the answer started (tool_noncompliance, schema and malformed), mostly one bursty strict-tool client; a few on Qwen 3.6 (QWEN38-SPEED §2–3).
  • The provider checks a strict auto call only when its frame closes, after reasoning and the call's first deltas streamed. Today nothing in the sampler keeps a quoted number, an off-enum value, a missing required argument or a wrong-typed value inside a $ref definition out of the call. The coordinator cannot fix it (it never sees the call before the Mac does). 0.10.13: an answer cut at max_tokens ends as length; a strict call after the start returns as generated (LOW-GRADE §5 1–2) #2053 returns such a call as generated after the start (a quality miss instead of a failed response); this PR keeps the call from missing in the first place.

What the model can write

Qwen 3.5-family calls use the template's XML form; the call parser (Qwen35ToolCallParser) keeps a parameter's text as a string or converts it to one JSON type by the parameter's rendered schema:

<tool_call>
<function=NAME>                      ← whitespace, then `<function=` commits the call; a declared function
<parameter=KEY>                      ← a declared parameter, each at most once
VALUE                                ← text, one of an enum's values, or one JSON value of the declared schema
</parameter>
</function>                          ← only once every required parameter is given
</tool_call>                         ← with `parallel_tool_calls: false`, no second call opens
  • Free outside calls: reasoning (until </think>) and text admit every byte-level piece, the think and call markers and the stop tokens (the other added tokens, e.g. <|im_start|> or media placeholders, are not sampled); auto still decides whether to call; an answer may end wherever it could before. A mention of <tool_call> that is not followed by <function= (after optional whitespace) stays text, as the parser reads it; { (the JSON dialect) and a non-ASCII byte right after the marker are refused.
  • Values follow how the parser reads them (QwenStrictToolSchema.parserConversion, a mirror of the SDK's ToolArgumentNormalization, tested against the parser itself): text the parser keeps as a string is free (or one of an enum's exact values); a value it converts is one JSON value of the declared schema (FlintJSONGrammar, shared with the Qwen JSON answers). No value can spell </parameter> or a turn, reasoning or call marker; a JSON value never writes a surrogate escape (\uD800–\uDFFF: JSONSerialization refuses a lone one and the value would stay a string). Where the parser's reading and the declared type disagree (a top-level $ref that the render repair typed as a string), or where the streamed call would expose a converted value as text (streamsAsText, the mirror of Qwen35ArgumentStreamer, e.g. a {"type":"null"} parameter), the request stays unconstrained.
  • Schemas: the caller's declarations as sent (what the strict check validates against). Local $ref/$defs are inlined like the coordinator's resolver (ci: remove automated threat model review #889); cycles are refused. anyOf/oneOf of a schema and null (Pydantic Optional), a single allOf, and objects beside an open object (tau2's anyOf: [{$ref}, {type: object, additionalProperties: true}], also as the coordinator forwards it inlined, with the render repair's type and empty properties beside the union) are folded; format and other annotations are dropped. The rest must fit the shared fail-closed subset (ToolConstraintSchemaCompiler): pattern, minLength, minimum, multipleOf, uniqueItems, unions of several types, {} items, … → the request is served unconstrained, as before, never refused (a content-free log line says why).
  • Scope: tool_choice auto (or absent) requests that declare at least one strict function; every call of such a request is constrained (the strict check already validates every call of it). required/named (fix(provider): Qwen 3.5-family forced tool calls open with the call (Qwen 3.6, 3.5 9B; OpenRouter forced tool_choice) #2055's framing), none, requests without strict, media, cluster pairs and native-tracked engines are unchanged. Calls drafted inside the thought are reasoning to the grammar: on dev (calls parsed before the reasoning split) they stay unconstrained; with 0.10.13: Qwen 3.5, 3.6 and 3.8 parse tool calls after the thinking (a mentioned <tool_call> no longer loses the call) #2057 only a call at the end of a never-closed thought is a call. The loop guard stays on; the continuation after an exited thought runs without the grammar.

Before / After

Before (observable behavior and code flow, strict auto request on Qwen 3.5–3.8, one Mac):

flowchart LR
  R["strict auto request"] --> S["scheduler text path: ToolConstraintFactory.make returns nil for auto"]
  S --> E["engine samples freely: reasoning, text, calls"]
  E --> P["Qwen35ToolCallParser + streamed call deltas"]
  P --> V{"frame closes: ToolConstraintValidation against the declared schema"}
  V -- "valid" --> OK["tool_calls"]
  V -- "invalid: quoted number, wrong enum, missing required, wrong type in a $ref" --> X["in-band 422 tool_noncompliance after the answer started"]
Loading

After:

flowchart LR
  R["strict auto request"] --> S["scheduler text path: ToolConstraintFactory.make returns nil for auto"]
  S --> G{"QwenStrictToolGrammar.constraint: switch (default qwen3_5_moe + qwen3.8-27b; the 9B opt-in), auto + strict, .qwen35 parser, no media, engine runs constraints, schemas compile, boundary + vocabulary verify"}
  G -- "declined" --> E0["engine samples freely, exactly as before"]
  G -- "constraint" --> E["engine samples under QwenStrictToolConstraint"]
  E --> F["reasoning and text: free, watched for think-close and tool_call"]
  E --> C["inside a call: declared function, declared parameters once each, required before function-close, values the parser reads as schema-valid"]
  F --> P["Qwen35ToolCallParser + streamed call deltas, unchanged"]
  C --> P
  P --> V{"frame closes: same validation"} --> OK["tool_calls"]
Loading

Switches (both reach launchd providers via LaunchAgent.inferencePassthroughEnvKeys)

  • DARKBLOOM_STRICT_TOOL_GRAMMAR: unset = the MoE builds (qwen3_5_moe: Qwen 3.6, Qwen 3.5 35B), which do not draft with MTP, and Qwen 3.8 27B (qwen3.8-27b, defaultBuilds); on = every Qwen 3.5-family build (adds the 9B); an off word (off, 0, false, no, none, disabled) = today's behavior; a list of model_types or model-id parts (qwen3.8-27b,qwen3_5_moe) picks builds. Only Qwen 3.5-family builds can be enabled. The DARKBLOOM_STRICT_ prefix is not folded into the SSD prefix-cache identity.
  • DARKBLOOM_STRICT_TOOL_GRAMMAR_ALL_TOOLS=on: also requests without strict functions (off by default).
  • Central kill path: darkbloom-platform Reject overflowing occupancy before recording solo throughput #938 (EIGENINFERENCE_STRICT_TOOLS_UNMARK_MODELS, Stage 7 head aec0d7556c, ships unset). The coordinator forwards a listed build's tools without function.strict and without a tool-level strict, so isCandidate is false and the grammar is off for that build on every 0.10.13 Mac, with no provider change. Those calls are then also not checked against their schemas. It does not reach a body above 4 MiB or a Mac with …_ALL_TOOLS=on. With it in Stage 7, the owner's Qwen 3.8 default-on applies (2dfd8a24ab red → 242b6bd8b2, nits 5b4d5bc087). Release condition (review R1; the owner): RELEASE folds this head only if the Stage 7 swap with Reject overflowing occupancy before recording solo throughput #938 has succeeded by the phase-B fold (~13:45Z); otherwise af3152b544 (Qwen 3.8 opt-in). CI green on 5b4d5bc087 (run 43421743612). The post-publish kill steps are in release-0.10.13/PLAN.md. The 0.10.14 registry control is in earnings/STRICT-GRAMMAR.md.

Cost

  • MTP: as with the constrained Qwen JSON answers today, a constrained row drafts no MTP tokens, and on these engines no row of a decode step it shares speculates (ineligibleRowsDecodeBesideSpeculation is false; EngineLoopV2.mtpDraftBatchRows). The engine drafts while at most maxSpeculativeBatch rows decode (8 by default), so on Qwen 3.8 and the 9B the whole constrained answer, reasoning included, and every answer decoding beside it on that Mac run target-only while it decodes. The 3.6 and 35B builds keep their cards' presence penalty and do not draft anyway. Measured below. Owner's call (10:00Z): the dense builds that draft (Qwen 3.8, the 9B) are opt-in for 0.10.13; "constrain only the call" (drafting outside calls) is the 0.10.14 fix (it needs the SDK's MTP acceptance to respect the constraint, or a provider continuation from <tool_call>, neither safe for 0.10.13).
  • First request per tokenizer: builds the grammar's vocabulary (2.75 s in a debug build on the real Qwen 3.8 tokenizer; counted in the profile's tool_constraint duration). Masks are cached per state.
  • The loop guard stays on for these requests (GenerationLoopGuardPolicy).

How much Qwen 3.8 traffic is strict (production, read-only, 11-13)

inference_routes has no strict column, so the strict client is found by its shape (TAU2-AUDIT §1; every schema refusal is on it): OpenRouter key, tools, no media, requested max = the model cap, estimate ≥ 4,100 tokens, thinking off. Selected attempts on Qwen 3.8 (strict-grammar-evidence/prod/p1.1005.out; aggregates only):

  • Per hour: in the client's waves (01:00–06:59Z) 53–84 % of Qwen 3.8 rows (4.0K–10.9K rows/h; 81–339/h refused partway, all on that shape); outside them 16–40 rows/h (≈ 1–2 %).
  • Macs at once (60-s grid, 04:32–10:00Z): in the waves p50 3, p90 40–52, max 62 Macs hold a strict row (of ~150 serving); 30–50 % of busy Macs and 31–51 % of rows in flight sit on such a Mac; outside the waves ≈ 2 %. Busy Macs mostly run one or two rows (rows in flight p50 10–24 on 9–20 busy Macs), i.e. the lone-row case where MTP drafts.
  • Its answers: completion p50 39 tokens (p90 102), no reasoning: the answer is almost entirely the call.

"Constrain only the call" (thinking and text keep drafting): 0.10.14, not 0.10.13

  • The SDK gates MTP per request (EngineLoopV2.mtpBasicEligible: tokenConstraint == nil). Drafting while a constrained row is outside a call needs constraint-aware acceptance in the MTP verify step: a speculative round that starts in text can accept <tool_call>, <function= and name tokens before the host sees them, unconstrained. That is an SDK change to the verify/finalize path (with chained decode), not safe for 0.10.13.
  • A provider-only variant (generate unconstrained with <tool_call> as a per-request stop token, then continue constrained from the row's tokens, like LoopExitThinkingContinuation) needs new bridge plumbing (per-request stop tokens and the row's token ids) and a second splice beside the loop guard's; also not safe by 13:00Z.
  • For the bursty client it would gain little anyway: its answers are ~40 tokens of call with thinking off.

Tests (red first)

  • Red 4f399c24f2: the API with no behavior and the tests (QwenStrictToolGrammarTests, QwenStrictToolServingTests). Its test file has a raw-string typo (#"…"# around "#/$defs/…"), fixed in the green commit, so the red run uses the green-commit test file on the red sources: 17 of 19 tests fail (45 issues) for the stated reasons (no constraint, stub parserConversion, switch keys absent); the 2 that pass are decline controls a no-op stub satisfies. The independent reviewer reproduced the same red result.

  • Green c83fb9f233 → head: local trimmed runs (ProviderCore + this suite, Mac A) 26 tests in 4 suites pass (callsDrawnFromTheMasksAlwaysValidate ×4 fixtures, unsupportedSchemasStayUnconstrainedWithoutAnError ×12), including the real-tokenizer suite on the shipped Qwen 3.8, Qwen 3.6 35B, Qwen 3.5 35B and Qwen 3.5 9B tokenizers (each verifies the vocabulary contract and walks a real tokenization of a call with thinking on and off; vocabulary build 1.9–2.8 s in a debug build). The default switch change has its own red commit (2b7f90ceaa: 3 issues on the previous source). CI below.

  • Coverage: nested objects, arrays, enums, integers vs strings, $ref/$defs (nested, in items, top-level declined, recursive declined), anyOf with null and beside an open object, optional/required/undeclared/duplicate parameters, streaming deltas (chunked 1/3/17), reasoning on/off, multiple calls, auto vs required/named/none, parallel_tool_calls: false, a prose mention of <tool_call>, the parser's reading and the streamer's reading cross-checked against the SDK, the scheduler path (a call that would miss its schema streams valid), other engines/families/boundaries, the switch and its launchd passthrough. A property test draws random calls from the masks for four functions over three fixtures and checks every one parses and streams to arguments the strict check accepts; a second draws whole answers from the first token on over multi-byte pieces (split and spelled markers, mentions, Unicode whitespace, the JSON dialect) and checks that every mask equals the brute-force set and that every call the parsed or streamed reader returns is one the grammar opened and closed.

  • Qwen 3.8 default (11:20Z owner condition met by Reject overflowing occupancy before recording solo throughput #938):

    • red 2dfd8a24ab (local red-q38): 4 issues, all for the stated reasons: the default table, Qwen 3.8 not enabled, and the scheduler serving its strict request unconstrained;
    • 242b6bd8b2 and 5b4d5bc087 (local green-q38, green-q38b): 26 tests in 4 suites pass, plus the real-tokenizer suite on the Qwen 3.6, 3.5 35B and 9B tokenizers;
    • the 9B stays opt-in (pinned), and a list without qwen3.8-27b turns Qwen 3.8 off on a Mac (pinned).

Independent review and refactor pass

  • First review (fresh-context subagent, at c83fb9f233): REQUEST CHANGES. Addressed: M1 lone surrogate escapes (JSON values never write \uD800–\uDFFF), M2 MTP statement (corrected everywhere; measurement in the GPU check), M3 {"type":"null"} streamed divergence (streamsAsText mirror + decline + test), S1 prose mention forced a call (the call commits at <function=), S2/S5 calls in the thought and the exit-thinking continuation (documented), S3 parallel_tool_calls: false (one call), S4 free-phase tokens (documented), S6 red log (above), S7 diagrams/refactor outcome (here), S8 vocabulary build now in the tool_constraint duration (the next first-content deadline check still precedes submission), nits.

  • Refactor pass (dedicated subagent, AGENTS.md): small behavior-preserving cleanup, applied as ce42f3f802 (dead isInsideCall removed, value markers built from the text markers, stale suite name and on-word comments fixed, forbidden spellings kept once); suite green.

  • Delta review (second fresh-context subagent, c83fb9f233..a2ab57870e): APPROVE WITH NITS, no must-fix; every first-review item resolved or documented; its own probes (≈2,000 masks against brute force, 476 random whole answers through both readers) found no call outside the grammar. Its should-fixes (adopt the whole-answer walk; the 35B MTP note holds unless a request sets presence_penalty: 0) and nits (one spelling of the opening's byte classes, the released mask built once, the mention test streamed) are in d72fdfcc56. The GPU numbers and the default list remain open.

  • Third and fourth reviews (fresh-context subagents): the default change (a2ab57870e..5bd909cdfb) and the Tau2 union fix (3cca9d3edf..d1bbd37505): APPROVE WITH NITS, no must-fix; their nits are in 3cca9d3edf and af3152b544.

  • Fifth review (fresh-context, the Qwen 3.8 default af3152b544..242b6bd8b2): APPROVE WITH NITS, no must-fix, with release condition R1 (above).

    • No build turns on by accident: the 9B, qwen3.8-flash-next, non-family types and cluster pairs stay as before.
    • The env semantics are unchanged.
    • The red failures are the intended ones.
    • Its nits 1, 2, 4 and 5 are applied in 5b4d5bc087. A fresh check of that commit: APPROVE (one test expectation and wording only; the local run's diff hash matches the commit).

GPU check (Mac A)

Qwen 3.8 27B, greedy, one model at a time, port checked to be the arm's own provider. base = signed 0.10.12; cand = this branch's release build (6c1c6c3361) with the grammar on for Qwen 3.8 (the opt-in); cand-off = the same build with DARKBLOOM_STRICT_TOOL_GRAMMAR=off; on2 = the head's build (d1bbd37505, Tau2 union fix) with =on. Records and scripts: strict-grammar-evidence/gpu/ (out/summary*.txt).

Cell base cand-off cand
Lone strict rows (10, one at a time): decode tok/s p50, TTFT p50 139.2, 0.53 s 118.3, 0.54 s 45.9, 0.78 s (52–54 tok/s and 0.53 s once the host was quiet; 36–40 tok/s and 0.8 s while it was busy)
Same, MTP off in every arm (presence_penalty 1e-4): decode, TTFT 54.6, 0.53 s — 51.4, 0.53 s
Plain rows alone (8 × 1,024 tokens) 80.9 73.8 74.6
Plain rows beside strict rows (each one at a time, side by side): decode; MTP rounds over the cell 73.6; 2,296 — 71.1; 2,243
50 strict requests, nested schemas (4 at a time): valid 45/50 45/50 45/50
49 Tau2 turns as sent (8 at a time) 42 served, 40/40 calls valid — the same 42/42 calls, arguments included
  • The cost is the lone strict row's MTP: a lone strict answer decodes ~2.3× slower than with MTP on the same build (118 → 52 tok/s; 0.10.12 drafts at 139). With MTP off in both arms the grammar's own cost is small (54.6 → 51.4, within this build's −9 % on plain rows). Rows beside a strict row lose nothing measurable: with two or more rows decoding, this Mac barely drafts in either build (MTP rounds equal; 21 rounds for the 50 requests at four at a time).
  • The 50-request set's five misses are a --local artifact: the local API skips the provider's schema repair (ToolSchemaNormalization.ensureParameterTypes, run on the coordinator path), so reminder_minutes: anyOf [integer, null] is read as text and every such call fails in all three arms; the grammar declines those requests (served as before). With the repair, the grammar takes all 50 (local probe).
  • Tau2 with every tool strict (45 served in both arms): identical calls — the grammar declined Tau2's forwarded union shape (anyOf with the repair's empty properties beside it). Fixed in d1bbd37505 (49/49 now take the grammar, local probe); re-run below.
  • OpenRouter's strict nested-$ref set (45; REF-OTHERS's bodies as the coordinator forwards them, inlined; 4 at a time): cand-off 38/40 valid → on2 40/40, in-band errors 2 → 0. Both misses were AgentOutput calls (an undeclared key beside click_element; a scroll action without its scroll wrapper); with the grammar the same turns write {"click_element":{"index":2}} and {"scroll":{"amount":600,"direction":"down"}}, and the other 8 AgentOutput calls are byte-identical. The grammar takes 10/45 (AgentOutput); create_order (minimum), pay (a union of closed objects) and act (discriminated oneOf) decline and are served as before. Decode at 4 at a time: constrained rows 32.2 → 26.0 tok/s, rows beside them 33.2 → 29.0 (host-side masks; MTP barely drafts at this width).
  • The 50 strict requests as the coordinator path serves them (the provider's repair applied to the bodies): on2 50/50 valid, reminder_minutes now 15 / null as integers; decode 25.6 tok/s at 4 at a time (cand-off 29.1 on the unrepaired bodies).
  • Tau2 with every tool strict, grammar engaged (on2, 49/49 constrained, 8 at a time): all 49 served, 42/42 calls valid (base 42/42 of 47 served); 40/47 turns identical; the other 7 already differ inside their thought, before any call (4 call another function, 2 end in text, 1 gains a call); the grammar constrains nothing there, but the constrained rows decode without MTP, so long greedy thoughts can part at near-ties. TTFT p50 2.18 → 1.45 s, decode 34.3 → 26.7 tok/s.

Qwen 3.6 35B-A3B (on by default; it does not draft): signed 0.10.12 vs the head's build (d1bbd37505), switch unset, greedy unless noted.

Cell 0.10.12 this build
Lone strict rows (10): decode tok/s p50, TTFT p50 129.4, 0.15 s 120.9, 0.15 s
Plain rows alone (8 × 1,024) 127.8 127.1
OpenRouter's strict nested set (45, inlined, 4 at a time): valid, decode 38/40, 88.7 39/40, 87.8
The same set as production sends Qwen 3.6 today (top-level $ref typed string) 0/45 valid 0/45, 44/45 turns identical (declined: served as before)
50 strict requests, coordinator-path bodies, temperature 1 (4 at a time): valid, decode 49/50, 81.1 50/50, 76.2
  • The 0.10.12 miss at temperature 1 is OpenRouter's class: a passenger written as a string where the $ref definition wants an object. The one miss left on the nested set is create_order, which the grammar declines (minimum), as on Qwen 3.8. Greedy outputs the grammar leaves valid are byte-identical (10/10 lone rows, 38/40 nested set; the two that differ are the fixed calls).
  • Until ci: remove automated threat model review #889's inline covers Qwen 3.6 (REF-OTHERS), production's top-level $ref requests decline and are served exactly as today.

Coordination

git merge-tree at the head is clean with every open PR into dev from #2041 on (#2041, #2045–#2055, #2057–#2067, #2070–#2076); the LaunchAgent note moved beside its keys to stay off #2071's insertion. The simulated fold on dev (#2047 → #2051 → #2050 → #2048 → #2049 → #2059 → #2054 → #2046 → #2055 → #2057 → #2041 → this) merges cleanly. Files shared with other PRs: MultiModelBatchSchedulerEngine.swift (one let→var and one block after the factory call; #2055's hunk is just above), LaunchAgent.swift (two keys and a doc note, away from the others' insertions), GenerationLoopGuardPolicy.swift (one guard line; #2054 edits its doc comment), the two docs. Semantics: with #2053 a declined request's invalid call is returned as generated; with #2057 the grammar constrains calls after </think> and a trailing call in a never-closed thought stays unconstrained.

jonathan308 and others added 2 commits November 13, 2026 00:12
…s in the sampler (red)

The API only (no request is constrained yet) and the tests: nested objects,
arrays, enums, integers vs strings, $ref/$defs, anyOf with null and open
objects, required/optional/duplicate/undeclared parameters, reasoning on and
off, multiple calls, auto vs required/named/none, unsupported keywords left
unconstrained, the per-model switch and its launchd passthrough, the parser
reading against Qwen35ToolCallParser, random calls drawn from the masks, and
streamed deltas through the router and through the scheduler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s in the sampler

A strict auto call is checked against the caller's schema when its frame
closes, after the answer started streaming, so a call that missed the schema
failed a started response (OpenRouter's main remaining Qwen 3.8 uptime cause).
On Qwen 3.8, 3.6 and 3.5 (qwen3_5, qwen3_5_moe) on one Mac the sampler now
holds every call of a request that declares a strict function to the declared
schemas: a declared function, declared parameters at most once, required ones
before </function>, and values the call parser reads as schema-valid
arguments (text, an enum's exact values, or one JSON value of the declared
schema, by the parameter's rendered type). Reasoning and text stay free, auto
still decides whether to call, and the prompt does not change.

Local $ref/$defs are inlined like the coordinator's resolver; anyOf/oneOf
with null, a single allOf and objects beside an open object are folded;
annotations (format included) are dropped. A schema outside the shared
subset, a cluster pair, a native-tracked engine, media, another family or
tool choice keep today's unconstrained calls, never a refusal. The loop guard
stays on for these requests. A constrained row drafts no MTP tokens (SDK).

DARKBLOOM_STRICT_TOOL_GRAMMAR (off word = today; a list picks builds) and
DARKBLOOM_STRICT_TOOL_GRAMMAR_ALL_TOOLS (also non-strict requests) reach
launchd providers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 13, 2026 12:03pm UTC
darkbloom-status Ready Ready Preview Nov 13, 2026 12:03pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 13, 2026 12:03pm UTC

Request Review

…e suite's SplitMix64; a real-tokenizer walk

The property test's generator was a second internal SplitMix64 in the
ProviderCoreTests target (ThroughputSweepTests and SSDBlockIndexTests declare
one); it is a private StrictGrammarRandom now. A suite gated by
DARKBLOOM_TEST_QWEN_TOKENIZER_DIR builds the vocabulary from the shipped Qwen
tokenizer, checks the rendered prompt boundary with tools for thinking on and
off, and walks a real tokenization of a call through the grammar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cost as the engine applies it

A nested JSON string could end in a lone \uD800-\uDFFF escape, which the
parser's JSONSerialization refuses, leaving the whole object or array
parameter a string the strict check rejects (review M1). JSON values now
never spell a surrogate escape (nor a backslash before such text); other
escapes and characters written as such are unchanged. Each span's markers are
built once per constraint instead of per byte.

As with constrained JSON answers, a constrained row stops MTP speculation for
every row of the decode steps it shares on these engines, not only its own
(review M2): docs, changelog and the policy's comment say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vior change)

From the dedicated refactor-pass subagent (AGENTS.md): drop the unused
isInsideCall, build the JSON value markers from the text ones, correct a test
suite name and the switches' on words in comments, and keep the forbidden
spellings once as strings. Masks, transitions, eligibility, switches and the
hook API are unchanged; the suite passes (20/20 in the trimmed local run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
9ed42df)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
9ed42df)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l marker stays text

A call now commits at <function= (after optional whitespace following
<tool_call>), where the parser and the frame scanner commit to one; any other
first byte is text again, as without the grammar, and the text watcher sees
the bytes since the marker. { (the JSON dialect) and a non-ASCII byte right
after the marker are refused (review S1). With parallel_tool_calls false no
call opens after the first one closed (S3).

A parameter the streamed call would expose as text while the parser converts
it (a {"type":"null"} parameter) declines the request:
QwenStrictToolSchema.streamsAsText mirrors Qwen35ArgumentStreamer and a test
checks it against the streamer (M3). The scheduler hook reads the switch
first and counts the grammar's setup, the first request's vocabulary build
included, in the profile's tool_constraint duration (S8). Opening masks are
cached by the bytes matched, stop tokens are merged into sorted masks instead
of re-sorting, and opaque-span masks are keyed by whether stops are allowed.

Tests: the mention, single-call and streamer-mirror tests; the property test
draws calls for the $ref and union fixtures too and checks each one parsed
and streamed. Docs and changelog: the free phases' tokens (S4), calls inside
the thought (S2), the exit-thinking continuation (S5), and the MTP cost with
up to 8 decode rows (M2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…de its keys

The LaunchAgent doc lines move next to the prompt-cache knobs, in the order of
the passthrough keys, which also keeps them off the line #2071 inserts after.
Comment only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
9ed42df)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
…3 fold resolution

#2069 moved its LaunchAgent note above the template-loops line, so #2071 and
#2069 now also merge cleanly on their own; this tree equals that clean merge
(ecfa075 + a2ab578). The conflict here is only against this branch's
earlier resolution of the same comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
a2ab578)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
a2ab578)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es the default builds

The third independent review's nits (approve with nits, no must-fix): the
architecture note says the MoE builds' cards' presence penalty is what keeps
them from drafting, the configuration row says a list replaces the default
builds, and the serving tests note that they expect the switch unset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 and others added 2 commits November 13, 2026 02:41
…ties beside it takes the grammar (red)

Tau2's tools reach the provider with each item union inlined and the render
repair's type and empty properties written beside it
({"anyOf": [...], "properties": {}, "type": "object"}). The grammar refused
the keywords beside the union and served every such request unconstrained:
on the GPU check, all 49 Tau2 turns with strict tools. The union fixture gains
that shape. Red: the fixture no longer compiles (2 issues).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s empty properties beside it

An empty properties object asserts nothing, so beside a union it is dropped
like the repair's render type, and the union folds as before. Tau2's strict
tools now take the grammar (49 of 49 turns in a local probe, with and without
the provider's schema repair); unions of several closed objects, minimum and
discriminated oneOf still decline, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pty properties beside a union still declines

The fourth independent review's nits (approve with nits, no must-fix): the
targeted test walks, parses and validates a call that carries the forwarded
union shape; a union with a non-empty properties beside it is pinned as
unsupported; the doc line is rewrapped and the schema comment credits the
provider's own render repair too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 and others added 2 commits November 13, 2026 03:52
…e 9B does not (red)

The owner (11:20Z): Qwen 3.8 27B on by default once a central kill path
exists. darkbloom-platform #938 (EIGENINFERENCE_STRICT_TOOLS_UNMARK_MODELS)
forwards a listed build's tools without strict, which turns the grammar off
for it on every Mac. The default table becomes the MoE builds and
qwen3.8-27b; the 9B (also qwen3_5) stays opt-in. Red by assertion: the
default setting is still [qwen3_5_moe], Qwen 3.8 is not enabled by default,
and the scheduler serves its strict request unconstrained.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 27B

The owner (11:20Z): Qwen 3.8 on by default once a central kill path exists.
darkbloom-platform #938 (EIGENINFERENCE_STRICT_TOOLS_UNMARK_MODELS, Stage 7)
forwards a listed build's tools without strict, which turns the grammar off
for that build on every Mac with no provider change. The default builds are
now qwen3_5_moe (Qwen 3.6, Qwen 3.5 35B) and qwen3.8-27b (defaultBuilds, read
as a list entry: a model_type or a model-id part); the 9B (also qwen3_5)
stays opt-in. GPU on Qwen 3.8 (STRICT-GRAMMAR): a lone strict answer decodes
at ~50 instead of ~120 tok/s (no MTP while constrained); with two or more
rows MTP barely drafts anyway; nested strict set 38/40 -> 40/40, repaired
strict requests 50/50, Tau2 all-strict 42/42 valid. Docs: inference,
configuration, changelog fragment, LaunchAgent note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the default flip

Fresh delta review of af3152b..242b6bd (APPROVE WITH NITS): pin that a
list replacing the defaults without qwen3.8-27b turns Qwen 3.8 off on that
Mac (nit 2); the changelog names the coordinator switch's limits (those calls
are then not checked against their schemas; a body above 4 MiB and a Mac with
DARKBLOOM_STRICT_TOOL_GRAMMAR_ALL_TOOLS=on are not reached) (nit 1), the
neighbours' ~13 % at four rows (nit 5), and words Qwen 3.8's reason as
measured: strict calls missing their schemas were its main remaining failure
on OpenRouter (nit 4; also inference.md and the doc comment).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 13, 2026
…t on) into the 0.10.13 fold resolution

STRICT-GRAMMAR's FINAL-2 (CONFLICTS.md 12:04Z): its new commits touch only
#2069's own files, LaunchAgent note lines, docs sections and changelog
fragment; the merge is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 merged commit 3bf9ba7 into dev Nov 13, 2026
19 checks passed

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — 5b4d5bc0 Deployed Nov 13, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 5b4d5bc0 Deployed Nov 13, 2026 by vercel[bot]
Preview – darkbloom-status — 5b4d5bc0 Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant