Repository navigation
Description
Name and Version
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 16368 MiB):
Device 0: AMD Radeon RX 6900 XT, gfx1030 (0x1030), VMM: no, Wave Size: 32, VRAM: 16368 MiB
version: 8461 (cea560f)
built with GNU 15.2.0 for Linux x86_64
Operating systems
Linux
GGML backends
HIP
Hardware
CPU: AMD Ryzen 9 5950X
GPU: AMD Radeon RX 6900 XT
OS: NixOS 26.05 (Yarara) x86_64
I think the GGML backend is HIP because that's what the nixpkgs package llama-cpp-rocm enables - https://github.com/NixOS/nixpkgs/blob/a1e8ce6b50ffa87ad0d39881c47eb214982330dc/pkgs/by-name/ll/llama-cpp/package.nix
Models
unsloth Qwen3.5-9B-UD-Q4_K_XL
https://huggingface.co/unsloth/Qwen3.5-9B-GGUF
Problem description & steps to reproduce
I'm running llama.cpp server with the command:
llama-server --port 8001 --models-preset ~/llama.cpp/models.ini --host 0.0.0.0
My models.ini contains:
version = 1
kv-unified = true
cache-type-k = q8_0
cache-type-v = q8_0
[Qwen3.5-9B-UD-Q4-Coding]
model = /home/user/llama.cpp/unsloth/qwen3.5-9b-ud-q4_k_xl/unsloth_Qwen3.5-9B-GGUF_Qwen3.5-9B-UD-Q4_K_XL.gguf
mmproj = /home/user/llama.cpp/unsloth/qwen3.5-9b-ud-q4_k_xl/unsloth_Qwen3.5-9B-GGUF_mmproj-BF16.gguf
alias = Qwen3.5-9B-UD-Q4-Coding
ctx-size = 131072
fit = on
flash-attn = true
chat-template-kwargs = {"enable_thinking":true}
temp = 0.6
top-p = 0.95
top-k = 20
min-p = 0.00
presence-penalty = 0.0
repeat-penalty = 1.0Then I use the Zed editor to connect to my model from another computer. Here's the relevant bits of my chat with it using Zed's feature to export your agent chat to markdown:
Chat markdown
## User
What tools do you have?
## Assistant
<thinking>
The user is asking about what tools I have available. I should provide a clear, helpful summary of the tools I can use, formatted nicely in markdown. I don't need to use any tools for this - I can just explain them from the information I have.
</thinking>
I have access to several tools that can help you work with code and projects. Here's what I can do:
## File Operations
- **`read_file`** - Read the content of files in your project. If files are large, I'll get an outline with line numbers so we can dive into specific sections.
- **`list_directory`** - List the contents of a directory to explore the project structure.
- **`find_path`** - Fast file path matching using glob patterns (e.g., `**/*.rs` to find all Rust files). Great for locating files by name.
- **`grep`** - Search file contents using regular expressions. Prefer this over path search when looking for symbols or specific code patterns.
## Project Diagnostics
- **`diagnostics`** - Get errors and warnings for the project or a specific file. Useful for checking the health of your code after making changes.
## Web & Network
- **`fetch`** - Fetch URLs and return the content as Markdown. Handy for loading documentation or external resources.
- **`open`** - Open files or URLs with your default application (browser, text editor, etc.).
## System Tools
- **`now`** - Get the current datetime in RFC 3339 format (UTC or local time).
## Advanced
- **`spawn_agent`** - Delegate tasks to agents when you need parallel work or complex tasks that benefit from a dedicated session.
---
All of these tools are designed to work with your project in the root directory `/path/to/project`. Just let me know what you're working on and I can help you navigate and manipulate the code!
## User
Read through [@main.nu](file:///path/to/project/main.nu) and give me a summary of what it does
## Assistant
<thinking>
I need to read the actual content of main.nu file to provide a summary - the file outline only shows 7 symbols which is not enough detail.
</thinking>
I can see the file outline shows this is a Nushell script with some notes about <omitted>. However, I only see a file outline with symbol names. Let me read the full content to give you a comprehensive summary.
**Tool Call: Read file `main.nu`**
Status: Completed
```main.nu
SUCCESS: File outline retrieved. This file is too large to read all at once, so the outline below shows the file's structure with line numbers.
IMPORTANT: Do NOT retry this call without line numbers - you will get the same outline.
Instead, use the line numbers below to read specific sections by calling this tool again with start_line and end_line parameters.
# File outline for /path/to/project/main.nu
<omitted>
Showing symbols 1-7 (total symbols: 7)
NEXT STEPS: To read a specific symbol's implementation, call read_file with the same path plus start_line and end_line from the outline above.
For example, to read a function shown as [L100-150], use start_line: 100 and end_line: 150.
```
## Assistant
<thinking>
The file is too large and I only see a structure outline. I need to read specific sections. Let me start from the beginning to understand the overall structure.
<tool_call>
<function=read_file>
<parameter=path>
main.nu
</parameter>
<parameter=start_line>
1
</parameter>
<parameter=end_line>
100
</parameter>
</function>
</tool_call>
</thinking>After the agent prints the tool call in XML it simply stops running as if it's finished.
Sometimes it succeeds making one tool call, but then it starts printing XML and I give up on it. I have no idea if it may or may not make another successful call if you try enough times after it starts printing XML.
However, if I disable thinking with chat-template-kwargs = {"enable_thinking":false}, then it makes all its tool calls without problems (at least as far as I've tested), e.g. it can read the whole 1000-line file in several consecutive tool calls.
I've also tried running llama-server with the flag --no-cache-prompt as mentioned in #20614 but that had no effect.
I think the same or similar issue is also reported here
ollama/ollama#14745
ollama/ollama#14493
First Bad Commit
I've had this problem since llama.cpp 8255. I haven't tried earlier versions.
Relevant log output
Here's the log from llama-server from running the model until the XML tool call. It shows that it's served several requests because the model actually tried to read the file multiple times but it got the path wrong. When it finally got it right, that's when it printed the XML.
Activity
github-actions commentedon Mar 21, 2026
This issue might be similar or related to the following issue(s):
This comment was auto-generated locally using llama.cpp version: 8456 (b31b30f) on NVIDIA DGX Spark
kik4444 commentedon Mar 21, 2026
Could it be that the problem only happens when a tool call is made inside a thinking block?
[-]Eval bug: Qwen3.5 9B often prints tool calls in XML and stops when thinking is enabled[/-][+]Eval bug: Qwen3.5 9B often prints tool calls in XML and stops when thinking is enabled - tool calls inside thinking block[/+]pwilkin commentedon Mar 21, 2026
Yes, this is an issue that I'll be working on now that #20424 is merged. The problem is that the grammar trigger is independent from the reasoning parser and the grammar forces
<eog>when it's done reading what it considers a tool call, so the model can't generate further (it should close the thinking block and redo the tool call properly within the normal content block).arthuz-th commentedon Mar 21, 2026
I think I’m hitting the same underlying bug, but through a different stack.
My setup:
Claude Code
LM Studio on Windows
qwen/qwen3.5-35b-a3b
thinking enabled
What I’m seeing:
plain /v1/messages text responses work
streaming works
simple tool-use requests can work
but in longer agentic/tool-heavy sessions, the model sometimes places a fake XML-like tool call inside the thinking block instead of returning a real structured tool_use block
the response then ends with stop_reason: "end_turn", so the client treats it as finished
So from the client side it looks like the model decides to use a tool, but only describes the tool call inside thinking rather than emitting an actual tool call payload.
This seems very similar to the issue described here, especially the “tool calls inside thinking block” behavior.
pwilkin commentedon Mar 21, 2026
Yes, this affects all models that have a tendency to add tool calls within thinking blocks, either by mistake or by "preparing" a tool call in thinking.
markqvist commentedon Mar 22, 2026
This behavior manifests across all models in the Qwen3.5 family, although it seems very particularly common on 35B-A3B and 122B-A10B. As others have noted, once it hits
</tool_call>(even though it's weirdly inside the reasoning block, output stops.As far as I understand the parsing architecture of
llama.cpp, even if the model continued generating, the tool call would never get parsed and returned as an actual tool call, and handling it properly inllama.cpp's parser would require a bit of a rewrite to the flow, or specific handling logic for Qwen3.5 models, since the tool-call parsing is invoked after (and separately from) reasoning block parsing.I was considering doing a PR for handling this, but realizing that it wasn't really possible to fix surgically, I resorted to adding a "quirks handling" system in Humanity's Last Command, with a specific quirk handler for Qwen3.5 that fixes the issue locally.
Technically, it's quite easy to handle, and you can probably apply the "tool thought" handler to just about any downstream app, if it has similar functionality to
lc's quirks handling.Having proper handling directly in
llama.cppwould be pretty sweet though, and if maintainers give the thumbs up, I'd consider adding a PR to handle it.But honestly, I think it's questionable whether such weird model behavior should actually be "fixed" inside
llama.cpp's parsing logic, since it's kinda breaks the existing assumptions of the parsers.pwilkin commentedon Mar 22, 2026
@markqvist try PR above
aldehir commentedon Mar 22, 2026
This implementation and the one in vLLM will emit any tool calls in the reasoning as a real tool call (feel free to correct me if I'm wrong). I took a look at the sglang implementation and it doesn't appear to do the same. The reasoning parser will consume those tokens, so the tool calling parser never sees them. I'm not 100% sure, but I assume this is the reference implementation and one we should adopt.
heavycharged commentedon Mar 27, 2026
I stuck with the same issue i guess. Zed + llama.cpp (b8547, b8548 either not yet build or missing file for download). It just stops work, if you ask again, result in the same attempt to make tool_call but nothing happened. I can provide more info if needed, just ask, because it's matter of 1-2 minutes to reproduce this one.
unsloth\Qwen3.5-35B-A3B-UD-IQ4_NL.gguf(also was onQ4_K_M)upd: i also got this bug on GLM4.7-Flash, but it was after like 5-7 minutes. On Qwen model it appears very fast, which is sad, because this is the best model that fits consumer hardware.
What version don't have this regression? I saw on Reddit that b8227 has new parser where this bug was introduced, but i rollback to one lower version and still has errors (different ones, works even worse).
43 remaining items
Add interleaved_reasoning option to openai compatible models (zed-ind…
Sensenkawa commentedon Jul 8, 2026
Custom jinja template test results on Qwen3.6-35B-A3B
Model: Qwen3.6-35B-A3B (APEX I-Compact, 17GB, 8GB VRAM)
llama.cpp: b9536 (308f61c)
Template:
qwen-3.5-35b.jinja.txtby @mikecoker from this threadServer:
--jinja --chat-template-file qwen-thinking-fix.jinjaTest Results
Analysis
reasoning_contenttocontent—reasoning_contentis always 0 charsWorking Workaround
chat_template_kwargs: {"enable_thinking": False}per-request completely resolves all issues:Version Info
This was tested on Qwen3.6 (not Qwen3.5). The template may work better on Qwen3.5 as confirmed by @heipei.
Sensenkawa commentedon Jul 8, 2026
Test results:
--reasoning-format none+ thinking ON on Qwen3.6-35B-A3BModel: Qwen3.6-35B-A3B (APEX I-Compact, 17GB, 8GB VRAM)
llama.cpp: b9536 (308f61c)
Server:
--jinja --reasoning-format none --spec-type draft-mtp --temp 0.9Test: complex Chinese tool-calling prompt (write_file + path + content)
We tested 3 temperatures × 3 runs each with thinking ON (no
chat_template_kwargsoverride).Results
"Perfect" = write_file executed + correct path + correct filename + correct content + zero name corruptions + no thinking tags visible in output.
Key findings
--reasoning-format nonemakes thinking ON + tool calling work — tool calls are no longer swallowed by the reasoning parser. Content is always non-empty.temp 0.8 is the sweet spot — 67% perfect rate, fastest average time at 48s.
Name degradation still occurs — when the model generates long thinking chains (~103 corruptions at 0.9 R1), name fidelity suffers. This appears correlated with chain length, not temperature directly.
Thinking tags are NOT visible in content — contrary to the help text description ("leaves thoughts unparsed in message.content"), the output is clean.
Comparison with thinking OFF
Trade-off
--reasoning-format noneis a viable workaround for thinking ON + tool calling. It's significantly slower and less reliable than disabling thinking entirely, but it preserves the model's reasoning capability for tasks that benefit from it.Tested on Qwen3.6 (not Qwen3.5). Would be interesting to see if results differ on other versions.
Sensenkawa commentedon Jul 9, 2026
Regression report: b9933
--mlockfailure and 70% speed drop on 8GB VRAM + Q4_K_MModel: Qwen3.6-35B-A3B-UD-Q4_K_M (22GB, 8GB VRAM, RTX 4060)
llama.cpp: b9933 (92366df, built with Clang 20.1.8)
Test: prompt processing + generation throughput benchmark
Observations
1.
--mlockfails with "system resources insufficient"This happens consistently across reboots. On b9536,
--mlockworks fine with the same model and hardware.2. Generation speed drops 70-78% across all modes
3. GPU stuck at low power state
During inference: GPU clock 1890 MHz / 16W (full: 2625 MHz / 47W). Only 1/3 of expected power. The Bubbles screen saver wake trick doesn't help. b9536 runs at full speed on the same hardware.
Analysis
The root cause appears to be a combination of:
--no-mmapconsumes more VRAM in b9933 → RealSim OOM--mlockunavailable → CPU page faults slow down inferenceMost changes in b9933 are in Vulkan/OpenCL/WebGPU backends, unrelated to CUDA. The regression likely comes from a build/linking change (Clang 20.1.8?) or an unintended side effect in the CUDA path.
Workaround
Stay on b9536. No known workaround for b9933 on this configuration.
Hardware: RTX 4060 8GB, Intel Ultra 5 125H, Windows 11
llama.cpp: b9933 (92366df)
Sensenkawa commentedon Jul 9, 2026
Update: confirmed APEX I-Compact (17GB) also affected
We tested a second model to isolate the root cause. APEX I-Compact (17GB, fits entirely in 8GB VRAM with room to spare) on b9933:
--mlockworks (only fails on 22GB Q4_K_M in 8GB VRAM)This confirms the regression is NOT specific to Q4_K_M's VRAM pressure:
b9933 prevents the GPU from boosting (1890 MHz ceiling instead of 2625 MHz) regardless of model size. Likely a CUDA driver interaction issue introduced between b9536 and b9933.
Recommendation: Stay on b9536 until this is resolved.
Sensenkawa commentedon Jul 9, 2026
Update: Enhanced chat template tested on llama.cpp with Qwen3.6-35B-A3B (8GB VRAM)
After our reports on
--reasoning-format none, we tested the communityqwen3.6-enhanced.jinjatemplate from the vLLM ecosystem.The template (allanchan339's qwen3.6-enhanced.jinja) has excellent features:
thinkingtags before<tool_call>However, on 8GB VRAM with llama.cpp + APEX I-Compact (17GB):
When thinking=ON + the template's
thinkingprefill:When thinking=OFF (enable_thinking=false):
thinking\n\n response\n\nblock in the generation promptConclusion for llama.cpp users with limited VRAM:
--reasoning-format nonealone (no custom template) gives the best resultsAlso regarding b9933:
We tested b9933 on RTX 4060 8GB and found severe regressions:
--mlockfails with "system resources insufficient" on 22GB Q4_K_M (works on b9536)Full details at Eval bug: Qwen3.5 9B often prints tool calls in XML and stops when thinking is enabled - tool calls inside thinking block #20837 (comment)
Hope this helps others with similar hardware constraints.
Sensenkawa commentedon Jul 13, 2026
Follow-up: Bug 123 resolved with Ornith-1.0-35B (RL-optimized Qwen3.6 variant)
After extensive testing on Qwen3.6-35B-A3B (8GB VRAM, llama.cpp b9536), I identified three core bugs with thinking ON + tool calling:
Tested mitigations (no full fix):
--reasoning-format none→ fixes Bug 1 but not 2 or 3Ornith-1.0-35B changes the picture
Ornith-1.0-35B is an RL-optimized variant of Qwen3.6-35B (Terminal-Bench 64.2 vs 52.5). Tested with multi-turn interactive framework (max 5 turns, tool execution + result return):
Key limitation
Ornith uses 7+ different tool call formats (XML
<write_file>with/without closing tags, JSON arrays[{"name":"write_file","arguments":{}}], JSON objects{"path":"..."}, python-stylewrite_file(path=...)). This suggests the RL training exposed it to inconsistent tool-calling data. The model always gets the content right (path, filename, zero degradation) but varies how it expresses the call.Bottom line
Sensenkawa commentedon Jul 16, 2026
Regression report: b10042 CUDA speed regression on 8GB VRAM (RTX 4060)
b10042 升级回归报告(2026-07-16)
概述
b10042(2026-07-16 升级)→ 全线速度异常。已回滚至 b9536。
速度对比
Ornith moe28
APEX moe33
根因分析
1. b10042 的 CUDA 实现变小了
CUDA 核心库缩小 9%,可能移除了部分 GPU kernel 优化,或改用了更保守的 CUDA graph 编译策略。
2. 任务全被 cancel 的原因
不是新 bug——是每个请求的处理速度骤降,导致 Python benchmark 脚本的 HTTP 超时(120s/300s)被触发,客户端断开连接后 server 记录 "cancel task"。
3. tg_3s 新指标
b10042 新增
tg_3s字段(3 秒窗口内的生成速度),说明新版改变了任务时序监控机制,可能与速度回归有关。结论
b10042 在 8GB VRAM 场景下不可用。 ggml-cuda.dll 缩小 9% 后,笔记本 GPU 的 CUDA graph 性能大幅退化。已回滚至 b9536。
回滚验证:
./bin-b9536/llama-server.exe --version→version: 9536Add interleaved_reasoning option to openai compatible models (zed-ind…
Sensenkawa commentedon Jul 18, 2026
Correction: the fix was removing DRY, not Ornith itself
In my previous report (comment #4958517549) I said "Bug 123 resolved with Ornith-1.0-35B". This was misleading — the real fix was removing DRY parameters, not switching to Ornith.
After further cross-model testing, the actual findings are:
Ornith just happened to not have DRY in its config. When we removed DRY from the Qwen3.6 configs, they performed identically well — all three bugs (empty content, name degeneration, infinite loop) and path transcription errors were 100% resolved.
See the full DRY analysis on #15066:
Takeaway: DRY with thinking ON is actively harmful for tool-use scenarios across all tested models. The trade-off between repetition prevention and path/tool degeneration is not worth it when thinking is enabled.
dumitru-nicolae-marasoiu commentedon Aug 10, 2026
i have this situation of xml tool calling in thinking mode very often with qwen 3.6-27B. I have no DRY:
xxxajk commentedon Aug 10, 2026
3 turns isn't proof of a fix, at all. When it does 30 turns, and is 100k into context, and doesn't go off in the weeds, I'll consider it worth my time.
ALL these llm's even on the big-boy clouds screw up and go off into the weeds.
IMHO, it's not the harness, not llama.cpp, it's crummy RL/HRL and poor tuning before release.
My issue is that there's always one part that's broken.
Tool calls that don't go back to reasoning is a huge deal breaker, messes up workflows. Unreliable broken toys.
for one-off summaries, or poetry, fine. but not real actual work, for that you need a human.
0DukePan commentedon Sep 7, 2026
I reproduced this on the exact bug-era build and model from this report (
b8461/cea560f,unsloth/Qwen3.5-9B-UD-Q4_K_XLGGUF) with thinking enabled (this model's chat-template default). In a multi-turn agent loop it did precisely what's described here:list_directorytool call is parsed and executed successfully.read_filecall (<tool_call><function=read_file>...) inside the thinking block, then stops —finish_reason: stop, withtool_callsentirely absent from the response message.Observation for a potential fix:
It appears the server splits the output on the closing
</think>tag and routes everything before it intoreasoning_content— while downstream tool-call parsing only inspectscontent. As a result, a syntactically complete XML tool call inside the thinking block never reaches the tool parser, and the client receives a well-formed 200 response that looks as if "the model chose not to act." This also explains why single-turn prompts mostly work: the issue appears when the model starts planning its next call inside the thinking block after an earlier success.I captured the raw provider responses (pre-processing) for both non-streaming and streaming failures. The reproduction protocol and full evidence are available here:
Happy to attach either raw response directly to this thread if needed.
chat : allow tool calls inside reasoning blocks for Ministral-3 (ggml…