Eval bug: Tool calling on qwen3.5 often triggers a promp reprocessing in the next turn
Name and Version
$ ./llama-cli.exe --version ggml_cuda_init: found 1 CUDA devices (Total VRAM: 48934 MiB): Device 0: NVIDIA RTX PRO 5000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 48934 MiB version: 8792 (f4b5bf2f3) built with MSVC 19.44.35225.0 for x64
Operating systems
Windows
GGML backends
CUDA
Hardware
Ryzen 7800 + Blackwell Pro 5000
Models
all Qwen3.5
Problem description & steps to reproduce
When a promt includes tool calls, the next turn will be very often forced to reprocess the whole promt.
First Bad Commit
No response
Relevant log output
There is nothing special in the log apart from the information that the checkpoints are getting erased and that the promt is getting reprocessed.
I assume you are using some harness like OpenCode?
Opencode is known to "eat"
Some other ones have similar issue, so it might be harness issue, afaik its not a problem with llamacpp.
You can try and use reasoning-format to deepseek i think with qwen3.5 so it parses
I can also see this issue on Pi Coding Agent, but it's sporadic. Sometimes it caches, sometimes it has to reprocess. I haven't found the pattern yet.
try this template fix: https://www.reddit.com/r/LocalLLaMA/comments/1sg076h/i_tracked_a_major_cache_reuse_issue_down_to_qwen/
Actually I was just using Llama.cpp with tools. Simple ones, like get date. When used muiltiple times in a chat is already enough to trigger the reprocessing.
try this template fix: https://www.reddit.com/r/LocalLLaMA/comments/1sg076h/i_tracked_a_major_cache_reuse_issue_down_to_qwen/
already done that
It is really sime to reproduce this:
- Hook up the most simple tool in the mcp setting of the llama.cpp frontend
- start to chat with your model. As soon as there are some tool calls in the chat, the prompt is almost guaranteed to reprocess
While this might not be a big deal for small models, f[r big models half offloaded on RAM this for sure is very problematic.
This is by design. The template preserves reasoning between tool calls if they occur after the last user message. However, once a new user message comes in, the previous assistant messages are stripped of their reasoning traces which triggers prompt reprocessing.
Almost all modern reasoning models work this way, it's how they can guide themselves in an agentic loop.
You can modify the chat template to circumvent this, but you'll likely lose model performance, e.g. it will be "lazy".
Why does it only happen sometimes, then?
Why does it only happen sometimes, then?
I couldn't tell you without a payload showing the messages list, only that this is expected behavior when tool calling with "interleaved reasoning" models. Although I wouldn't expect it to reprocess the entire prompt unless the entire prompt is a single agentic loop of interleaving reasoning traces and tool calls.
Is there a way to dump actual model input in the server?
Do you mean obtain the prompt that is fed to the model? I've been doing this often to capture raw model input/output:
$ curl http://localhost:8080/apply-template -d '{"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}]}' > prompt.txt
$ curl http://localhost:8080/v1/completions -d @prompt.txt
This is by design. The template preserves reasoning between tool calls if they occur after the last user message. However, once a new user message comes in, the previous assistant messages are stripped of their reasoning traces which triggers prompt reprocessing.
Almost all modern reasoning models work this way, it's how they can guide themselves in an agentic loop.
You can modify the chat template to circumvent this, but you'll likely lose model performance, e.g. it will be "lazy".
Well, but this however also happens with reasoning completly disabled. To me it appeared totally independent of whether reasoning is enabled or not.
Do you mean obtain the prompt that is fed to the model? I've been doing this often to capture raw model input/output:
$ curl http://localhost:8080/apply-template -d '{"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}]}' > prompt.txt $ curl http://localhost:8080/v1/completions -d @prompt.txt
Could you please elaborate a little more? I do not understand how you are interacting here. How would you talk to the model in what you just posted?
It's only helpful for inspecting the generated prompt and how it responds when you add additional messages. You can check the common prefix and see if the prompt changes despite no semantic change (e.g., reasoning disabled but template still changes after a user message).
Yes, but how is that supposed to work, when the mcp connection is done by the llama.cpp frontend, when you are not using that frontend?
I'm sorry for the misunderstanding. That comment was directed at @0cc4m if he was interested in digging further. It has no applicability to the normal user.
Ok thanks bro
في الجمعة، 17 أبريل 2026 18:27 Aldehir Rojas @.***> كتب:
aldehir left a comment (ggml-org/llama.cpp#21903) https://github.com/ggml-org/llama.cpp/issues/21903#issuecomment-4270008933
I'm sorry for the misunderstanding. That comment was directed at @0cc4m https://github.com/0cc4m if he was interested in digging further. It has no applicability to the normal user.
— Reply to this email directly, view it on GitHub https://github.com/ggml-org/llama.cpp/issues/21903?email_source=notifications&email_token=CBTQ2IQWR4FSVELCWIPLJP34WJSP3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGAYDAOBZGMZ2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-4270008933, or unsubscribe https://github.com/notifications/unsubscribe-auth/CBTQ2IQD2XZPDXGHU56Y2JT4WJSP3AVCNFSM6AAAAACXY4Z6S6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENZQGAYDQOJTGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
reprocessing AGENTS.md every time...