The Rabbit Hole / AI / Model architectures
DeepSeek · Architecture mapDeepSeek-V4.1
A causal encoder-decoder: the first 20 layers read the prompt, the last 20 generate, and the decoder takes its key/value cache from the encoder output.
DeepSeek-V4.1-Flash, September 2026; checkpoint update 17 October 2026 · DeepSeek release timeline
Inside DeepSeek-V4.1
Inside sliding-window attention · Layers 1–2 (sliding window only)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA2 · Full layers 3, 9 and 15
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA2 · Reuse layers (the other 15 encoder layers)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA2 · Full layer 21 (its KV comes from encoder layer 20)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA2 · Reindex layers 25, 29, 33 and 37
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside CSA2 · Reuse layers (the other 15 decoder layers)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Model-specific details
- Layers 1–2 (sliding window only) · 2 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Engram at layer 2
- The first of two Engram lookup-memory modules (196B parameters in total), added to the residual stream at this layer.
- Full layers 3, 9 and 15 · 3 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Engram at layer 15
- The second Engram module, added to the residual stream at this layer.
- Reuse layers (the other 15 encoder layers) · 15 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Full layer 21 (its KV comes from encoder layer 20) · 1 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Reindex layers 25, 29, 33 and 37 · 4 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Reuse layers (the other 15 decoder layers) · 15 repetitions
- Every layer is a mixture of experts: 384 routed experts (hidden size 2304), 6 chosen per token, plus 1 shared expert.
- Attention and positions
- 64 query heads share one key/value head of size 512. Every layer also attends to the last 128 tokens. Attention layers have three modes: Full computes its own keys, values and token selection; Reindex re-scores a candidate set; Reuse reuses the selection of an earlier layer. Encoder layers compress the sequence 2 to 1; decoder layers do not compress and select blocks with a hierarchical indexer.
- Memory
- The global KV cache is stored in 4-bit floats (FP4), 890 bytes per token, about a quarter of V4-Flash. Sliding-window keys and values are layer-local and are rebuilt by replaying the most recent 128 tokens when they are not cached.
What changes through the stack
- The 40 layers split into a 20-layer causal encoder and a 20-layer decoder. Prompt prefill uses 8B active parameters; generating a token uses 16B.
- The decoder’s global cache comes from the encoder output. Its sliding-window layers replay the final 128 prompt tokens to establish their own state.
- Full attention layers compute token selection, Reindex layers re-score candidates, and Reuse layers share an earlier selection. Encoder layers compress 2:1; decoder layers do not.
- Every layer selects 6 of 384 experts, plus one shared expert. Engram memory joins at layers 2 and 15.
- The global cache uses 4-bit floats: about 890 bytes per token.
Release
V4.1-Flash has a 552B-parameter backbone and 196B Engram memory. The complete multimodal checkpoint totals 763B parameters. Its recommended context is 1,048,576 tokens.
The 17 October checkpoint
DeepSeek-V4.1-Flash-1017 updates the weights. DeepSeek reports these results against the original Flash checkpoint:
| Benchmark | Original | 1017 |
|---|---|---|
| HLE, without tools | 36.8 | 42.6 |
| Terminal-Bench 4.0 | 31.2 | 42.3 |
| DeepSWE v1.1 | 74.2 | 77.0 |
| ProgramBench | 20.3 | 29.1 |
| NL2Repo-Bench | 65.4 | 68.2 |
| Automation-Bench v1.0.6 | 54.8 | 60.5 |
| Agents’ Last Exam | 31.8 | 35.4 |
| Apex Bench v1.1 | 64.6 | 72.1 |
| Chartography, with tools | 78.9 | 83.0 |
| BabyVision, with tools | 89.6 | 92.5 |
| ZeroBench-main, with tools | 49.0 | 51.0 |
HLE’s text-only subset rises from 39.1 to 44.0. Terminal-Bench uses Claude Code; DeepSWE uses Mini-SWE-V2; ZeroBench uses Pass@5. These are DeepSeek’s reported results; the Epoch score below belongs to the September checkpoint.
The release notes also report shorter outputs and faster task completion, with unchanged API pricing. deepseek-flash now serves 1017.
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.1 FlashFlash | 39 | AA Index 4.3.2Best evaluated setting |
| DeepSeek V4.1 Flash 1017Flash | 45 | AA Index 4.3.2Published checkpoint |
Epoch ECI
Results for the checkpoint named below, from Epoch AI, Capabilities & benchmarking (CC BY 4.0), snapshot of 2026-10-16.
| Scored checkpoint | Epoch ECI | GPQA Diamond | SWE-bench Verified |
|---|---|---|---|
| DeepSeek V4.1 FlashOpen weights (unrestricted) · 2026-09 | 156ahead of 89% of 277 scored models | 89.8% | — |
- Flash: Epoch’s score is for the September 2026 launch checkpoint, not Flash-1017 (17 October). The checkpoint comparison above shows DeepSeek’s reported 1017 results.
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
- Encoder-decoder prefill: must every layer read the whole prompt?
- Compressed sparse attention 2 (CSA2): keep detail, narrow the search
- Sparse attention and the lightning indexer
- Sliding-window attention (SWA): a cache that stops growing
- Mixture of experts (MoE): a big model that uses only part of itself
- Multi-token prediction (MTP): learning to look further ahead
- Speculative decoding: guessing ahead and checking in one pass
- Vision encoders: how can image patches join the text?
- Weight quantisation: could we store the model in fewer bits?
- RoPE scaling: stretching context beyond the training length
- Attention, from scratch
- The KV cache: why LLMs remember every key and value
- RoPE: position as a rotation
- Routing: selecting experts and weighting their work
- N-gram memory: a lookup table for short runs of tokenscoming soonA big lookup table keyed by the last few tokens, read alongside the normal computation.
Sources for this map
- DeepSeek-V4.1-Flash-1017 model card and checkpoint comparison
- DeepSeek API changelog — 17 October 2026
- DeepSeek-V4.1 technical report
- DeepSeek-V4.1-Flash model card
- DeepSeek-V4.1-Flash config.json
- DeepSeek-V4.1-Flash reference inference code (model.py)
- Context length: model card recommends a 1M-token context window; the report trains at 64K then extends to 1M