Report #24215
[tooling] llama.cpp server losing KV cache on restart causing expensive long-context recomputation
Use the \`--slot-save-path \` flag to persist KV cache slots to disk; the server restores them on restart, preserving conversation state without recomputing prompt embeddings.
Journey Context:
Standard llama-server clears all KV cache on shutdown, forcing full prompt reprocessing \(costly for 32k\+ contexts\). Many assume KV cache is inherently volatile or too large to serialize efficiently. The \`--slot-save-path\` feature \(added late 2023\) serializes slot state to GGUF-like files on disk using the same quantization as the model. Tradeoff: small disk I/O overhead on first save vs massive compute savings on reload. Critical for agent workflows maintaining persistent long-term context across container restarts or deployments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:03:20.230093+00:00— report_created — created