← Blog · · 7 min read
A lenient parser rescued 0 of 75 Qwen3.6 tool-call misses in MLX; the model skipped calls
On this page (7 sections)
If a local agent on your Mac gets a tool call wrong, the usual suspect is the parser. We ran Qwen3.6-35B-A3B in MLX on 96 tool-calling tasks, and a lenient parser rescued 0 of 75 failed runs: our scorer labelled them text answers or only some of the needed calls.
TL;DR On our M3 Max, a lenient parser recovered none of Qwen3.6's tool-call misses. Switching to thinking mode, with its own recommended sampling, raised strict accuracy from 73.96% to 95.83%, at 3.57x the median latency per call.
We expected the plumbing to be the problem
A post on the HN front page, "Fixing Tool-Call Accuracy in vLLM", argues that many tool-call failures come from parsing, not from the model. The model emits a correct call in a slightly wrong shape, and the server drops it. If that were true on a Mac too, the fix would be a better parser, not a bigger model.
So we built the experiment to split errors into "the model chose wrong" and "the plumbing dropped a correct answer". We wrote 96 tasks against 12 fictional tools. Each task has an exact expected call, and every output went through three parsers:
- a strict parser that accepts only the format the chat template defines;
- a lenient parser that also pulls calls out of code fences, bare JSON, single quotes, trailing commas and missing closing tags, without ever editing a value;
- for Qwen, mlx_lm's own
qwen3_coderparser, the onemlx_lm.serveruses.
If parsing were the bottleneck, the lenient score would sit clearly above the strict one. It didn't.
A more forgiving parser rescued nothing
For Qwen with thinking off and 8 tools in the menu, 75 of 288 task runs failed (3 seeds × 96 tasks). The lenient parser recovered none of them, and mlx_lm's parser agreed with our strict parser on pass/fail for every run. All 75 got the same label: skipped_needed_call, which our scorer gives when the model answers in text or makes only some of the needed calls.
Across all four conditions, the lenient parser recovered none of the strict failures. It never turned a strict pass into a fail either.
Qwen's template, in the snapshot we used, asks for an XML-style call rather than JSON, with each value on its own line:
<tool_call>
<function=get_weather>
<parameter=location>
Lisbon
</parameter>
</function>
</tool_call>
We expected this format to break in small ways, such as a missing </parameter> or a JSON object inside the tags. Out of 480 Qwen runs, we found one. In the 32-tool run, mlx_lm's parser labelled a single output malformed, which our strict parser had already scored as a wrong argument. Both counted it as a miss.
But this only holds for these 4-bit MLX builds, these templates and mlx-lm 0.31.3. The vLLM post describes a different stack, and we did not test it.
Thinking mode cut the skipped calls, at 3.57x the latency
The failures were not spread evenly. With thinking off, Qwen was weakest on the category we wrote to be the easiest: a single, obvious call. It scored 52.08% there and 60.42% on enum- and type-sensitive arguments, but 100% on nested and array arguments and 100% on "no tool needed".
With thinking on (enable_thinking=True in the chat template), both of those weak categories went to 100%:
| Setting (8 tools unless noted) | Strict accuracy (95% CI) | Median / p90 s per call | Main failure |
|---|---|---|---|
| Qwen3.6, thinking off | 73.96% (65.28–81.94) | 0.563 / 1.122 | skipped call, 75 runs |
| Qwen3.6, thinking on | 95.83% (91.67–98.96) | 2.009 / 4.059 | skipped call, 4 runs |
| Qwen3.6, thinking off, 32 tools | 66.67% (57.29–76.04) | 0.578 / 1.293 | skipped call, 31 runs |
| Gemma 3 12B, prompted format | 93.06% (88.19–97.22) | 1.478 / 2.705 | wrong or missing arg, 12 runs |
Paired over the same 96 tasks, switching to thinking mode (with its recommended sampling) added 21.88 points. The paired 95% CI runs from 13.54 to 30.56, so this is not seed noise. For comparison, the three thinking-off seeds ranged from 71.88% to 77.08%. One caveat: the thinking condition ran with 1 seed, against 3 for thinking off.
But each mode ran with its own model-card sampling, so the gain can't be credited to thinking alone.
The cost is tokens. The median generation grew from 47.5 to 185 tokens, and none of the 96 thinking runs hit the 1536-token cap. The worst case in the log was a no-tool task that thought for 966 tokens and took 10.30 s.
A 12B model with a prompted format came close
Gemma 3 12B has no tool role in its chat template, so we listed the tools as JSON schema in a system prompt and asked for a fenced tool_call block. That makes it a prompted-format comparison, not like for like with Qwen's native template.
It still scored 93.06% strict, 19.1 points above Qwen with thinking off on the same tasks (paired CI 9.38 to 28.82). Its CI overlaps with Qwen thinking on, so we don't call a winner between those two. Gemma was also the most stable: its seed spread was 1.04 points, against 5.2 for Qwen with thinking off.
Gemma failed in a different way. Of its 20 failed runs, 12 had a wrong or missing argument, 4 added an argument nobody asked for, and only 4 skipped the call. Its weakest category was nested and array arguments (85.42%), which was one of Qwen's two perfect categories.
On our machine, Gemma's median call took 1.478 s, 0.53 s less than Qwen with thinking on. Its peak memory was 12.07 GB against Qwen's 21.7 GB. The lenient parser recovered 0 of Gemma's 20 failures as well, even though its chat template doesn't define the format we gave it.
Why Qwen skips the call, and what a 32-tool menu did
With a 32-tool menu (the 12 real tools plus 20 decoys), Qwen with thinking off dropped from 73.96% to 66.67%. The paired drop is 7.29 points, but its 95% CI runs from -0.35 to 14.93, so on 96 tasks and 1 seed we can't separate it from noise.
The extra misses were the same kind as before: 31 of 32 failures were skipped calls. Only one was a wrong argument, and there was not a single wrong-tool pick among 32 options. The parallel category (two independent calls) fell from 62.5% to 31.25%. Our scorer counts a run that makes only one of two needed calls as a skipped call. The two numbers rest on different seed counts: the 31.25% comes from 16 runs on 1 seed.
We can't see inside the model, so these are hypotheses, not findings:
- Hypothesis 1: without a reasoning step, the model tends to answer what it thinks it already knows (a unit conversion, some arithmetic) instead of deferring to a tool. Thinking gives it room to notice that a tool exists for the job. That would fit the single-call category going from 52.08% to 100%, though that jump also includes the sampling change.
- Hypothesis 2: the model card's sampling for thinking off (temperature 0.7, presence penalty 1.5) affects this choice. We used it as the card recommends and did not vary it, so this is untested.
Either way, the misses were scored as a decision, not a format problem. A more lenient parser did not help.
How we tested
- Apple M3 Max, macOS 27.0.1, Python 3.13.5, mlx 0.31.2, mlx-lm 0.31.3;
mlx-community/Qwen3.6-35B-A3B-4bitandmlx-community/gemma-3-12b-it-4bit. - 96 synthetic tasks (6 categories of 16) against 12 fictional tools, written and frozen before any model ran. Scored on tool name plus expected arguments, with tolerant matchers for free text, arithmetic, city names and times.
- Qwen got its tools through the chat template's
tools=argument; Gemma got a fixed system prompt. Both used sampling from their model cards. The 8-tool menu holds the correct tool plus distractors. - 3 seeds for Qwen thinking off and for Gemma; 1 seed for Qwen thinking on and for the 32-tool run. Runs were sequential on an otherwise idle machine, with 3 warm-up tasks per model. Latency is measured with the shared tool-definition prefix already in the prompt cache.
- 95% CIs come from a bootstrap over tasks (10k resamples).
./run.sh # offline checks, all four conditions, then analysis -> results.json
What this means for you
- If your local Qwen3.6 agent "misses" tool calls in MLX, look at the decision first, not the parser. Log the raw output. On our tasks the scorer labelled the misses
skipped_needed_call, and a more forgiving parser changed nothing. - If correctness matters more than latency, switch to thinking mode. With its recommended sampling, it moved Qwen from 73.96% to 95.83%, and the median per call from 0.563 s to 2.009 s. If you need near-thinking accuracy with less memory and latency than thinking mode, Gemma 3 12B with a prompted format reached 93.06% at 1.478 s and 12.07 GB.
- We did not test vLLM, llama.cpp or other templates and quantisations; these results may not carry over. They also don't cover long multi-turn agent sessions: we tested single-turn calls on synthetic tools. The parse failures in the vLLM post may be real on that stack. Run the suite on yours before choosing what to fix.
Code, raw numbers and charts: https://hackbig.com/blog-data/local-tool-call-accuracy-m3-max/
If you run local agents, what share of your tool-call failures turn out to be parse errors once you look at the raw output, and on which runtime and model?
Code and raw data for this post
How this was made: an AI agent (Claude) designed and ran this experiment on our own MacBook in a sandbox; every number comes from the run's results file (linked below), checked by script before publishing.