# llama.cpp: why DeepSeek output corrupts on reused prompts

> Thread on WhatWorks · published 2026-11-02 · fresh until 2026-12-23 · https://whatworks.dev/t/llama-cpp-deepseek41-cached-prefix-corrupt-output
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, llama.cpp users report DeepSeek-V4.1 output corruption after cached-prefix reuse. Get the maintainer's real-model diagnostic, reported cache workarounds and the limits of the merged partial-offload repair and a later recurrence report (checked 2026-11-24).

**Not for:** Qwen reprocessing the full prompt, see [llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking](https://whatworks.dev/t/llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking.md).

Subjects: deepseek, deepseek-ai, local-models, prompting, qwen

Compare cold and reused-prefix output, then run llama.cpp's context diagnostic against the real DeepSeek model before assuming a sampling problem ([ggerganov](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6419729420), [bertusmt](https://github.com/ggml-org/llama.cpp/issues/30944)).

Do first: run `./bin/test-llama-context -m model.gguf -c 4096`, replacing `model.gguf` with your model path; this is maintainer ggerganov's October 26 diagnostic ([comment](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6419729420)).

### Diagnostic: single-token output corruption

[bertusmt's October 21 issue #30944](https://github.com/ggml-org/llama.cpp/issues/30944) calls the symptom “single-token output corruption”. The initial report used Linux/CUDA 13.2, two RTX PRO 6000 Blackwell GPUs, DeepSeek-V4.1-Flash-1017 UD-IQ3_S, and draft branch commit `b72050d`. It observed substitutions after prompt-prefix reuse with either lazy-mode setting and proposed an Engram token-history mismatch as the cause. That mechanism is a reporter hypothesis.

## Findings and reported mitigations

- **Later main-branch evidence:** [vikcious, October 26](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6419232913), says “the same bug exists in Main”. In a [follow-up](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6420041913), vikcious identifies 0.7.0-dev build 11896, commit `9125a2ebe`, Linux x86_64 and eight RTX 3090s with UD-Q2_K_XL. This extends the report beyond the original draft branch without establishing all released builds as affected.
- **First workaround:** bertusmt reports that `"cache_prompt": false` on requests removed the substitutions in the comparison harness, at the cost of full prompt processing ([issue #30944](https://github.com/ggml-org/llama.cpp/issues/30944)). Compare exact expected output on the same input before relying on this mitigation.
- **Concurrent restore case:** [songwanqian, October 28](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6462860209), used four RTX 6000D GPUs, UD-Q3_K_XL, unified KV cache and eight slots. The symptom was that warm concurrent responses “lose the needle”. The reporter points instead to checkpoint restoration while another sequence is active; full-state restoration and synchronization probes did not resolve that reproduction.
- **Separate reported controls:** songwanqian reports correct output in its comparison with `-ctxcp 0`, `--no-cache-prompt` or `--no-cont-batching`, used separately. Those results are specific to its concurrent workload; they do not prove the original Engram hypothesis or a general runtime repair ([reproduction matrix](https://github.com/ggml-org/llama.cpp/issues/30944#issuecomment-6462860209)).
- **Fix status:** As checked 2026-11-24, am17an's [PR #31292](https://github.com/ggml-org/llama.cpp/pull/31292) merged on 2026-11-03, addressing state restoration with partial offload; [#30944](https://github.com/ggml-org/llama.cpp/issues/30944) was closed and reopened that day and remains open. The repair is listed in [v0.9.0](https://github.com/ggml-org/llama.cpp/releases/tag/v0.9.0), released November 4, 2026. The earlier “Not looking good yet!” reply preceded the merge; a November 3 follow-up on the issue still reports corruption on build 11985 (`6f4cc4d72`) when restoring from the host-memory prompt cache, with `--cache-ram 0` reported as a workaround. Closure does not establish that every corruption case is resolved.

## Limits

These reports concern DeepSeek-V4.1-Flash-1017 with specific CUDA builds, quantizations and offload layouts. The concurrent restore matrix is one reporter's case; it does not explain every serial corruption report. Other backends and generic repetition are outside this evidence.

Not for: Qwen reprocessing the full prompt; see [llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking](/t/llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking).

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.