You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Eval bug: forcing full prompt re-processing in Qwen3-Coder-Next #19394
I think OpenCode injects some remainders in the context that have the side effect of trashing the cache of recurrent models. Should be able to fix this by checkpointing a bit earlier:
diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp
index b71d496ee..1de38e950 100644
--- a/tools/server/server-context.cpp+++ b/tools/server/server-context.cpp@@ -2507,7 +2507,7 @@ private:
slot.n_prompt_tokens_processed++;
// process the last few tokens of the prompt separately in order to allow for a checkpoint to be created.
- if (do_checkpoint && slot.task->n_tokens() - slot.prompt.n_tokens() == 64) {+ if (do_checkpoint && slot.task->n_tokens() - slot.prompt.n_tokens() == 1024) {
break;
}
}
Edit: nvm, we actually need to create checkpoints during the generation phase. Something similar to the proposal in #19298, but not during prompt processing, rather during generation.
Reacted by jacekpoplawski, Piotr Wilkin (ilintar) and Anubhav Gupta
Reacted by jacekpoplawski
Reacted by othermod, jacekpoplawski, konekohana and Sven-Hendrik Haase
Reacted by jacekpoplawski and Yadir Hernandez Batista
I think OpenCode injects some remainders in the context that have the side effect of trashing the cache of recurrent models. Should be able to fix this by checkpointing a bit earlier:
Wow, I can’t reproduce this anymore after rebuilding current master with your fix.
Nice. I've seen that the reminders are being injected, but haven't looked to understand the exact logic of OpenCode to inject them, so atm not sure what is the best solution. It's possible that this patch is enough.
I'm running into the same thing with v7955 when playing around with Coder Next in Opencode. Prompt caching works between tool calls within the session but then full re-processing is forced when the model is done and I write another message in the same session. Can also confirm that the patch fixes it for me on v7955!
It can skip creating checkpoints if -batch is less than 1024 (the default is 2048). More robust solution is to make this respect the batch size, such as min(n_batch, 1024).
[39591] slot update_slots: id 0 | task 75 | forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/1lama.cpp/pull/13194#issuecomment-2868343055)
[39591] slot update_slots: id 0 | task 75 | erased invalidated context checkpoint (pos_min = 6892, pos_max = 6892, n
_tokens = 6893, n_swa = 1, size = 75.376 MiB)
This happens with both Qwen3-Coder-Next and Qwen3.5-122B-A10B, likely all similar models.
In my use case there is a very long system prompt (~22k tokens) and cannot afford more than 1 slot due to RAM constraint. Without the prompt cache working these (otherwise perfect) models are not usable in llama.cpp for such use cases.
The same problem persists, not sure why they keep closing it.
Reacted by Konrad Świat, Christopher Dombroski, Alejandro Mujica, siegfried2p, Eduardo Fonseca, Joshua Harding, majick, Alvaro S., Fox E:, Maxim and 1 more
I reproduced this with Qwen3.5-122B-A10B Q4KL, talking through OpenCode in the same context window, and suddenly:
forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055)
Reacted by Konrad Świat, majick, Ralf12358 and Maxim
Both Qwen 3.5 9B and also Gemma 4 26B did it to me today. I'm using the TurboQuant branch from TheTom's repo, which is pretty up to date. Using Claude Code and pointing at llama-server running locally.
slot update_slots: id 0 | task 1008 | forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055)
slot update_slots: id 0 | task 1008 | erased invalidated context checkpoint (pos_min = 8191, pos_max = 8191, n_tokens = 8192, n_swa = 0, pos_next = 0, size = 50.251 MiB)
I have plans to debug exactly what OpenCode is doing and why llama.cpp is getting confused (that's my number one issue with llama.cpp - happens with Gemma 4 31B all the time)
Reacted by ShibeTemple, Alvaro S., Jason Hughes, asf0, 0x62ash, rxgraham, Alex Shapiro and Fox E:
Activity
anubhavgupta commentedon Feb 6, 2026
Getting the same issue in Windows as well. (with both Vulkan and CUDA 13 builds)
CUDA 13 -> llama-b7950-bin-win-cuda-13.1-x64
Vulkan -> llama-b7956-bin-win-vulkan-x64, haven't tested in earlier version.
pwilkin commentedon Feb 6, 2026
Are you using cache prompt? It should fix the problem.
ggerganov commentedon Feb 6, 2026
I think OpenCode injects some remainders in the context that have the side effect of trashing the cache of recurrent models. Should be able to fix this by checkpointing a bit earlier:
Edit: nvm, we actually need to create checkpoints during the generation phase. Something similar to the proposal in #19298, but not during prompt processing, rather during generation.
jacekpoplawski commentedon Feb 6, 2026
Wow, I can’t reproduce this anymore after rebuilding current master with your fix.
jacekpoplawski commentedon Feb 6, 2026
yes, 60000
ggerganov commentedon Feb 6, 2026
Nice. I've seen that the reminders are being injected, but haven't looked to understand the exact logic of OpenCode to inject them, so atm not sure what is the best solution. It's possible that this patch is enough.
pwilkin commentedon Feb 6, 2026
Taking a note of this for #19298 , I guess this should be configurable :)
konekohana commentedon Feb 6, 2026
I'm running into the same thing with v7955 when playing around with Coder Next in Opencode. Prompt caching works between tool calls within the session but then full re-processing is forced when the model is done and I write another message in the same session. Can also confirm that the patch fixes it for me on v7955!
jacekpoplawski commentedon Feb 6, 2026
are there any side effects?
ggerganov commentedon Feb 6, 2026
It can skip creating checkpoints if
-batchis less than 1024 (the default is 2048). More robust solution is to make this respect the batch size, such asmin(n_batch, 1024).ggerganov commentedon Feb 7, 2026
@jacekpoplawski @konekohana Could you provide feedback if #19408 works OK?
kj-c0d3s commentedon Feb 8, 2026
This did not fix it for me. What information would I need to provide to help. Fresh build just now at 5pm est 2/8
kripper commentedon Feb 16, 2026
llama-server complete logs
3 remaining items
kripper commentedon Mar 2, 2026
Maybe -1 doesn't reserve ram for the cache, so it is used for other purposes and not available when required.
ShibeTemple commentedon Mar 4, 2026
What cache value are you using now? I'm running into the same problems.
kripper commentedon Mar 5, 2026
The 16 GB I had left, before RAM swapping and OOM killer started to kick in.
ShibeTemple commentedon Mar 5, 2026
[39591] slot update_slots: id 0 | task 75 | forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/1lama.cpp/pull/13194#issuecomment-2868343055)
[39591] slot update_slots: id 0 | task 75 | erased invalidated context checkpoint (pos_min = 6892, pos_max = 6892, n
_tokens = 6893, n_swa = 1, size = 75.376 MiB)
#13194
CONFIGURATION:
LLAMA-CLI --VERSION: 8211 (a0ed91a)
model = Qwen3-Coder-Next-UD-Q6_K_XL-00001-of-00003.gguf
n-gpu-layers = 999
ctx-size = 128000
temp = 1.0
top-p = 0.95
top-k = 40
min-p = 0.01
threads = 12
flash-attn = on
mlock = off
mmap = off
fit = off
warmup = off
batch-size = 4096
ubatch-size = 512
cache-type-k = q8_0
cache-type-v = q8_0
jinja = true
direct-io = on
cache-prompt = true
cache-reuse = 256
cache-ram = 5000
Still getting the same issue with non -1 fixed ram cache size in params. Would appreciate direction here.
kripper commentedon Mar 6, 2026
Does it occur less often if you increase cache-ram ?
Does it occur under certain conditions, like when the agent is condensing the prompt?
viktor-ferenczi commentedon Mar 8, 2026
This happens with both
Qwen3-Coder-NextandQwen3.5-122B-A10B, likely all similar models.In my use case there is a very long system prompt (~22k tokens) and cannot afford more than 1 slot due to RAM constraint. Without the prompt cache working these (otherwise perfect) models are not usable in
llama.cppfor such use cases.asf0 commentedon Mar 24, 2026
The same problem persists, not sure why they keep closing it.
Ezzz-dev commentedon Mar 31, 2026
I reproduced this with Qwen3.5-122B-A10B Q4KL, talking through OpenCode in the same context window, and suddenly:
forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055)jhughes2112 commentedon Apr 15, 2026
Both Qwen 3.5 9B and also Gemma 4 26B did it to me today. I'm using the TurboQuant branch from TheTom's repo, which is pretty up to date. Using Claude Code and pointing at llama-server running locally.
jacekpoplawski commentedon Apr 15, 2026
I have plans to debug exactly what OpenCode is doing and why llama.cpp is getting confused (that's my number one issue with llama.cpp - happens with Gemma 4 31B all the time)
jacekpoplawski commentedon Apr 17, 2026
The first problem with opencode is model-independent, for some reason opencode is moving system-reminder from place to place.
To reproduce:
notice unnecessary prompt processing - system-reminder is moving from the middle to the last part of prompt
server: fix context checkpoint restore for hybrid/recurrent models
corrm commentedon May 13, 2026
Same problem with Qwen3.6 27B:
jacekpoplawski commentedon May 13, 2026
Please test this solution #22929
de-flandres commentedon May 28, 2026
Still happening on