mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1431] Feature request: tool-call emission recovery for low-bit quants in agent workloads (Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS) #577
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#577
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?
Originally created by @mechanicss on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1431
Feature request: tool-call emission recovery for low-bit quants in agent workloads (Qwen3.8-Flash-Next, GSQ-RCO IQ3_XXS)
Environment
--kv int8,--max-context 262144, resident experts).The problem
In agent workloads the model's tool-call emission fails stochastically, and Strata currently has no recovery path, so the harness receives broken text instead of a call. Two symptoms:
1. Mangled emission → lands in content. The model writes a broken variant of the native format and the parser cannot map it:
(Note the shorthand the broken model actually writes:
<skill>/<name>instead of<function='skill'>; mismatched closers; occasional retried parameter values after the closers.)Result:
finish_reason: stop, notool_calls, the markup leaks as the assistant message. The agent cannot act.2. Silent end. The model closes its thinking block and emits EOS with no answer and no call (finish
stop, empty content). Stochastic; appears with large tool-schema context; matches the degradation family of llama.cpp issue #28805 ("qwen4exp … 1 token then EOS at long context — stochastic threshold that moves with model quant / KV quant / n_ctx").Measured failure rate: with a 39-tool schema set, a usable turn (call executed or meaningful answer) happens in ~30–50% of runs over 20+ controlled replays of identical requests. With 3 tools the emission was once perfect; with 8 it already degrades — the failure clearly scales with schema/context pressure, not with prompt length alone.
What proves this is recoverable
The same weights served by llama.cpp (master,
--jinja) parse tool calls perfectly: 8+ consecutive runs of the exact same request (39 schemas, 16.5K prompt) — correctly parsed parallel calls (skill(engineer-method)+skill(gate-checking),bashwith the right command), zero leaks. llama.cpp succeeds because of (a) its PEG/grammar machinery that constrains and tolerantly maps the emission, and (b) its content→tool_calls lift fallback (see llama.cpp issue #30078, closed 2026-10-07 — the same failure family and the same fix approach; the reporter's numbers, 30–50% stochastic failure, match ours exactly).We also built a wrapper-level rescuer for Strata (a filter between the output parser and the consumers): it buffers content once a
<tool_callopener appears, and at the end of the turn repairs each segment — tool name resolved from structural slots (the tag right after the opener /<name>value /<function='name'>), parameters extracted from<parameter=NAME>and shorthand<NAME>openers known from the tool's JSON schema, values right-trimmed of closer junk and coerced by schema type; a confidence gate (unique name, all required params valid, no unknown explicit parameters, max 2 calls, never on cancel). It lifts repaired calls as realToolCallevents. It works — live log:1 call(s) repaired from mangled content— but wrapper-level repair cannot reach inside the emission process, so the useful-turn rate tops out around 30–50%.Feature requests, in order of impact
1. Tolerant tool-call recovery in the output parser (content → tool_calls lift).
When a
<tool_call>-shaped region fails the strict parse, attempt schema-aware lenient repair (openers-based, as described above) and lift the result into real calls; or expose the raw region so the server layer can do it. llama.cpp #30078's reporter shipped exactly this kind of lift and it resolved their production failures. This alone would make agent workloads usable at 3-bit quants.2. Grammar-constrained emission option for tool calls.
An opt-in mode (config/request flag) that constrains decoding once a
<tool_call>opener appears: the structural skeleton (<function=+ the request's tool names +<parameter=+ closers) is grammar-masked, while parameter values stay free text. llama.cpp'sgrammar_lazy+ trigger approach is the reference. This is the hard guarantee for low-bit quants — the model physically cannot produce a malformed call.3. Anti-silent-end option.
When tools are present and the thinking block closes with no answer and no call, optionally re-prompt/resume once with a forced call opening (the server already has the
forced_call/tool_choice machinery — a wrapper-level forced resume exists in our fork and fires correctly; the remaining gap is that the model sometimes writes prose inside the forced<function=— a grammar would close that too).Why we believe this is worth it
Qwen3.8-Flash-Next is new and the community is actively running it quantized (see llama.cpp #30078 created 2026-10-07 and ollama #18817 for GSQ-RCO import reports). Agent harnesses are the main real workload for this class of model, and tool-call emission is currently the first thing that breaks at low bits. Strata already reproduces llama.cpp-beating decode speeds on this exact model — emission recovery is the missing piece that would make it a complete agent engine.
Data we can provide immediately
@beatcollector commented on GitHub (Oct 8, 2026):
We hit symptom 2 hard in production and can add data.
Setup: Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS on an RTX 5080 (Linux, engine 0.1.40 / server 0.1.40.3), driven by an agent harness (Hermes) with OpenAI-style tool schemas — multi-turn agent sessions, dozens of tool round-trips per session.
What we see: turns where the thinking block closes and the model emits EOS with no answer text and no call (
finish_reason: stop, empty content, notool_calls) — exactly your symptom 2. The engine side is clean (no watchdog stops, normal decode rates); it is purely emission-side. In a heavy-tool-schema session today these empty-emission turns ran ~3x our usual daily rate, while lighter sessions stayed at baseline — consistent with your finding that it scales with schema/context pressure rather than prompt length alone.We'd get real value from request 1 landing in
serveproper: wrapper-level repair like yours can't reach inside the emission process (your own numbers show the ceiling), so a schema-aware content→tool_calls lift in the parser — or at minimum exposing the raw<tool_call>-shaped region so server-side consumers can repair it — would cover this class for everyone running low-bit quants on agent traffic.Also noting PR #1430 (
<function= NAME>whitespace variant) is one narrow member of the same mangling family from our side; we see several variants of it in IQ3_XXS output logs.Happy to provide replay payloads / engine logs for the silent-end case if useful.
@Niko1221 commented on GitHub (Oct 8, 2026):
Thank you for the thorough write-up. Parts of this exist already: when the model writes a tool call inside its thinking, the server keeps it as a call if the name is a declared tool (#804, #1058), and 0.1.41 also reads a name with a space after
=(<function= NAME>, #1430). What is not there is a repair of a call whose structure is damaged (missing closing tags, a wrong parameter format) or a retry when no valid call comes out. That is a larger change than a parser fix, and a retry changes what the model sees, so if we did it, it would be opt-in. Your wrapper module and the mangled samples would help: three or four raw outputs where the call came out broken (the exact text, the tool schema, the quant) let us check what the parser does with each and which of them a stricter parse could recover without guessing.@mechanicss commented on GitHub (Oct 8, 2026):
Thank you — this matches what we see. Data below (everything needed to reproduce the emission failure):
Setup: Qwen3.8-Flash-Next, quant ISTA-DASLab GSQ-RCO IQ3_XXS (two GGUF shards), engine 0.1.40; engine flags:
--spec 4 --spec-min-p 0.5 --mtp <draft> --kv int8 --max-context 131072 --expert-cache auto --prefill auto --resident-experts, control vector--control-vector-scaled …experimental-speed-projection.gguf:1.0 --control-vector-layer-range 4 44 --cvec-mode project --cvec-dir per-layer; server-side sampling defaults temperature 0.6 / top_p 0.95 / top_k 20.Request shape: one system message (agent instructions) + 39 tool schemas in a single
toolsarray (OpenAI-style; theskillschema below is one of them) + one user message; prompt ≈ 16.5K tokens. Failure rate scales with the schema count: 3 tools — clean; 8 — mangled sometimes; 39 — mangled most runs.Tool schema (intended call:
skill {"name": "engineer-method"}):Raw output 1 (structure degrades mid-call, then a closing-tag loop to the token budget):
Raw output 2 (inline variant of the same):
Case 3 (silent end): thinking closes normally, then EOS — empty content, zero tool_calls,
finish_reason: stop(same class as the other report in this issue).If it helps the parser work, I can paste the full request header JSON (39 schemas + the system message, ~46 KB) or any subset of it.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.