The Rabbit Hole / AI / Model architectures
DeepSeek · Architecture mapDeepSeek-V4
HCA and CSA layers with a 128-token recent window, shared K/V entries and four residual streams.
DeepSeek-V4 preview, 2026 · DeepSeek release timeline
Inside DeepSeek-V4
Inside HCA · Layers 1–2 (HCA, hash-routed experts)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA · Layer 3 (CSA, hash-routed experts)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Model-specific details
- Layers 1–2 (HCA, hash-routed experts) · 2 repetitions
- 384 routed experts (hidden size 3072), 6 chosen per token, plus 1 shared expert. These first layers pick experts with a fixed hash of the token id instead of a learned router.
- Layer 3 (CSA, hash-routed experts) · 1 repetitions
- 384 routed experts (hidden size 3072), 6 chosen per token, plus 1 shared expert. These first layers pick experts with a fixed hash of the token id instead of a learned router.
- CSA layers 5, 7, … 61 · 29 repetitions
- 384 routed experts (hidden size 3072), 6 chosen per token, plus 1 shared expert, scored with square-root softplus.
- HCA layers 4, 6, … 60 · 29 repetitions
- 384 routed experts (hidden size 3072), 6 chosen per token, plus 1 shared expert, scored with square-root softplus.
- Attention and positions
- 128 query heads share one key/value head of size 512; each stored entry serves as both key and value. CSA layers compress the sequence 4 to 1 and an indexer keeps the top 1,024 entries; heavily compressed layers compress 128 to 1 and attend to all of them. Every layer also attends to the last 128 tokens, with learned attention-sink logits.
- Memory
- One 512-value key/value head per compressed entry (4 to 1 or 128 to 1), plus the last 128 tokens uncompressed. About 10% of the KV cache of DeepSeek-V3.2 at 1M tokens, per the report.
Inside sliding-window attention · Layers 1–2 (sliding window only, hash-routed experts)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA · Layer 3 (CSA, hash-routed experts)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside HCA · HCA layers 4, 6, … 42
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Model-specific details
- Layers 1–2 (sliding window only, hash-routed experts) · 2 repetitions
- 256 routed experts (hidden size 2048), 6 chosen per token, plus 1 shared expert. These first layers pick experts with a fixed hash of the token id instead of a learned router.
- Layer 3 (CSA, hash-routed experts) · 1 repetitions
- 256 routed experts (hidden size 2048), 6 chosen per token, plus 1 shared expert. These first layers pick experts with a fixed hash of the token id instead of a learned router.
- CSA layers 5, 7, … 43 · 20 repetitions
- 256 routed experts (hidden size 2048), 6 chosen per token, plus 1 shared expert, scored with square-root softplus.
- HCA layers 4, 6, … 42 · 20 repetitions
- 256 routed experts (hidden size 2048), 6 chosen per token, plus 1 shared expert, scored with square-root softplus.
- Attention and positions
- 64 query heads share one key/value head of size 512; each stored entry serves as both key and value. CSA layers compress 4 to 1 and an indexer keeps the top 512 entries; HCA layers compress 128 to 1. The first two layers use only the 128-token window.
- Memory
- One 512-value key/value head per compressed entry, plus the last 128 tokens uncompressed. About 7% of the KV cache of DeepSeek-V3.2 at 1M tokens, per the report.
Keep recent detail, retain a longer history
Each attention layer keeps the latest 128 tokens individually. Its long-range history follows one of two policies:
- HCA: heavily compressed attention combines each non-overlapping 128-token block into one entry and reads every completed entry.
- CSA: compressed sparse attention pools eight-position windows, producing an entry every four tokens. Its lightning indexer selects up to 1,024 summaries in Pro, or 512 in Flash, to read alongside the recent tokens.
These are different layer types, each with its own cache. The diagram’s HCA and CSA blocks link to their explanations. Flash’s first two layers use only the recent window.
Different queries, shared entries
MQA lets every query head read the same cache. Shared K/V representations make each stored entry one 512-coordinate vector, used both as a key to score and a value to collect.
The heads still ask different questions. A shared Wqa projection first produces a smaller query intermediate for the current token. Each head’s Wqb turns that intermediate into its own 512-coordinate query, followed by per-head RMSNorm and RoPE. The intermediate is shared computation for this token, rather than stored history.
Each head reads the recent entries together with its eligible summaries, using one softmax. Its learned sink score can absorb attention without contributing a value. The collected result then receives an inverse rotary transformation before the output projections.
Combine the head results
Mixing all the head results directly would require a large projection. Instead, split them into groups of eight heads. Each group contains 8 × 512 = 4,096 coordinates; Woa projects those down to 1,024. Concatenate the smaller group results, then Wob projects them back to the token width.
Pro has 16 groups, giving 16,384 intermediate coordinates. Flash has eight, giving 8,192. The expanded attention diagrams above show the query projections, per-head reads and grouped output projections.
Pro and Flash
| Pro | Flash | |
|---|---|---|
| Layers | 61 | 43 |
| Token width | 7,168 | 4,096 |
| Query heads | 128 | 64 |
| Shared query intermediate | 1,536 | 1,024 |
| Output groups | 16 | 8 |
| CSA summary read limit | 1,024 | 512 |
| Routed experts | 384 | 256 |
Both support 1,048,576 tokens. Attention sits inside a model with four mHC residual streams. Expert layers select six routed experts plus one shared expert; the first three layers use hash routing.
DeepSeek-V4.1 changes the encoder/decoder and compression arrangement and has its own model page.
How it scores
AA Intelligence Index
Version 4.3.2 · higher is better · checked 2026-11-01. Separate from Epoch ECI.
| Checkpoint / size | Result | Evaluation |
|---|---|---|
| DeepSeek V4 Pro 0424Pro | 30 | AA Index 4.3.2Best evaluated setting |
| DeepSeek V4 Pro 0813Pro | 36 | AA Index 4.3.2Best evaluated setting |
| DeepSeek V4 Flash 0420Flash | 24 | AA Index 4.3.2Best evaluated setting |
| DeepSeek V4 Flash 0731Flash | 34 | AA Index 4.3.2Published checkpoint |
Epoch ECI
Results for the checkpoints named below, from Epoch AI, Capabilities & benchmarking (CC BY 4.0), snapshot of 2026-10-16.
| Size | Scored checkpoint | Epoch ECI | GPQA Diamond | SWE-bench Verified |
|---|---|---|---|---|
| Pro | DeepSeek-V4-ProOpen weights (unrestricted) · 2026-04 | 149ahead of 78% of 277 scored models | 90.9% | 77.6% |
| Flash | DeepSeek-V4-FlashOpen weights (unrestricted) · 2026-04 | 146ahead of 71% of 277 scored models | — | — |
- Pro: April 2026 preview row, matching the entry; Epoch also has a later "DeepSeek V4 Pro 0813" revision.
- Flash: April 2026 preview row, matching the entry; Epoch also has a later "DeepSeek V4 Flash 0731" revision.
Where a model was tested in several reasoning or effort settings, the best score is shown. A dash means no result for that test.
Explore the components
- Embeddings: giving every token a meaning
- Residual connections: when more layers made things worse
- A whole LLM, layer by layer
- RMSNorm: keeping a token's scale under control
- Hyper-connections: more than one residual stream
- Heavily compressed attention (HCA): keeping a compressed history
- Compressed sparse attention (CSA): keeping more detail and reading less
- Sparse attention and the lightning indexer
- Sliding-window attention (SWA): a cache that stops growing
- Attention sinks: where does unused attention go?
- Mixture of experts (MoE): a big model that uses only part of itself
- Routing: selecting experts and weighting their work
- Multi-token prediction (MTP): learning to look further ahead
- RoPE scaling: stretching context beyond the training length
- RoPE: position as a rotation
- Partial RoPE: rotating only part of each head
- Weight quantisation: could we store the model in fewer bits?
- Hash routing: choosing experts without a learned routercoming soonPicks experts with a fixed hash of the token instead of a learned router.
- Attention, from scratch
- The KV cache: why LLMs remember every key and value