Skip to content

Eval bug: Qwen3.5 always re-processes the full prompt #19858

Closed

Description

@NickM-27

Name and Version

build: 8140 (39fb81f) with GNU 15.2.0 for Linux x86_64

Operating systems

Linux

GGML backends

Vulkan

Hardware

RX 7900XTX

Models

Qwen3.5 35B-A3B Q4_K_XL Unsloth GGUF

Problem description & steps to reproduce

I am running llama-server in docker in router mode. When I load Qwen3.5 I see the below logs which show it is not re-using the context. I set the below config so there should be plenty of context for it

; Context Size
ctx-size = 100000
parallel = 4 
slot-prompt-similarity = 0.25

First Bad Commit

No response

Relevant log output

Logs
srv  proxy_reques: proxying request to model Qwen3.5 on port 53409
[53409] srv  params_from_: Chat format: peg-constructed
[53409] slot get_availabl: id  3 | task -1 | selected slot by LCP similarity, sim_best = 0.988 (> 0.250 thold), f_keep = 0.940
[53409] slot launch_slot_: id  3 | task -1 | sampler chain: logits -> penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> ?min-p -> ?xtc -> ?temp-ext -> dist 
[53409] slot launch_slot_: id  3 | task 2400 | processing task, is_child = 0
[53409] slot update_slots: id  3 | task 2400 | new prompt, n_ctx_slot = 25088, n_keep = 0, task.n_tokens = 7238
[53409] slot update_slots: id  3 | task 2400 | erased invalidated context checkpoint (pos_min = 7536, pos_max = 7536, n_swa = 1, size = 62.813 MiB)
[53409] slot update_slots: id  3 | task 2400 | n_tokens = 7153, memory_seq_rm [7153, end)
[53409] slot update_slots: id  3 | task 2400 | failed to truncate tokens with position >= 7153 - clearing the memory
[53409] slot prompt_clear: id  3 | task 2400 | clearing prompt with 7153 tokens
[53409] slot update_slots: id  3 | task 2400 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.282951
[53409] slot update_slots: id  3 | task 2400 | n_tokens = 2048, memory_seq_rm [2048, end)
[53409] slot update_slots: id  3 | task 2400 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.565902
[53409] slot update_slots: id  3 | task 2400 | n_tokens = 4096, memory_seq_rm [4096, end)
[53409] slot update_slots: id  3 | task 2400 | prompt processing progress, n_tokens = 6144, batch.n_tokens = 2048, progress = 0.848853
[53409] slot update_slots: id  3 | task 2400 | n_tokens = 6144, memory_seq_rm [6144, end)
[53409] slot update_slots: id  3 | task 2400 | prompt processing progress, n_tokens = 6726, batch.n_tokens = 582, progress = 0.929262
[53409] slot update_slots: id  3 | task 2400 | n_tokens = 6726, memory_seq_rm [6726, end)
[53409] slot update_slots: id  3 | task 2400 | prompt processing progress, n_tokens = 7238, batch.n_tokens = 512, progress = 1.000000
[53409] slot update_slots: id  3 | task 2400 | prompt done, n_tokens = 7238, batch.n_tokens = 512
[53409] slot init_sampler: id  3 | task 2400 | init sampler, took 2.27 ms, tokens: text = 7238, total = 7238
[53409] srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 200
srv  log_server_r: done request: POST /v1/chat/completions 192.168.50.105 200
[53409] slot print_timing: id  3 | task 2400 | 
[53409] prompt eval time =    3815.79 ms /  7238 tokens (    0.53 ms per token,  1896.85 tokens per second)
[53409]        eval time =      15.81 ms /     2 tokens (    7.90 ms per token,   126.53 tokens per second)
[53409]       total time =    3831.60 ms /  7240 tokens
[53409] slot      release: id  3 | task 2400 | stop processing: n_tokens = 7239, truncated = 0
[53409] srv  update_slots: all slots are idle

