🤖 AI Hot

DeepSeek V4.1-Flash: CED Cuts Coding Agent Prefill Cost

A
Alex Chen

DeepSeek V4.1-Flash is an unusual release: a new entry in the open source AI models race, designed around a specific economic problem — the prefill cost of input-heavy coding agents. The model introduces a Causal Encoder-Decoder (CED) architecture that activates only 8B parameters per token during prefill and 16B during decode, and it shrinks the persistent KV cache to 890 bytes per token, roughly a quarter of its predecessor. The result is a 552B-parameter model that posts top-tier agentic coding benchmarks while being measurably cheaper to serve on long, tool-heavy agent traces.

The design is a direct response to how coding agents actually consume tokens. An agent that reads a repository, runs tests, and iterates is dominated by input — re-prefilling the same context over and over as it edits files and re-evaluates. DeepSeek’s bet is that optimizing for that pattern, rather than for raw generation speed, is the fastest path to cheaper autonomous agents. Released under the MIT license on Hugging Face, V4.1-Flash is free to inspect, fine-tune, and self-host.

What CED actually does

The headline innovation is the Causal Encoder-Decoder layout. A standard decoder-only model generates every token through the same stack, so prefill (processing the prompt) and decode (generating one token at a time) both activate the full parameter set. V4.1-Flash splits the 40-layer Transformer into two halves: a 20-layer causal encoder followed by a 20-layer decoder.

The trick is where the decoder’s KV cache comes from. In a normal decoder, each layer’s global KV cache is derived from that layer’s own hidden states. In CED, the decoder’s global KV cache is projected from the final encoder hidden states instead. That means the encoder — 20 layers, 8B parameters — handles the heavy lifting of ingesting a long prompt once, while the decoder reuses a compact, projected cache for generation.

The economics follow directly:

  • Prefill: 8B parameters active per token. The encoder does the input-heavy work cheaply.
  • Decode: 16B parameters active per token. The decoder is larger because generation quality needs it, but decode is one token at a time, so the cost is spread out.

For a coding agent that pre-fills a 200K-token context repeatedly, the prefill activation count is the single biggest lever on cost. Cutting it to 8B — versus 13B in the prior V4-Flash and 49B in V4-Pro — is the whole point.

The KV cache story, in numbers

DeepSeek’s own chart shows the global KV cache per token collapsing across generations: V4.1-Flash achieves roughly a 4-fold reduction versus V4-Flash and a 437-fold reduction versus the original V1. That’s 890 bytes per token. Three mechanisms combine to get there:

  • Compressed Sparse Attention 2 (CSA2). Each attention layer is assigned one of three static modes — Full, Reindex, or Reuse — to share the main KV and indexer keys across layers and reuse Top-K sparse-attention indices. In the decoder, a Hierarchical Sparse Indexer restricts later indexing layers to a candidate pool built by the first Full-mode layer, so deeper indexer cost doesn’t grow with context length.
  • FP4 main KV caching. Main KV is stored in E2M1 FP4 format with one E4M3 scale per 16 channels. Four bits per value instead of eight or sixteen is a massive footprint cut, bought with a scale-per-channel correction to preserve precision.
  • SWA Bounded Replay. Sliding-window attention normally requires persisting the window’s KV states to disk or reconstructing them expensively. V4.1-Flash reconstructs missing sliding-window KV by replaying only the most recent n_win tokens, which avoids persisting SWA KV to SSD and cuts the persistent cache to about one-eighth of V4-Flash’s.

The rest of the architecture is a catalog of efficiency research: Single-Pass mHC (a revised residual-stream mixing with an efficient Mega-mHC kernel), Engram conditional memory (196B parameters, sparsely accessed via token-based lookup, adding long-horizon memory without inflating per-token activation), and DSpark speculative decoding (semi-autoregressive draft generation with confidence-scheduled verification). Each MoE layer holds 1 shared expert and 384 routed experts, activating 6 routed experts per token.

Benchmarks: an agentic-coding specialist

V4.1-Flash’s evaluation tables are unusually focused on agentic benchmarks, which tells you the intended use case. Against frontier models at maximum reasoning effort:

  • DeepSWE v1.1: 74.2 resolved — the highest in DeepSeek’s table, edging out Opus-5.0 (74.0) and GPT-5.6 Sol (73.0).
  • Terminal-Bench 2.1: 90.6 — top of the table, ahead of Opus-5.0 (89.1) and GPT-5.6 Sol (88.8).
  • AutomationBench: 54.8 — best in class, above Opus-5.0 (50.3).
  • Agent’s Last Exam: 31.8 — best in class, above Opus-5.0 (28.6).
  • HLE with tools: 63.9 — best in class, above Opus-5.0 (63.6).

On code and math, the story holds: HumanEval 79.4, BigCodeBench 60.6, GSM8K 93.0, and a Codeforces rating of 3471. On pure reasoning without tools (GPQA Diamond 90.9, HLE text-only 36.8), it sits behind the closed frontier — consistent with the “engineering workhorse, not reasoning savant” pattern.

The comparison against its own predecessor is the clearest proof of the architecture bet. V4-Flash was 284B backbone with 13B active. V4.1-Flash is 552B backbone — nearly double the parameters — yet activates only 8B during prefill. Bigger model, cheaper prefill. That’s the CED architecture paying for itself.

Here’s the base-model comparison DeepSeek published:

BenchmarkV4-Flash-BaseV4-Pro-BaseV4.1-Flash-Base
Backbone params284B1.6T552B
Activated params13B49B8B / 16B
MMLU-Pro (EM)68.373.574.1
HumanEval (Pass@1)69.576.879.4
BigCodeBench (Pass@1)56.859.260.6
GSM8K (EM)90.892.693.0

