Paper Breakdowns  /  DeepSeek-V4
Paper 102~9 min readDeepSeek · 2026
Paper Breakdown

DeepSeek-V4,
explained.

V3 made the industry ask what its compute actually bought. V4 asks the harder follow-up: as context grows to a million tokens, why should the attention bill grow with it? The report's answer is one idea worn on two faces — compress every token, then attend to only a few — plus a training swap that drops heavy reinforcement learning for a teacher grading the student's own work. 1.6T parameters, 49B awake at a time, a 1M-token window served at roughly a tenth of V3.2's cache.

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

The shape: bigger store, same small bite

V4 takes the mixture-of-experts lesson of V3 and pushes the ratio harder: roughly 1.6T total parameters, of which only about 49B activate per token — near 3%. The store of knowledge more than doubles; the per-token compute barely moves. That is the whole point of a sparse MoE, and V3 already proved it trains and serves.

But a bigger brain is the easy part. The expensive part of a modern model is not the feed-forward experts — it's attention at long context. Double the parameters and you double a cost you already know how to shard. Take context from 128k to 1M and you hit a wall that grows with the square of the sequence. V4's real work is that wall, and the next three sections are how it comes down.

02

Hybrid attention: two levers on one bill

Attention costs you in two currencies. Memory: the KV cache stores a key and value for every token you've seen, so it grows linearly with context and batch. Compute: every new query scores itself against every stored key, so attention FLOPs grow with the square of the sequence. V4's hybrid attention attacks both at once, and the trick is that the two savings multiply.

Hybrid attention — compress the token, then select the blocks
Full K/V
per token, wide
Compress
latent width dc
Select top-k blocks
skip the rest
Score few, cheap
less memory · less work

Lever one shrinks the memory per token (a descendant of V3's multi-head latent attention). Lever two shrinks the number of tokens scored (only the most relevant blocks of the past, not all of it). Neither alone gets you to a cheap million-token context; together they compound. The two sections below take them one at a time, then the runnable version proves the multiplication.

03

Lever one: compress every token

V3 introduced multi-head latent attention — cache one small latent vector per token instead of full per-head keys and values, and reconstruct the heads at use time. V4 keeps that idea and leans on it harder, because at a million tokens the cache is the serving cost.

The saving is countable and, crucially, it does not depend on how long the context gets — you compress each token the same way whether the sequence is a thousand tokens or a million:

dense: n·width  ·  latent: n·dc  →  ratio = dc / width (per-token, context-invariant)

A latent of 512 against a 4096-wide K/V is an smaller cache — the same 8× at 1k tokens and at 1M. The runnable below checks that invariance.

04

Lever two: attend to only a few blocks

Dense attention has every query score every past key — that squared term. But most of that scoring is wasted: for any given query, the vast majority of a million past tokens are irrelevant. Compressed sparse attention chops the past into fixed blocks and, per query, selects only the top-k blocks worth scoring. Below the budget nothing is dropped; above it, the work stops growing with the sequence.

dense FLOPs: n·n·width  ·  selected keys = min(n, k·b)  ·  hybrid FLOPs: n·min(n,k·b)·dc

Once n > k·b, the scored-key count freezes at k·b while a dense model keeps paying n. Compression's dc/width then multiplies on top.

The key idea

Compression is a constant discount on every token; selection is a growing discount as context lengthens. Multiply a fixed 8× by a selection ratio that keeps shrinking, and the total attention bill at 1M tokens lands far below the dense curve — without throwing away the tokens that actually matter to each query.

05

On-policy distillation: skip the reward loop

R1 earned its reasoning with large-scale reinforcement learning: sample answers, score them with a verifiable reward, push the policy up the gradient. It works, but RL at frontier scale is expensive and finicky — reward design, instability, compute. V4's report swaps in on-policy distillation.

The student generates its own answers — on-policy, in its own distribution — and a stronger teacher grades or corrects those exact trajectories. The signal is the teacher's judgement of the student's own work, not a scalar reward feeding a policy-gradient update. You keep the on-policy virtue that made RL good (train on the states the model actually visits) while dropping the reward machinery that made it hard.

RL: sample → scalar reward → policy-gradient step (unstable, needs a reward model)
On-policy distillation: student samples → teacher corrects that trajectory → imitate (dense signal, stable)
06

The receipt: a million tokens, cheaply

ItemReported
Total / active parameters≈ 1.6T total · ≈ 49B active per token
Context length1M tokens
KV cache vs V3.2 @ 1M≈ 10%
Attention FLOPs vs V3.2 @ 1M≈ 27%
Reasoning trainingon-policy distillation (in place of large-scale RL)

These are the technical report's headline figures, and the mechanism above is why they're plausible: a per-token cache discount that holds at any length, times a scored-key count that stops growing once the sequence outruns the selection budget. The runnable model below reproduces the shape of those savings from the two levers — a mechanism you can change and re-measure, not a benchmark to take on faith.

07

Why it matters

V3 made training efficiency a first-class axis. V4 does the same for serving at long context — the cost that actually bites once agents read whole codebases and month-long histories. Its hybrid of compression and selection is the shape the whole field is converging on, and it pairs naturally with an explicit memory layer like Titans-style surprise memory for what should persist beyond the window.

The training story matters too: if a teacher grading a student's own trajectories can stand in for a full RL loop, the reasoning recipe that R1 made famous gets cheaper and steadier to reproduce. Read alongside Kimi K2, the sibling trillion-scale open model, V4 is the clearest sign that the frontier's real competition is now efficiency engineering — cache, sparsity, and cheaper post-training — not raw parameter count.

Read next

The predecessor whose ideas V4 scales: DeepSeek-V3. The reasoning it re-trains more cheaply: DeepSeek-R1. The trillion-scale sibling: Kimi K2.

RUN IT YOURSELF

The two levers, multiplied

Hybrid attention's win is arithmetic, and arithmetic is checkable. This models both levers — compress each token's K/V into a latent width, and select only the top-k blocks per query — then compares them to dense attention at a 1M-token context. Watch the KV ratio stay fixed no matter the length (compression is per-token) while the selected-key count freezes at k·b and the FLOPs ratio collapses (the two discounts multiply). Change the widths, block size, or how many blocks you keep.

CPython · WebAssembly
Frequently asked

Quick answers

What is DeepSeek-V4?

A ~1.6T-parameter open-weight MoE (~49B active/token) built for cheap long context — a 1M-token window served at roughly a tenth of V3.2's KV cache, via hybrid sparse attention, and post-trained with on-policy distillation instead of large-scale RL.

What is hybrid attention?

Two levers at once: compress each token's keys/values into a small latent (less memory per token), and select only the top-k blocks of the past to score against (less work per query). The two savings multiply.

What is on-policy distillation?

The student generates its own answers and a stronger teacher grades or corrects those exact trajectories — a dense, stable training signal that replaces the reward model and policy-gradient loop of RL.

How does it relate to V3 and R1?

V3 gave it the MoE + latent-attention foundation; R1 gave it the reasoning recipe. V4 scales the MoE, attacks the long-context cost wall with hybrid attention, and re-trains reasoning more cheaply via distillation.

DeepSeek-V4 Technical Report · DeepSeek-AI · 2026 · reported figures from the technical report · Vibe Engines · 2026
Finished this one? 0 / 108 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns