← Back to Pull requests

Keep Qwen tool calls working on follow-up turns #806

Open
unknown opened this pull request with 369 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 06, 2026 10:12 UTC
Author

When the eval asked “And the weather in Berlin?”, Qwen said “Let me check the weather in Berlin.” On main the client received no call. With this change, it received the Berlin weather request.

Our voice prompt asks for Python-style tool calls. Qwen’s chat template shows past calls in a different format. This change shows Qwen earlier calls in the format the voice prompt taught it, while preserving the stored calls, results and IDs. The streaming parser also accepts Qwen’s native function tags and uses the tool’s schema to read the arguments. The ZeroGPU worker gets the same history and tool instructions.

What changed in the eval

I ran one greedy pass on the same Qwen3.5-4B 4-bit weights as the Mac report, using MLX on a Linux RTX 5090 and the repo’s 11 tools. The comparison was main (f99d316b) against 71c123a8, with the MLX cache fix on both. Scenarios and commands

| MLX result | Main | Revised |
|---|---:|---:|
| Expected calls delivered across three conversations | 3/22 | 22/22 |
| Expected calls delivered after the opening request | 0/19 | 19/19 |
| Opening requests with both speech text and a call | 23/24 | 23/24 |
| Requested opening movement, dance or expression delivered | 5/6 | 5/6 |
| Unneeded calls on four tool-free turns | 0 | 1 |
| Median model time on the 24 openings | 1.21 s | 1.15 s |
| Median model time across the 26 conversation requests | 2.11 s | 2.97 s |

All 24 first responses matched main, down to the call arguments. Both missed “Look to your right.” After the excited-face result, the revised model also asked to dance and move its head up before stopping. Its unnecessary call was a web search for “Tell me a joke.”

Both versions send the retained history on each request. For identical histories, the revised format used fewer tokens on every later request in this run. Successful calls, their results and the assistant’s replies added 136 tokens per request on average. A warmed replay holding the format fixed measured an extra 0.13 s to the first token. Longer history has a measurable cost. The replay cannot account for the whole 0.86 s difference in complete-response medians. Mac prompt lengths were verified, but memory pressure prevented a comparable Mac timing run.

Parsing native tags alone delivered 15/22 expected calls on Transformers. The full change delivered 22/22, up from 4/22 on main. The previous native-template approach produced both speech text and a call on only 3/24 MLX openings. The ZeroGPU worker delivered the Oslo and Madrid calls on local CUDA with this revision. We have yet to verify a hosted Space allocation.

The five independent changes are open separately in #899 (Transformers stop tokens), #900 (API startup token limits), #901 (direct-audio startup), #902 (vision thinking setting) and #903 (MLX cache cleanup).

Diff: 369 lines (+276 / -93) across 4 files Reviewer: jackboyla Review duration: 41419m
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 369 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.354
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #806"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.8% (MEDIUM) · Higher = larger blast radius
42.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 22.8% · Safe to merge
22.8%