DeepSeek-V4
Distinguish active experts from stored parameters, then separate compression from sparse attention.
Jump to a section
Thirteen billion parameters per token, 284 billion in memory
The DeepSeek-V4 technical report describes two open-weight mixture-of-experts models. Flash has 284B parameters in total and activates 13B for each token. Pro has 1.6T in total and activates 49B. Both target contexts of a million tokens.
Two separate economies are at work. Expert routing cuts the parameters each token uses. Compressed attention cuts the cost of a long prefix. Neither headline number tells you how much memory a deployment needs, and conflating them is the most common way to misread the model.
Compress · select entries · attend
Compress more · attend to entries
Experts cut compute, not residency
From the rounded counts, Pro activates of its parameters per token and Flash . Pro is the sparser of the two. Neither ratio is a latency ratio, and neither is the fraction of experts a token selects, because embeddings and other shared components enter the parameter counts too.
The ratio says nothing about storage. A token is routed to a subset of experts, but the next token may choose different ones, so all of them have to stay available. At a hypothetical one byte per parameter, Flash would occupy 284 GB while any single token reads about 13 GB of it.
Batching makes this sharper. Each token in a batch makes its own routing choice, so the set of experts the batch needs is the union of those choices, and a larger batch can only widen it. A serving system cannot load only the experts one token needs and expect the next step to find them in place.
Two kinds of compressed attention layer
The attention stack mixes two layer types. Compressed Sparse Attention (CSA) compresses the prefix into entries and then selects a subset of them for each query. Heavily Compressed Attention (HCA) compresses the prefix further and attends to the result. The report also gives each of these layer types a separate sliding-window branch for nearby tokens.
These are different layer types, not two steps that every layer runs in sequence. And none of them is expert routing: compression and selection live in the attention sublayer, routing lives in the feed-forward sublayer.
Within attention, the two operations change different costs. Compression changes what one stored entry represents. Selection changes how many entries a query reads. A design can use either without the other.
A bounded read is not bounded storage
Take a hypothetical compressed store that summarises every group of tokens as one entry. A prefix of tokens then holds about entries. If a query selects of them, that branch reads at most entries, however long the prefix gets.
The store itself still grows with . Building entries, scoring them to choose the , and the local window are separate costs, each with its own size and dimensions.
The ledger below makes the distinction concrete. Its compression ratio of 8, top- of 16 and window of 128 are illustrative, not the V4 configuration, and it is not DeepSeek's learned compressor or indexer.
1from math import ceil
2
3def ledger(tokens, compression=8, selected=16, window=128):
4 entries = ceil(tokens / compression)
5 return {
6 "compressed_entries": entries,
7 "selected_entries": min(entries, selected),
8 "local_tokens": min(tokens, window),
9 }
10
11assert ledger(1024) == {
12 "compressed_entries": 128,
13 "selected_entries": 16,
14 "local_tokens": 128,
15}
16assert ledger(2048)["compressed_entries"] == 256
17assert ledger(2048)["selected_entries"] == 16Doubling the context from 1,024 to 2,048 tokens doubles the stored entries and leaves the selected count at 16. The ledger ignores how incomplete compression groups and attention sinks are handled, which a real implementation has to decide.
Where the accounting goes wrong
Expert residency. A deployment runs out of device memory even though 13B active parameters looks small. Fetching only the current token's experts does not fix it: the next token can route elsewhere, every transfer costs time, and a batch requests the union of its tokens' experts.
Context growth. A teammate reads that an attention layer touches only a fixed number of compressed entries and concludes that doubling the context cannot increase memory. The compressed store still grows with the prefix, and the local window, temporary buffers and compression state need their own accounting. A latency claim also needs the indexer's work, kernel behaviour and memory traffic, none of which the ledger above models.
Lost information. Compression saves space by discarding detail, and the detail a particular task needs may be among it. A nominal million-token limit does not guarantee that every long-range dependency is used correctly. Measure answer quality on the context lengths and documents you actually serve.
Sources and further reading
- DeepSeek-V4 technical report, §2.1 and §2.3: parameter counts, CSA, HCA and the sliding-window branch.
- DeepSeek-V4-Pro official model repository.