Activity

  1. Dampfinchen commented on Feb 24, 2026

    @Dampfinchen

    Can confirm this on my system. RTX 2060, i7 9750H, Windows 11, 32 GB RAM, Same model as OP. It always re-processes the prompt.

    slot update_slots: id 3 | task 118 | 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)

    LLama.cpp server, b8145

  2. jacekpoplawski commented on Feb 24, 2026

    @jacekpoplawski
    Contributor

    I also see "forcing full prompt..."

    (old issue for Qwen Next: #19394)

  3. ggerganov commented on Feb 24, 2026

    @ggerganov
    Member

    Please provide feedback if #19849 works as expected.

  4. Dampfinchen commented on Feb 24, 2026

    @Dampfinchen

    Busy right now, but what I can say at the moment is that it doesn't matter if I use it with or without the vision encoder (mmproj) loaded, it always reprocesses the prompt.

  5. ggerganov commented on Feb 24, 2026

    @ggerganov
    Member

    @Dampfinchen Most likely you are using very short prompts (i.e. less than 512 tokens).

  6. NickM-27 commented on Feb 24, 2026

    @NickM-27
    ContributorAuthor

    @ggerganov I built that PR and tested under the same circumstances and this is what I see now, looks like it is working correctly

    srv  proxy_reques: proxying request to model Qwen3.5 on port 45139
    [45139] srv  params_from_: Chat format: peg-constructed
    [45139] slot get_availabl: id  3 | task -1 | selected slot by LCP similarity, sim_best = 0.998 (> 0.250 thold), f_keep = 0.998
    [45139] slot launch_slot_: id  3 | task -1 | sampler chain: logits -> penalties -> ?dry -> ?top-n-sigma -> top-k -> ?typical -> top-p -> ?min-p -> ?xtc -> ?temp-ext -> dist 
    [45139] slot launch_slot_: id  3 | task 8 | processing task, is_child = 0
    [45139] slot update_slots: id  3 | task 8 | new prompt, n_ctx_slot = 25088, n_keep = 0, task.n_tokens = 7235
    [45139] slot update_slots: id  3 | task 8 | n_past = 7220, slot.prompt.tokens.size() = 7235, seq_id = 3, pos_min = 7234, n_swa = 1
    [45139] slot update_slots: id  3 | task 8 | restored context checkpoint (pos_min = 6720, pos_max = 6720, size = 62.813 MiB)
    [45139] slot update_slots: id  3 | task 8 | n_tokens = 6722, memory_seq_rm [6722, end)
    [45139] slot update_slots: id  3 | task 8 | prompt processing progress, n_tokens = 6723, batch.n_tokens = 1, progress = 0.929233
    [45139] find_slot: non-consecutive token position 6722 after 6720 for sequence 3 with 1 new tokens
    [45139] find_slot: non-consecutive token position 6722 after 6720 for sequence 3 with 1 new tokens
    [45139] slot update_slots: id  3 | task 8 | n_tokens = 6723, memory_seq_rm [6723, end)
    [45139] slot update_slots: id  3 | task 8 | prompt processing progress, n_tokens = 7235, batch.n_tokens = 512, progress = 1.000000
    [45139] slot update_slots: id  3 | task 8 | prompt done, n_tokens = 7235, batch.n_tokens = 512
    [45139] slot init_sampler: id  3 | task 8 | init sampler, took 0.84 ms, tokens: text = 7235, total = 7235
    [45139] slot print_timing: id  3 | task 8 | 
    [45139] prompt eval time =     383.98 ms /   513 tokens (    0.75 ms per token,  1336.00 tokens per second)
    [45139]        eval time =     427.18 ms /    35 tokens (   12.21 ms per token,    81.93 tokens per second)
    [45139]       total time =     811.16 ms /   548 tokens
    [45139] slot      release: id  3 | task 8 | stop processing: n_tokens = 7269, truncated = 0
    [45139] srv  update_slots: all slots are idle
    [45139] srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 200
    srv  log_server_r: done request: POST /v1/chat/completions 192.168.50.105 200
    
  7. MuhammedKalkan commented on Feb 24, 2026

    @MuhammedKalkan

    dont know if related but i experience crashes with Qwen3.5 (27B- 35B)

    AMD 7900 XTX ROCM build

    Image
  8. TillWege commented on Feb 24, 2026

    @TillWege

    Atleast for me on AMD 395+ not running the mmproj flag fixes this

  9. coder543 commented on Feb 24, 2026

    @coder543
    Contributor

    Confirmed with A/B test on Qwen3.5-122B-A10B:

    • Text-only instruct (no mmproj): cache reuse works
      req1: prompt_n=4834, cache_n=0, prompt_ms=5384.8
      req2: prompt_n=512, cache_n=4322, prompt_ms=622.4

    • MM instruct (with mmproj): cache reuse fails, full reprocess on req2
      req1: prompt_n=4834, cache_n=0, prompt_ms=5375.2
      req2: prompt_n=4834, cache_n=0, prompt_ms=5355.5

    Relevant MM logs on 2nd request:

    • selected slot by LCP similarity, sim_best = 1.000 ...
    • need to evaluate at least 1 token for each active slot (n_past = 4834, task.n_tokens() = 4834)
    • n_past was set to 4833
    • n_tokens = 4833, memory_seq_rm [4833, end)
    • failed to truncate tokens with position >= 4833 - clearing the memory
    • prompt_clear ... clearing prompt with 4833 tokens

    This suggests slot selection/LCP is fine, but KV truncation fails in the MM path and forces prompt clear + full re-
    eval.

    EDIT: This is on an Nvidia DGX Spark using CUDA.

  10. Dampfinchen commented on Feb 24, 2026

    @Dampfinchen

    @Dampfinchen Most likely you are using very short prompts (i.e. less than 512 tokens).

    Apologies, you are right. It works at above 512 tokens.

  11. IceWreck commented on Feb 24, 2026

    @IceWreck

    Yep, can confirm disabling mmproj fixed it. (I guess the PR above will fix it even with vision enabled).

  12. andyceo commented on Feb 25, 2026

    @andyceo

    Confirming the 2d89c60 (the #19866 pr) is reprocess prompt on every request. Did not try other PRs yet

  13. intermittentnrg commented on Mar 4, 2026

    @intermittentnrg

    llama.cpp is running well with OpenCode. But every time i send prompt from Opencode it does:

    slot update_slots: id  0 | task 31458 | 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 31458 | erased invalidated context checkpoint (pos_min = 31671, pos_max = 31671, n_tokens = 31672, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 31929, pos_max = 31929, n_tokens = 31930, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 32263, pos_max = 32263, n_tokens = 32264, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 32744, pos_max = 32744, n_tokens = 32745, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 32990, pos_max = 32990, n_tokens = 32991, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 33876, pos_max = 33876, n_tokens = 33877, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 34533, pos_max = 34533, n_tokens = 34534, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | erased invalidated context checkpoint (pos_min = 34844, pos_max = 34844, n_tokens = 34845, n_swa = 1, size = 50.251 MiB)
    slot update_slots: id  0 | task 31458 | n_tokens = 0, memory_seq_rm [0, end)
    slot update_slots: id  0 | task 31458 | prompt processing progress, n_tokens = 2048, batch.n_tokens = 2048, progress = 0.058288
    slot update_slots: id  0 | task 31458 | n_tokens = 2048, memory_seq_rm [2048, end)
    slot update_slots: id  0 | task 31458 | prompt processing progress, n_tokens = 4096, batch.n_tokens = 2048, progress = 0.116576
    slot launch_slot_: id  0 | task 31458 | processing task, is_child = 0
    slot update_slots: id  0 | task 31458 | new prompt, n_ctx_slot = 65536, n_keep = -1, task.n_tokens = 35136
    slot update_slots: id  0 | task 31458 | n_past = 29129, slot.prompt.tokens.size() = 35755, seq_id = 0, pos_min = 35754, n_swa = 1
    ## and so on ##
    

    Not sure what information I should include. But just that it seems to happen every time I send new prompt seems useful (i.e. it does not happen for tool calls). Using the very recent llama-b8192-bin-ubuntu-vulkan-x64.tar.gz release.

    EDIT: Seems --swa-full flag solved improved it.
    EDIT2: Nope not solved.
    EDIT3: Switched from OpenCode to pi.dev and still same issue. I have a big penalty to steering the agent as context grows. llama.cpp is otherwise running incredibly well on my RX590 Vulkan GPU.
    EDIT4: Removed --flash-attn on from parameters, feels improved but not fixed. Not sure under what conditions full prompt re-processing happens seems somewhat random.

  14. KillerX629 commented on Mar 5, 2026

    @KillerX629

    I'm sorry, I'm using the last commit and I don't see this error fixed. what are the parameters that fix this in llama-server?
    EDIT: User error: apparently claude code just alters the context constantly unless you put CLAUDE_CODE_ATTRIBUTION_HEADER=0. If you're having problems with claude code and qwen 3.5, try this env var and see if it works. it does for me now!

  15. iseeboys commented on Mar 6, 2026

    @iseeboys

    Confirming this affects Qwen3.5-35B-A3B with --mmproj on b8192 (Windows/CUDA, RTX 5090).

    We're running llama-server with 2 slots (16K ctx each), --slot-prompt-similarity 0.5, --cache-type-k q8_0
    --cache-type-v q8_0. System prompt is ~11K tokens.

    Without --mmproj: Cache reuse works perfectly — follow-up messages are 2.4x faster (7.4s cold → 3.0s warm on 10K token
    prompts). Confirmed via metrics.

    With --mmproj: Cache reuse completely broken — every turn recomputes the full prompt. Prometheus metrics show 19:1
    prompt-to-generation token ratio over thousands of requests. This causes context overflow (400 errors) in long
    conversations as there's no headroom left in the slot.

    We've had to disable mmproj entirely to keep conversations stable. Eagerly awaiting PR #19877 for multi-modal prompt
    caching so we can re-enable vision. Happy to test any builds.

  16. intermittentnrg commented on Mar 6, 2026

    @intermittentnrg
  17. iseeboys commented on Mar 6, 2026

    @iseeboys

    Eagerly awaiting PR #19877

    It's already merged and included in releases since https://github.com/ggml-org/llama.cpp/releases/tag/b8153

    Thanks for the heads up! We're actually on b8192 so we do have it. Turns out our issue was --cache-ram 0 — we'd added
    it months ago to work around a GatedDeltaNet hybrid cache serialisation segfault (Qwen 3.5-35B-A3B). That flag was
    silently disabling all cross-request prompt caching, so we were recomputing the full system prompt every turn (19:1
    prompt:gen ratio). Removed it today and cache reuse is working perfectly now, mmproj and all. The segfault it was
    preventing seems to be resolved in recent builds. Leaving this here in case anyone else hits the same thing with
    hybrid recurrent+attention models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions