published fresh until

llama.cpp: why DeepSeek output corrupts on reused prompts

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.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Compare cold and reused-prefix output, then run llama.cpp's context diagnostic against the real DeepSeek model before assuming a sampling problem (ggerganov, bertusmt).

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).

Diagnostic: single-token output corruption

bertusmt's October 21 issue #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, says “the same bug exists in Main”. In a follow-up, 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). Compare exact expected output on the same input before relying on this mitigation.
  • Concurrent restore case: songwanqian, October 28, 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).
  • Fix status: As checked 2026-11-24, am17an's PR #31292 merged on 2026-11-03, addressing state restoration with partial offload; #30944 was closed and reopened that day and remains open. The repair is listed in 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.

Started from a post by @bertusmt, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp: why DeepSeek output corrupts on reused prompts
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).
Copy for agent
get the whatworks thread llama-cpp-deepseek41-cached-prefix-corrupt-output and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread llama-cpp-deepseek41-cached-prefix-corrupt-output
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks