@YRSM_Simon: Found a bug in vLLM local deployment of DeepSeek V4 Flash. Same session responds instantly, but switching to another session and back triggers a full re-prefill, and the KV cache fails. Stayed up all night, 100% reproducible: A first...
Summary
Discovered a KV cache invalidation bug in DeepSeek V4 Flash with vLLM local deployment: after switching sessions, prefix cache hit rate drops to 0, causing re-prefill, with latency exploding from ~1 second to ~100 seconds. Root cause suspected to be vLLM calling _maybe_evict_cached_block() when reusing free queue blocks, which removes the cached index.
View Cached Full Text
Cached at: 08/10/26, 07:33 AM
Found a bug in local deployment of deepseek v4 flash with vllm.
Same session responds instantly, but switch to another session and switch back — it goes straight back to Prefill, and the KV cache is invalidated.
Stayed up all night debugging, 100% reproducible:
A first time: 0% hit → ~100s A second time: ~100% hit → ~1s B first time: 0% hit → ~100s Switch back to A: 0% hit → ~100s again
VRAM isn’t full (KV pool <10%), no preemption occurred, and A and B could clearly fit in the cache simultaneously — all ruled out. Looks like the problem isn’t capacity, but the cache management logic.
DeepSeek V4’s chat template makes the first 256 tokens of every request almost identical. After a request finishes, the KV blocks go into the free queue and could be reused as prefix cache.
But the next time space is allocated, vLLM directly grabs those blocks for reuse and casually calls _maybe_evict_cached_block() — deleting the cached index (hash) in the process.
This bug severely impacts multi-session concurrency. Hope the community can fix it soon @vllm_project
Similar Articles
@karminski3: Magic! DeepSeekV4 context memory compressed to 1/10! Everyone knows DeepSeekV4 supports 1M context and is heavily optimized. To actually use 1M context, VRAM usage is only about 10GB (compared to DeepSeek-V3.2 which needs about…
FlashMemory-DeepSeek-V4 proposes a novel inference paradigm called Lookahead Sparse Attention (LSA), which uses a neural memory indexer to actively predict future context needs, compressing physical KV cache usage to 13.5% of full context baseline while improving average accuracy by 0.6%. This method adopts a decoupled training strategy that allows independent training of the indexer without loading the base model, significantly reducing training cost.
DeepSeek-V4-Flash (MXFP4): compute buffer scales ~3x just from KV cache quant type (f16 vs q8_0) — anyone else seeing this? Llama.cpp
A user reports that changing the KV cache quant type from f16 to q8_0 in DeepSeek-V4-Flash (MXFP4) causes the compute buffer to scale roughly 3x, asking if others have observed this behavior, specifically using llama.cpp.
FlashMemory DeepSeek-V4 Retriever (GitHub Repo)
Introduces FlashMemory DeepSeek-V4 Retriever, a lightweight model that sparsifies DeepSeek-V4's CSA KV-cache by predicting which chunks will be attended to next, keeping only ~10-15% on-device while matching full-attention performance.
You really should not quantize KV Cache for DeepSeek V4 Flash
A technical post warns against quantizing the KV cache for DeepSeek V4 Flash, showing significant quality degradation in perplexity, KL divergence, and token probabilities compared to Qwen 397B.
DeepSeek V4 @ IQ3XXS on M1 Ultra 128GB- 16 tok/s in LM Studio after patch
A GitHub patch allows running DeepSeek V4 Flash in LM Studio on 128GB Macs by sideloading antirez's llama.cpp fork, working around struct-layout drift, decoding splits, and code-signing issues.