Multimodal, built in from the start

Unlike many “Flash” variants that strip vision to save cost, V4.1-Flash is natively multimodal. A vision encoder called DeepSeek-ViT — trained from scratch with 2D-RoPE and 3×3 pixel-unshuffle downsampling — feeds a two-layer MLP projector that converts images into visual embeddings processed jointly with text from the start of pre-training. On multimodal evals it posts MMMU-Pro 56.5, CVBench 77.9, DocVQA 95.6, and RefCOCO 86.0.

The model was trained from scratch on a 45-trillion-token multimodal corpus, with sparse attention trained at a 64K sequence length and the context extended to 1M tokens at the 34T-token mark. Post-training follows the standard SFT → RL → on-policy distillation recipe, with the substantive changes in the data pipeline: large-scale automated synthesis of agent tasks and environments with progressive scaling of data, tasks, and rollouts. That’s the “make the model better at being an agent” part of the story, distinct from the “make it cheap to serve” part.

Deployment and the reasoning-effort dial

V4.1-Flash ships with a continuously controllable reasoning effort setting, an integer from 1 to 100, that trades inference cost for accuracy. All the benchmark numbers above use reasoning_effort=100. In production, dropping it to a lower value is the first lever you pull to cut cost on tasks that don’t need maximum deliberation.

There’s no Jinja-format chat template. DeepSeek instead ships a self-contained Python reference implementation (encoding.py) with test cases for multi-turn conversations, tool calling, thinking mode, numeric reasoning effort, and interleaved images. For production use it recommends deepseek-recipe, a set of Rust libraries with Python bindings that converts Messages/Chat Completions/Responses requests into the model’s Conversation format and parses output back — leaving inference, tool execution, and HTTP transport to the caller.

Recommended sampling parameters:

ParameterValue
temperature1.0
top_p0.95 or 1.0
context_window1M tokens
max_tokens≥ 256K

AI agent framework comparison: how it behaves across scaffolds

DeepSeek also published cross-scaffold results, running V4.1-Flash through several coding agent harnesses — Claude Code, Codex, OpenCode, Pi, mini-SWE, and DeepSeek’s own Harness in Minimal/Standard/PTC modes. The spread is instructive for anyone doing an AI agent framework comparison in practice. On DeepSWE v1.1, mini-SWE scored highest (74.2 resolved), followed by DSH Minimal (72.6), while Claude Code landed at 69.8 and OpenCode at 65.5. On Terminal-Bench 2.1, DSH Minimal topped out at 90.6 and mini-SWE at 90.3, with the others clustered between 84 and 88.

The practical takeaway: the harness matters as much as the model. The same weights swing several points depending on the scaffold, so when you evaluate V4.1-Flash (or any agent model), run it through the scaffold you’ll actually ship with, not just the one in the paper. DeepSeek’s own Minimal harness is tuned for the model and shows it at its best; third-party harnesses trade a few points for independence.

Who should use this

Teams running long-horizon coding agents. If your agent’s cost is dominated by re-prefilling large contexts, V4.1-Flash’s 8B prefill activation is the specific reason to adopt it. The agentic benchmark results (DeepSWE 74.2, Terminal-Bench 90.6) say it’s not a compromise on capability, either.

Self-hosters with an FP4-friendly serving stack. MIT license, published vLLM/SGLang recipes, and aggressive KV compression make it one of the most economical frontier-scale open models to serve yourself.

Anyone who wants vision in their agent without a separate model. Native multimodal from pre-training means screenshots and documents are first-class input, which is rare in cost-optimized agent models.

Who should NOT use this

Teams whose bottleneck is hard reasoning, not agents. On GPQA Diamond and text-only HLE, the closed frontier (GPT-5.6 Sol, Opus-5.0) still leads. If your product is abstract reasoning, look elsewhere.

Teams that can’t run new serving stacks. CED, CSA2, and FP4 KV caching require relatively recent inference-engine support. If you’re pinned to an older serving runtime, expect to upgrade first.

Low-context, generation-heavy workloads. The architecture optimizes for input-heavy patterns. A chatbot that pre-fills once and generates long outputs doesn’t capture the prefill savings.

Limitations and caveats

  • Benchmarks are self-reported. The agentic figures come from DeepSeek’s own evaluation framework, and several harness results depend on specific scaffolds (mini-SWE for DeepSWE, Claude Code for SEC-Bench Pro). Independent reproductions are still landing.
  • New architecture, new rough edges. CED and CSA2 are not drop-in replacements for a standard decoder. Expect ecosystem support to lag the big decoder-only models for a while.
  • The Engram memory is sparsely accessed. Its 196B parameters add long-horizon capability but also complexity; the real-world benefit over a well-tuned RAG or scratchpad is still being established.
  • No exact API pricing published in the release. The model is MIT-licensed and open, but hosted pricing depends on where you run it — DeepSeek’s own platform, or a third-party host like Together or SiliconFlow.

The bottom line

DeepSeek V4.1-Flash is the clearest statement yet that the next optimization frontier for open source AI models isn’t raw capability — it’s the economics of agentic workloads. The CED architecture cuts prefill to 8B active parameters, the KV cache to 890 bytes per token, and it does so while posting LLM benchmarks 2026 has made central — DeepSWE, Terminal-Bench, AutomationBench — at or above the closed frontier. If you’re building coding agents and watching the token bill, this is the release to test against your current model.

Sources

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen