Repository navigation
Description
Name and Version
(base) root@user1-ASUS-D500TC-S501MC:~/data/AI/llama.cpp# ./build/bin/llama-server --version
ggml_cuda_init: found 1 CUDA devices:
slot update_slots: ... forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory)
slot update_slots: ... erased invalidated context checkpoint (pos_min = 19255, pos_max = 19255, n_swa = 1, size = 75.376 MiB)
slot update_slots: ... n_tokens = 0, memory_seq_rm [0, end)
开启命令:
CUDA_VISIBLE_DEVICES=0 nice -n -10 ./build/bin/llama-server --model /root/Qwen3-Coder-Next-UD-TQ1_0.gguf --ctx_size 128000 --cache-type-k q4_0 --cache-type-v q4_0 --flash-attn on --port 8001 --api-key chat --batch-size 2048 --ubatch-size 512 --parallel 1 --mlock --no-mmap --threads 8 --cache-ram -1 --ctx-checkpoints 32 --host 0.0.0.0 --slot-save-path /tmp/qwen_slots
Operating systems
Linux
GGML backends
CUDA
Hardware
Device 0: NVIDIA GeForce RTX 3060, compute capability 8.6, VMM: yes
version: 8124 (3571565)
built with GNU 11.4.0 for Linux x86_64
(base) root@user1-ASUS-D500TC-S501MC:~/data/AI/llama.cpp# lscpu
架构: x86_64
CPU 运行模式: 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
字节序: Little Endian
CPU: 16
在线 CPU 列表: 0-15
厂商 ID: GenuineIntel
型号名称: 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz
CPU 系列: 6
型号: 167
每个核的线程数: 2
每个座的核数: 8
座: 1
步进: 1
CPU 最大 MHz: 4900.0000
CPU 最小 MHz: 800.0000
BogoMIPS: 4992.00
标记: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon
pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2
x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ep
t_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap avx512ifma clflushopt intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xg
etbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg
avx512_vpopcntdq rdpid fsrm md_clear flush_l1d arch_capabilities
Virtualization features:
虚拟化: VT-x
Caches (sum of all):
L1d: 384 KiB (8 instances)
L1i: 256 KiB (8 instances)
L2: 4 MiB (8 instances)
L3: 16 MiB (1 instance)
NUMA:
NUMA 节点: 1
NUMA 节点0 CPU: 0-15
Vulnerabilities:
Gather data sampling: Mitigation; Microcode
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Reg file data sampling: Not affected
Retbleed: Mitigation; Enhanced IBRS
Spec rstack overflow: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Srbds: Not affected
Tsx async abort: Not affected
Models
Problem description & steps to reproduce
每次推理都会有forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory)这个错误,我在使用openclaw时发现了这个问题
First Bad Commit
No response
Relevant log output
执行片段
srv init: init: chat template, thinking = 0 main: model loaded main: server is listening on http://0.0.0.0:8001 main: starting the main loop... srv update_slots: all slots are idle srv params_from_: Chat format: peg-constructed slot get_availabl: id 0 | task -1 | selected slot by LRU, t_last = -1 slot launch_slot_: id 0 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> temp-ext -> dist slot launch_slot_: id 0 | task 0 | processing task, is_child = 0 slot update_slots: id 0 | task 0 | new prompt, n_ctx_slot = 128000, n_keep = 0, task.n_tokens = 19892 slot update_slots: id 0 | task 0 | n_tokens = 0, memory_seq_rm [0, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.102956 slot update_slots: id 0 | task 0 | n_tokens = 2048, memory_seq_rm [2048, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.205912 slot update_slots: id 0 | task 0 | n_tokens = 4096, memory_seq_rm [4096, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 6144, batch.n_tokens = 2048, progress = 0.308868 slot update_slots: id 0 | task 0 | n_tokens = 6144, memory_seq_rm [6144, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 8192, batch.n_tokens = 2048, progress = 0.411824 slot update_slots: id 0 | task 0 | n_tokens = 8192, memory_seq_rm [8192, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 10240, batch.n_tokens = 2048, progress = 0.514780 slot update_slots: id 0 | task 0 | n_tokens = 10240, memory_seq_rm [10240, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 12288, batch.n_tokens = 2048, progress = 0.617736 slot update_slots: id 0 | task 0 | n_tokens = 12288, memory_seq_rm [12288, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 14336, batch.n_tokens = 2048, progress = 0.720692 slot update_slots: id 0 | task 0 | n_tokens = 14336, memory_seq_rm [14336, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 16384, batch.n_tokens = 2048, progress = 0.823648 slot update_slots: id 0 | task 0 | n_tokens = 16384, memory_seq_rm [16384, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 18432, batch.n_tokens = 2048, progress = 0.926604 slot update_slots: id 0 | task 0 | n_tokens = 18432, memory_seq_rm [18432, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 19380, batch.n_tokens = 948, progress = 0.974261 slot update_slots: id 0 | task 0 | n_tokens = 19380, memory_seq_rm [19380, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 19892, batch.n_tokens = 512, progress = 1.000000 slot update_slots: id 0 | task 0 | prompt done, n_tokens = 19892, batch.n_tokens = 512 slot init_sampler: id 0 | task 0 | init sampler, took 1.57 ms, tokens: text = 19892, total = 19892 slot update_slots: id 0 | task 0 | created context checkpoint 1 of 32 (pos_min = 19379, pos_max = 19379, size = 75.376 MiB) slot print_timing: id 0 | task 0 | prompt eval time = 90234.73 ms / 19892 tokens ( 4.54 ms per token, 220.45 tokens per second) eval time = 480.39 ms / 15 tokens ( 32.03 ms per token, 31.22 tokens per second) total time = 90715.12 ms / 19907 tokens slot release: id 0 | task 0 | stop processing: n_tokens = 19906, truncated = 0 srv update_slots: all slots are idle srv log_server_r: done request: POST /chat/completions 192.168.0.3 200 srv params_from_: Chat format: peg-constructed slot get_availabl: id 0 | task -1 | selected slot by LCP similarity, sim_best = 0.155 (> 0.100 thold), f_keep = 0.154 srv get_availabl: updating prompt cache srv prompt_save: - saving prompt with length 19906, total state size = 206.820 MiB srv load: - looking for better prompt, base f_keep = 0.154, sim = 0.155 srv update: - cache state: 1 prompts, 282.196 MiB (limits: 0.000 MiB, 128000 tokens, 128000 est) srv update: - prompt 0x55d0940067c0: 19906 tokens, checkpoints: 1, 282.196 MiB srv get_availabl: prompt cache update took 113.76 ms slot launch_slot_: id 0 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> temp-ext -> dist slot launch_slot_: id 0 | task 26 | processing task, is_child = 0 slot update_slots: id 0 | task 26 | new prompt, n_ctx_slot = 128000, n_keep = 0, task.n_tokens = 19768 slot update_slots: id 0 | task 26 | n_past = 3069, slot.prompt.tokens.size() = 19906, seq_id = 0, pos_min = 19905, n_swa = 1 slot update_slots: id 0 | task 26 | 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 26 | erased invalidated context checkpoint (pos_min = 19379, pos_max = 19379, n_swa = 1, size = 75.376 MiB) slot update_slots: id 0 | task 26 | n_tokens = 0, memory_seq_rm [0, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.103602 slot update_slots: id 0 | task 26 | n_tokens = 2048, memory_seq_rm [2048, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.207204 slot update_slots: id 0 | task 26 | n_tokens = 4096, memory_seq_rm [4096, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 6144, batch.n_tokens = 2048, progress = 0.310805 slot update_slots: id 0 | task 26 | n_tokens = 6144, memory_seq_rm [6144, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 8192, batch.n_tokens = 2048, progress = 0.414407 slot update_slots: id 0 | task 26 | n_tokens = 8192, memory_seq_rm [8192, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 10240, batch.n_tokens = 2048, progress = 0.518009 slot update_slots: id 0 | task 26 | n_tokens = 10240, memory_seq_rm [10240, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 12288, batch.n_tokens = 2048, progress = 0.621611 slot update_slots: id 0 | task 26 | n_tokens = 12288, memory_seq_rm [12288, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 14336, batch.n_tokens = 2048, progress = 0.725212 slot update_slots: id 0 | task 26 | n_tokens = 14336, memory_seq_rm [14336, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 16384, batch.n_tokens = 2048, progress = 0.828814 slot update_slots: id 0 | task 26 | n_tokens = 16384, memory_seq_rm [16384, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 18432, batch.n_tokens = 2048, progress = 0.932416 slot update_slots: id 0 | task 26 | n_tokens = 18432, memory_seq_rm [18432, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 19256, batch.n_tokens = 824, progress = 0.974100 slot update_slots: id 0 | task 26 | n_tokens = 19256, memory_seq_rm [19256, end) slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 19768, batch.n_tokens = 512, progress = 1.000000 slot update_slots: id 0 | task 26 | prompt done, n_tokens = 19768, batch.n_tokens = 512 slot init_sampler: id 0 | task 26 | init sampler, took 1.52 ms, tokens: text = 19768, total = 19768 slot update_slots: id 0 | task 26 | created context checkpoint 1 of 32 (pos_min = 19255, pos_max = 19255, size = 75.376 MiB) slot print_timing: id 0 | task 26 | prompt eval time = 90244.75 ms / 19768 tokens ( 4.57 ms per token, 219.05 tokens per second) eval time = 3481.50 ms / 93 tokens ( 37.44 ms per token, 26.71 tokens per second) total time = 93726.25 ms / 19861 tokens slot release: id 0 | task 26 | stop processing: n_tokens = 19860, truncated = 0
Activity
tech112233445566 commentedon Feb 22, 2026
执行片段
srv init: init: chat template, thinking = 0
main: model loaded
main: server is listening on http://0.0.0.0:8001
main: starting the main loop...
srv update_slots: all slots are idle
srv params_from_: Chat format: peg-constructed
slot get_availabl: id 0 | task -1 | selected slot by LRU, t_last = -1
slot launch_slot_: id 0 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> temp-ext -> dist
slot launch_slot_: id 0 | task 0 | processing task, is_child = 0
slot update_slots: id 0 | task 0 | new prompt, n_ctx_slot = 128000, n_keep = 0, task.n_tokens = 19892
slot update_slots: id 0 | task 0 | n_tokens = 0, memory_seq_rm [0, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.102956
slot update_slots: id 0 | task 0 | n_tokens = 2048, memory_seq_rm [2048, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.205912
slot update_slots: id 0 | task 0 | n_tokens = 4096, memory_seq_rm [4096, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 6144, batch.n_tokens = 2048, progress = 0.308868
slot update_slots: id 0 | task 0 | n_tokens = 6144, memory_seq_rm [6144, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 8192, batch.n_tokens = 2048, progress = 0.411824
slot update_slots: id 0 | task 0 | n_tokens = 8192, memory_seq_rm [8192, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 10240, batch.n_tokens = 2048, progress = 0.514780
slot update_slots: id 0 | task 0 | n_tokens = 10240, memory_seq_rm [10240, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 12288, batch.n_tokens = 2048, progress = 0.617736
slot update_slots: id 0 | task 0 | n_tokens = 12288, memory_seq_rm [12288, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 14336, batch.n_tokens = 2048, progress = 0.720692
slot update_slots: id 0 | task 0 | n_tokens = 14336, memory_seq_rm [14336, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 16384, batch.n_tokens = 2048, progress = 0.823648
slot update_slots: id 0 | task 0 | n_tokens = 16384, memory_seq_rm [16384, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 18432, batch.n_tokens = 2048, progress = 0.926604
slot update_slots: id 0 | task 0 | n_tokens = 18432, memory_seq_rm [18432, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 19380, batch.n_tokens = 948, progress = 0.974261
slot update_slots: id 0 | task 0 | n_tokens = 19380, memory_seq_rm [19380, end)
slot update_slots: id 0 | task 0 | prompt processing progress, n_tokens = 19892, batch.n_tokens = 512, progress = 1.000000
slot update_slots: id 0 | task 0 | prompt done, n_tokens = 19892, batch.n_tokens = 512
slot init_sampler: id 0 | task 0 | init sampler, took 1.57 ms, tokens: text = 19892, total = 19892
slot update_slots: id 0 | task 0 | created context checkpoint 1 of 32 (pos_min = 19379, pos_max = 19379, size = 75.376 MiB)
slot print_timing: id 0 | task 0 |
prompt eval time = 90234.73 ms / 19892 tokens ( 4.54 ms per token, 220.45 tokens per second)
eval time = 480.39 ms / 15 tokens ( 32.03 ms per token, 31.22 tokens per second)
total time = 90715.12 ms / 19907 tokens
slot release: id 0 | task 0 | stop processing: n_tokens = 19906, truncated = 0
srv update_slots: all slots are idle
srv log_server_r: done request: POST /chat/completions 192.168.0.3 200
srv params_from_: Chat format: peg-constructed
slot get_availabl: id 0 | task -1 | selected slot by LCP similarity, sim_best = 0.155 (> 0.100 thold), f_keep = 0.154
srv get_availabl: updating prompt cache
srv prompt_save: - saving prompt with length 19906, total state size = 206.820 MiB
srv load: - looking for better prompt, base f_keep = 0.154, sim = 0.155
srv update: - cache state: 1 prompts, 282.196 MiB (limits: 0.000 MiB, 128000 tokens, 128000 est)
srv update: - prompt 0x55d0940067c0: 19906 tokens, checkpoints: 1, 282.196 MiB
srv get_availabl: prompt cache update took 113.76 ms
slot launch_slot_: id 0 | task -1 | sampler chain: logits -> ?penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> min-p -> ?xtc -> temp-ext -> dist
slot launch_slot_: id 0 | task 26 | processing task, is_child = 0
slot update_slots: id 0 | task 26 | new prompt, n_ctx_slot = 128000, n_keep = 0, task.n_tokens = 19768
slot update_slots: id 0 | task 26 | n_past = 3069, slot.prompt.tokens.size() = 19906, seq_id = 0, pos_min = 19905, n_swa = 1
slot update_slots: id 0 | task 26 | forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com//pull/13194#issuecomment-2868343055)
slot update_slots: id 0 | task 26 | erased invalidated context checkpoint (pos_min = 19379, pos_max = 19379, n_swa = 1, size = 75.376 MiB)
slot update_slots: id 0 | task 26 | n_tokens = 0, memory_seq_rm [0, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.103602
slot update_slots: id 0 | task 26 | n_tokens = 2048, memory_seq_rm [2048, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.207204
slot update_slots: id 0 | task 26 | n_tokens = 4096, memory_seq_rm [4096, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 6144, batch.n_tokens = 2048, progress = 0.310805
slot update_slots: id 0 | task 26 | n_tokens = 6144, memory_seq_rm [6144, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 8192, batch.n_tokens = 2048, progress = 0.414407
slot update_slots: id 0 | task 26 | n_tokens = 8192, memory_seq_rm [8192, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 10240, batch.n_tokens = 2048, progress = 0.518009
slot update_slots: id 0 | task 26 | n_tokens = 10240, memory_seq_rm [10240, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 12288, batch.n_tokens = 2048, progress = 0.621611
slot update_slots: id 0 | task 26 | n_tokens = 12288, memory_seq_rm [12288, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 14336, batch.n_tokens = 2048, progress = 0.725212
slot update_slots: id 0 | task 26 | n_tokens = 14336, memory_seq_rm [14336, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 16384, batch.n_tokens = 2048, progress = 0.828814
slot update_slots: id 0 | task 26 | n_tokens = 16384, memory_seq_rm [16384, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 18432, batch.n_tokens = 2048, progress = 0.932416
slot update_slots: id 0 | task 26 | n_tokens = 18432, memory_seq_rm [18432, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 19256, batch.n_tokens = 824, progress = 0.974100
slot update_slots: id 0 | task 26 | n_tokens = 19256, memory_seq_rm [19256, end)
slot update_slots: id 0 | task 26 | prompt processing progress, n_tokens = 19768, batch.n_tokens = 512, progress = 1.000000
slot update_slots: id 0 | task 26 | prompt done, n_tokens = 19768, batch.n_tokens = 512
slot init_sampler: id 0 | task 26 | init sampler, took 1.52 ms, tokens: text = 19768, total = 19768
slot update_slots: id 0 | task 26 | created context checkpoint 1 of 32 (pos_min = 19255, pos_max = 19255, size = 75.376 MiB)
slot print_timing: id 0 | task 26 |
prompt eval time = 90244.75 ms / 19768 tokens ( 4.57 ms per token, 219.05 tokens per second)
eval time = 3481.50 ms / 93 tokens ( 37.44 ms per token, 26.71 tokens per second)
total time = 93726.25 ms / 19861 tokens
yamikumo-DSD commentedon Feb 22, 2026
I'm using Qwen3 Coder Next via llama-cpp-python and encountering same type of issue, where it seems to fail
memory_seq_rmfalling back to clearing KV cache entirely.Don't you experience the problem with Nemotron 3 Nano too?
In my environment, these two models (and maybe Qwen3.5) cause the failure.
pwilkin commentedon Feb 22, 2026
Please make sure that your tool doesn't change the prompt every time (eg. by embedding current time within the prompt). The message here says:
That means only a prefix of size 3069 from the entire prompt of 19906 was found to be usable - this suggests a changing system message.
tech112233445566 commentedon Feb 22, 2026
看来openclaw在连续对话的时候,重用的token过少导致了这个问题,谢谢,稍后我看一下我的openclaw是不是工具调用的时候,是不是更改信息量较大
guillaumevds commentedon Feb 23, 2026
Same issue here with the same model and the OpenClaw use case : complete reprocessing at each round.
Same test and use case with glm4.7-flash, does NOT trigger full reprocessing.
hsinyu-chen commentedon Feb 23, 2026
keep n seems not work , my message is [fixed parts ] + [ dynamic parts] , it always force full pp every time , seems that cache only works for append only scenario
WinPooh32 commentedon Feb 24, 2026
It works well on build 8123 (f75c4e8). I had same issues running on older versions. Cache is not invalidated even on last checkpoint is reached. If invalidation happens, check that nothing is changed in the middle of your prompts. For example, I run Claude Code cli and it requires to set env CLAUDE_CODE_ATTRIBUTION_HEADER=0.
My config (llama-swap):
GavinAstk commentedon Feb 24, 2026
I encountered the same issue when deploying Claude Code with llama.cpp and the
unsloth/Qwen3-Coder-Next-GGUF:UD-Q8_K_XLmodel on my Strix Halo mini PC. After reading through PR #13194 and numerous discussions, it became clear that many people are facing this problem, but no solution had been found yet.To verify whether the cache-miss issue was truly caused by an incompatibility between Qwen3-Coder-Next and llama.cpp, I wrote a small test script to examine cache behavior:
The logs I obtained showed:
From these logs, I observed that the problem disappeared—cache hits occurred when the same token prefix was used. The remaining time was mostly spent on the model's output token generation phase.
A comment in PR #19408 caught my attention: "this looks like OpenCode modifying something early in the prompt."
Inspired by this, I wrote a simple proxy and set Claude Code's base URL to
http://localhost:8081(the proxy's port) to forward requests directly.simple_proxy_v1.py:I discovered that Claude injects additional content on every turn. While this might be useful for Claude's own users, for local model users it's entirely unnecessary—and worse, it breaks prompt prefix caching. Then I shared the logs and
simple_proxy_v1.pywith DeepSeek to help analyze exactly what content Claude Code injects. With DeepSeek's assistance, I obtainedsimple_proxy_v2.py:simple_proxy_v2.py:Here’s what I observed after applying the improved proxy:
The log message
forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com//pull/13194#issuecomment-2868343055)disappeared, and the cache hit rate approached 100%. The task I used for testing in Claude Code dropped from 20 minutes to 2 minutes (still slow, but a huge improvement). At this point, the cache miss issue was finally resolved. Due to my limited knowledge of low‑level AI details, I cannot determine whether this problem is related to the--swa-fullparameter (PR #13194).To be clear, the issue does not stem from Qwen3-Coder-Next or llama.cpp; it is entirely a prompt-side problem.
The above is my complete troubleshooting process and solution. I believe others using different coding agents can replicate it through the example above, and the problem can ultimately be solved.
Dampfinchen commentedon Feb 24, 2026
Now that the new smaller Qwen 3.5's released, I am able to run the Qwen next architecture. It also always reprocesses the prompt for me with Qwen 3.5 A35B A3B.
slot update_slots: id 3 | task 17222 | 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)xTimeCrystal commentedon Feb 25, 2026
Same issue here with Qwen3.5-35B-A3B. The root cause is that Qwen3.5/Next uses a hybrid architecture (Gated Delta Networks for 3/4 layers, full attention for 1/4), and the Qwen team recommends deleting
<think>...</think>content after each turn to prevent context bloat. But deleting those tokens shifts the sequence, invalidating the checkpoint — and since the GDN recurrent stateSis fixed-size and path-dependent (unlike KV cache which can be prefix-matched), llama.cpp has no valid checkpoint to restore from and falls back to full reprocessing.Two potential fixes I've been thinking about:
1. Selective layer reprocessing: When a checkpoint is partially valid (i.e. the attention KV cache prefix still matches), only reprocess the recurrent/GDN layers and reuse the cached KV for attention layers. The recurrent state
Shas to be recomputed sequentially anyway, but this would at least keep prompt processing speed constant with context length rather than scaling linearly since the attention layers (1/4 of the model) would be free.2. Speculative state caching on known-ephemeral tokens: Since the
<think>start token is known in advance, cache a checkpoint at the<think>token boundary. When the think content is later deleted, you already have the valid recurrent state from before the reasoning started — no reprocessing needed at all. This is essentially a model-aware cache hint: "I know everything after this token will be discarded, save state here."cc @pwilkin would love your thoughts on feasibility here.
ozdang commentedon Feb 25, 2026
When running the Qwen3-Coder-Next Q8_0 quantized model with llama-server, this issue did not occur in open-webui chats, but it did occur in Claude Code. I tried the solution described here and it was resolved. Thank you.
z80maniac commentedon Feb 27, 2026
Here is a clean reproducible example.
Commit: 2e7e638
System:
Linux, RTX 5070TiModel:
Qwen3-Coder-Next, the one linked in the first message.Build:
cmake -B build -DGGML_CUDA=ON; cmake --build build --clean-first --config Release "-j$(nproc)" --target llama-serverLaunch:
llama-server --model Qwen3-Coder-Next-UD-TQ1_0.gguf --ctx-size 4096 --jinja --mmap --swa-fullRequest:
curl -Ss http://127.0.0.1:8080/v1/chat/completions --data '{"messages":[{"role":"user","content":[{"type":"text","text":"a a a a a a a a a a"}]}],"max_tokens":0}' | jqOutput:
{ "choices": [ { "finish_reason": "length", "index": 0, "message": { "role": "assistant", "content": "It" } } ], "created": 1772190549, "model": "Qwen3-Coder-Next-UD-TQ1_0.gguf", "system_fingerprint": "b8173-2e7e63852", "object": "chat.completion", "usage": { "completion_tokens": 1, "prompt_tokens": 18, "total_tokens": 19 }, "id": "chatcmpl-XKZmfNAW1nrUhjiYoytA3WHrvltLFki0", "timings": { "cache_n": 0, "prompt_n": 18, "prompt_ms": 88.613, "prompt_per_token_ms": 4.922944444444444, "prompt_per_second": 203.1304661844199, "predicted_n": 1, "predicted_ms": 0.001, "predicted_per_token_ms": 0.001, "predicted_per_second": 1000000.0 } }The
cache_n = 0implies a cache miss.Now run the same request the second time. You will get
cache_n = 0again. It means the prompt cache was not used.The log after the second request:
Notice the "failed to truncate tokens" line. It's different from "forcing full prompt re-processing due to lack of cache data" reported in the original message. So maybe it's a slightly different bug. I have seen the "forcing full prompt re-processing" message too, but I can't cleanly reproduce it.
This exact bug also happens on
Qwen3.5-397B-A17B. But doesn't happen, for example, onGLM-4.6V. When you perform the same request on GLM the second time it properly showscache_n = 15.aarcange commentedon Feb 28, 2026
I run into the "forcing full prompt re-processing ..." too, but my issue is going after I modified the ckpoint freq like this #19970 plus --ctx-checkpoints 64. This is only mean to solve the truncation of kvcache (like after editing a file in context).
pwilkin commentedon Feb 28, 2026
I'll try to cook up a solution tomorrow.
6 remaining items
CoreRasurae commentedon Mar 4, 2026
@pwilkin i have tested your patch and i am getting the same problem, it seems... i am running Qwen 3.5 and despiste the high LCP similarity it discarded all the context, even with
--checkpoint-every-nb 3, as documented in this log excerpt:odellus commentedon Mar 7, 2026
I use my own agent that keeps the reasoning content so as to not invalidate the kv cache (my method of compaction is cheap/fast) and I see the invalidated kv cache error all the time. Somewhat at random. It's not just strange cache invalidating behavior from opencode or CC. Agent custom built to preserve kv cache also triggers full reprocessing in a non-deterministic manner.
yshui commentedon Mar 7, 2026
it's a bit annoying that even with
enable_thinking = false, empty<think> </think>tags are still added and deleted, forcing reprocessing. can we change the chat template to not insert<think>at all, or is that going to wreck model performance?aarcange commentedon Mar 7, 2026
You can leverage
gbnfto handle this, likely by implementing a negative pattern similar to this example:https://gitlab.com/aarcange/ripgrep-edit/-/blob/main/src/gbnf.rs?ref_type=heads#L31
For curiosity, a few days ago I ran the
synthmerge_benchto measure how accuracy changes using --no-jinja when switching from the standard grammar (used whengbnf: true) to the same but prefixed with<think>\n\n</think>(in both cases thinking is disabled reliably through gbnf only).Findings:
<think>\n\n</think>prefix added the standard grammargbnfto disable thinking should not negatively impact accuracy.I haven't noticed specific issues with messages in my setup, but my workflow requires KV-cache only on the system prompt (where context is), and I have
gptel-include-reasoningset to the default"t". Consequently, the LLM plugin is including the think block in the response, which might be hiding any think related invalidation. That said, including the block is likely not ideal for accuracy...yshui commentedon Mar 7, 2026
I have a vague feeling that tool calling isn't going to work if I disable the chat template. If that's correct then the chat template will add
<think>\n\n</think>back, even if I can stop the model from generating it with grammar.johnchouang commentedon Mar 8, 2026
I'm noticing the forced reprocessing only happen on concurrent calls. When in cluade code it usually sends 2 concurrent calls, so the forced processing always happens.
When i switched to opencode and set --parallel to 1, i don't get the error.
Seems if this can be fixed for concurrent calls qwen3 would be much more usable for local users.
chrisoutwright commentedon Mar 8, 2026
I have found maybe some cause: microsoft/vscode#298554 (comment)
ggerganov commentedon Mar 9, 2026
@johnchouang This will be fixed with #20287
johnchouang commentedon Mar 11, 2026
Great thanks
chrisoutwright commentedon Mar 15, 2026
I still had issue with invalidation ,, but I think it is because of the IDE (VSC example copilot) hiding code lines (to save context I guess?) in the session..
very hard to pick up .. I had to write a whole UI to get this highlighted..
subhamgiri460 commentedon Mar 19, 2026
https://huggingface.co/spaces/Subham9126/test
here is a hfspaces with cpu hosting qwen 3.5 4b models
RemizovDenis commentedon Mar 31, 2026
Prompt re-computation is a huge TTFT killer. We solved this in TurboQuant v0.3.0 using Speculative KV Prefill. It uses 1-bit "sketches" to quickly reconstruct a draft of the KV cache for evicted prefixes. It boosts prefill speed by 2-3x and only verifies against the anchor layers, which is way faster than a full re-computation from scratch.
github-actions commentedon May 15, 2026
This issue was closed because it has been inactive for 14 days since being marked as stale.