DeepSeek-V4.1-Flash: How 890-Byte KV Cache Compression Works
DeepSeek-V4.1-Flash compresses KV cache to 890 bytes/token via a Causal Encoder-Decoder design. Full benchmarks vs GPT-5.6, Opus 5, K3, GLM-5.3.

What is DeepSeek-V4.1-Flash?
DeepSeek-V4.1-Flash is an open-weight multimodal Mixture-of-Experts model from DeepSeek AI with 552 billion backbone parameters, released under the MIT license. Its defining feature is a new Causal Encoder-Decoder architecture paired with a second-generation sparse attention system that cuts the model’s global KV cache footprint to roughly 890 bytes per token, about a quarter of what DeepSeek-V4-Flash needed and, per DeepSeek’s own figures, 437 times smaller than DeepSeek-V1. That compression is what lets the model handle million-token contexts without the memory costs that usually come with them.
TL;DR
- DeepSeek-V4.1-Flash uses a Causal Encoder-Decoder design, a 40-layer Transformer split into 20 encoder layers and 20 decoder layers, where the decoder’s KV cache is projected from final encoder states rather than recomputed per layer.
- The model activates only 8B parameters during prefill and 16B during decode, out of 552B total backbone parameters, keeping inference cheap even though the model is large.
- A technique called Compressed Sparse Attention 2 (CSA2) assigns each layer a Full, Reindex, or Reuse mode, sharing KV and indexer data across layers to avoid redundant computation.
- Combined with FP4 KV caching (E2M1 format), these choices push the global KV cache down to about 890 bytes per token, roughly a quarter the size of DeepSeek-V4-Flash’s cache.
- On agentic coding benchmarks like Terminal-Bench 2.1 and DeepSWE v1.1, DeepSeek-V4.1-Flash outscores GPT-5.6, Opus 5, K3, and GLM-5.3, though it trails on some vision and pure-reasoning tasks like HLE and Terminal-Bench 4.0.
- The model supports a continuously controllable reasoning effort parameter (1 to 100), letting developers trade inference cost against accuracy on a sliding scale rather than picking between fixed “fast” and “thinking” modes.
- It ships with a 1M-token context window, native image and text input, and no Jinja chat template, instead offering a Python reference encoder and a Rust-based toolkit called deepseek-recipe for production prompt formatting.
Remy is new. The platform isn't.
Remy is the latest expression of years of platform work. Not a hastily wrapped LLM.
Why does KV cache size matter this much?
Every autoregressive transformer stores a key-value (KV) cache for every token it has processed, so it doesn’t have to recompute attention from scratch at each step. That cache grows linearly with context length and is usually the single biggest memory cost in serving large models, especially for agentic workloads where prompts routinely run into the hundreds of thousands of tokens (tool outputs, file contents, long conversation histories).
At 890 bytes per token, a 1-million-token context costs under a gigabyte of KV cache. Earlier DeepSeek generations needed several times that. For any team running long-context agents, coding assistants that ingest whole repositories, or multi-turn tool-calling loops, this is the difference between fitting more concurrent sessions on the same GPU fleet and being memory-bound long before you’re compute-bound.
How does the Causal Encoder-Decoder architecture work?
DeepSeek-V4.1-Flash restructures the standard decoder-only transformer into two halves: a 20-layer causal encoder and a 20-layer decoder. Instead of each decoder layer generating its own KV states from its own hidden states, the decoder’s global KV cache is projected once from the final encoder hidden states. That single projection step replaces 20 separate KV computations, which is where a large chunk of the memory and compute savings comes from.
To avoid losing local detail from collapsing that computation, the model adds SWA (sliding window attention) Bounded Replay: it reconstructs recent local KV states on the fly by replaying only the most recent tokens in a window, rather than persisting a separate sliding-window cache to disk. DeepSeek reports this alone cuts the persistent KV footprint to about one-eighth of DeepSeek-V4-Flash’s, before the sparse attention layer even gets applied.
On top of the architecture, the model activates a small fraction of its total parameters per token: 8B during prefill and 16B during decode, out of 552B backbone parameters. That activation pattern is what keeps a half-trillion-parameter model affordable to run, especially for prefill-heavy agentic tasks where most of the tokens are input (tool results, retrieved documents, code files) rather than generated output.
What does Compressed Sparse Attention 2 actually do?
CSA2 is DeepSeek’s second iteration of sparse attention, and it works by giving each attention layer one of three fixed modes:
- Full mode computes attention normally and builds a candidate pool other layers can reuse.
- Reindex mode reuses the main KV and indexer keys from another layer but recalculates which tokens to attend to.
- Reuse mode goes further and reuses the actual Top-K sparse-attention indices, skipping re-selection entirely.
Other agents start typing. Remy starts asking.
Scoping, trade-offs, edge cases — the real work. Before a line of code.
A Hierarchical Sparse Indexer then restricts deeper decoder layers to search only within the candidate pool built by the first Full-mode layer, which keeps indexing cost from scaling with context length even as the context grows toward a million tokens. Layered on top is FP4 quantization for the main KV cache (using the E2M1 number format with one E4M3 scale factor per 16 channels), which shrinks the numeric storage further without needing a redesign of the attention math itself. All of this combined is what gets the global KV cache to roughly 890 bytes per token.
The model also includes a few other architectural additions worth naming: Single-Pass mHC for residual-stream mixing, an Engram conditional memory module (196B parameters, accessed sparsely through token-based lookup rather than dense computation), and DSpark speculative decoding, which drafts multiple tokens semi-autoregressively and verifies them with a confidence-scheduled check rather than verifying every token individually.
How does it perform against GPT-5.6, Opus 5, K3, and GLM-5.3?
DeepSeek published head-to-head numbers against Opus 5.0, GPT-5.6 Sol, K3, and GLM-5.3, all at maximum reasoning effort. The pattern that emerges is a model that’s genuinely strong at agentic and coding tasks but not uniformly ahead of every frontier competitor.
On agentic benchmarks, V4.1-Flash leads or ties for the lead on several: Terminal-Bench 2.1 (90.6, ahead of Opus 5’s 89.1 and GPT-5.6’s 88.8), DeepSWE v1.1 (74.2, edging out Opus 5’s 74.0), CyberGym (88.1), HLE with tools (63.9), AutomationBench (54.8), and Agent’s Last Exam (31.8), the top score in that table. Codeforces competitive programming rating comes in at 3471, ahead of DeepSeek’s own V4-Pro (3348) and V4-Flash (3289).
It’s less dominant elsewhere. On Terminal-Bench 3.0 and 4.0, harder and newer versions of the same benchmark family, Opus 5 pulls well ahead (43.3 and 51.8 versus V4.1-Flash’s 30.0 and 31.2). On Humanity’s Last Exam (HLE) without tools, Opus 5 scores 56.3 against V4.1-Flash’s 36.8. Vision-heavy agentic tasks like Chartography, BabyVision, and ZeroBench also favor Opus 5 and GPT-5.6 by small-to-moderate margins.
Compared to its own predecessor, DeepSeek-V4-Flash, the jump is substantial almost everywhere: Terminal-Bench 2.1 climbs from 82.7 to 90.6, DeepSWE v1.1 from 54.4 to 74.2, and CyberGym from 76.7 to 88.1, all while using far less KV cache per token.
Is DeepSeek-V4.1-Flash worth using for agentic workloads?
For teams building coding agents, terminal-based automation, or tool-calling pipelines with long contexts, the combination of strong agentic benchmark scores and a small memory footprint is the main selling point. The model was tested across multiple agent scaffolds (Claude Code, Codex, OpenCode, mini-SWE, and DeepSeek’s own harness), scoring consistently in the high 80s and low 90s on Terminal-Bench 2.1 regardless of scaffold, which suggests the performance isn’t an artifact of one particular harness.
The tradeoffs are real, though. It’s noticeably behind on the harder Terminal-Bench 3.0/4.0 variants and on pure reasoning benchmarks like HLE, so it’s not a universal upgrade over closed frontier models for every task type. It also lacks a standard Jinja chat template, requiring either DeepSeek’s Python reference encoder or its Rust-based deepseek-recipe toolkit to format prompts correctly, which adds integration friction compared to models with drop-in template support.
The continuously controllable reasoning effort parameter (1 to 100) is a practical feature for cost management: rather than choosing between a fast mode and a slow “thinking” mode, developers can dial effort up or down per request based on task difficulty and budget.
Frequently Asked Questions
What is the KV cache size of DeepSeek-V4.1-Flash?
Roughly 890 bytes per token for the global KV cache, achieved through the Causal Encoder-Decoder architecture, SWA Bounded Replay, Compressed Sparse Attention 2, and FP4 quantization of the main KV cache.
How many parameters does DeepSeek-V4.1-Flash have?
552 billion backbone parameters total, as a Mixture-of-Experts model with 1 shared expert and 384 routed experts per MoE layer, of which 6 routed experts activate per token. Actual per-token activation is 8B parameters during prefill and 16B during decode.
How does DeepSeek-V4.1-Flash compare to GPT-5.6 and Opus 5 on benchmarks?
It leads on several agentic benchmarks including Terminal-Bench 2.1, DeepSWE v1.1, CyberGym, and Agent’s Last Exam, but trails Opus 5 on harder Terminal-Bench variants (3.0 and 4.0) and on Humanity’s Last Exam without tool use.
What context length does DeepSeek-V4.1-Flash support?
Up to 1 million tokens. It was pretrained at a 64K sequence length with sparse attention and then extended to 1M tokens using an additional 34 trillion tokens of training out of a 45-trillion-token total corpus.
Does DeepSeek-V4.1-Flash support images?
Yes. It’s natively multimodal, using a vision encoder called DeepSeek-ViT trained from scratch with 2D-RoPE and pixel-unshuffle downsampling, feeding into the same language model backbone alongside text embeddings.



