Repository navigation
qwen3.8-flash-next: ban the <tool_call> opener when a request declares no tools - #320
Merged
Merged
Conversation
A request with no tools whose system prompt describes tool abilities — clients without native function calling — made qwen3.8-flash-next answer with literal <tool_call> markup nobody can execute (8/8 on rc16, 6/8 in spark mode, job tcrepro). Banning the opener restores a prose answer. - MODEL.toml [behavior] ban_tool_call_without_tools (default false), true on qwen3.8-flash-next. vLLM does not do this. - sampling_setup pushes NEG_INFINITY on tool_call_start_token_id when !tools_active and the model opted in, off under --reference-mode. /v1/messages and /v1/responses reach the same code.
…g_setup The no-tools <tool_call> ban (#320) put a -inf entry in logit_bias, and any non-empty logit_bias took a sequence off the GPU-argmax and fast verify paths (fast_greedy classify_penalties, raw_argmax_is_pick): decode -1.7..-2.4% on every request without tools on the pair. Treat -inf entries as hard bans: banned_ids masks them like the min_tokens end-token ban (fix_raw_picks, mask_row), raw_pick_masked redoes a banned raw pick on the host, and a bias of only hard bans keeps the fast paths. The floor logic stays for the end-token ban only; F2 prepick keys on it alone. sampling_setup.rs was 508 lines: its tool-choice and tool-bias rules move to sampling_setup_tool_rules.rs unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…Behavior's Default Owner decision: banning the <tool_call> opener on requests that declare no tools is the default for every target (a MODEL.toml can still set it false; --reference-mode never applies it). lib.rs was at the 500-line cap, so ModelBehavior's Default impl moves to model_behavior_default.rs. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…l no steering bias Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
Ready. The decode slowdown is gone. What changed:
Pair gate on
CI is green apart from the PR benchmark gate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug: a fresh chat sometimes gets literal tool markup as Qwen3.8-Flash-Next's first reply, e.g.
<tool_call>\n</tool_call>or<tool_call>\n<function=web_search>\n<parameter=queries>….toolswhile its system prompt describes tool abilities, which is what clients without native function calling send.This adds a
[behavior]key,ban_tool_call_without_tools(default false), and ships it true for qwen3.8-flash-next. When a request declares no tools, the<tool_call>opener gets a-inflogit bias:min_tokens_ban;--reference-mode;/v1/messagesand/v1/responses, which all reachbuild_sampling.Requests with tools are unchanged. vLLM doesn't do this; the MODEL.toml comment says so.
Test plan
spark-server bin tests 3047/0. clippy (with and without
--tests) is clean.4 new tests:
Pair repro and fix on reiner + spark2 (TP=EP=2, FP4-Local, default sampling, 8 runs per shape). Receipts are in reiner's
~/code/night1027/out/tcrepro/andtcban/.Runs whose reply contains literal tool markup, main vs this PR:
Native tools, streamed and blocking, give 8/8 clean
tool_callsboth before and after. tool_probe is 21/21.What replies look like now. On rc16 the no-tools replies are short "I'll research…" texts, with the model pretending to look things up, since its system prompt claims it can. In spark mode they're full answers.
KL + bench gate against main (job 01094, running). Prompts without tools can only change where
<tool_call>had probability mass.Generated with Devin