DeepSeek · DeepSeek
DeepSeek-R1
DeepSeek-R1 from DeepSeek has 671,026,419,200 parameters, of which about 37.6B are used for each token (a mixture of experts). Its weights take 1.34 TB in BF16 and about 336 GB at 4-bit, and each token of context adds 70.3 KB of KV cache (2.3 GB at 32K tokens).
Part of the DeepSeek family: 15.7B · 671B · 671B
Architecture · VRAM · KV cache · Tensor shapes · Parameter count · FLOPs
Architecture
| Architecture | DeepseekV3ForCausalLM |
|---|---|
| Layers (L) | 61 |
| Hidden size (d) | 7,168 |
| Attention | MLA (multi-head latent attention) |
| Heads | 128 (query/key 128+64, value 128); KV compressed to rank 512 |
| Feed-forward | 256 experts of 2,048, 8 per token, plus 1 shared (SwiGLU); 3 dense layers (layers 0–2) with FFN 18,432 |
| Vocabulary (V) | 129,280 |
| Tied embeddings | no: separate output head |
| Biases | none |
| Extra norms | pre-norm (RMSNorm before attention and FFN) |
| Max context | 163,840 tokens |
| Weights in the release | FP8 (with BF16 scales and norms) |
How much memory the weights need
Each parameter takes 4 bytes in FP32, 2 in BF16, 1 at 8 bits and half a byte at 4 bits, so the weights alone need:
| Precision | Bytes per parameter | Weights | |
|---|---|---|---|
| FP32 | 4 | 2.68 TB | 2499.77 GiB |
| BF16 / FP16 | 2 | 1.34 TB | 1249.88 GiB |
| INT8 / FP8 | 1 | 671 GB | 624.94 GiB |
| INT4 | 0.5 | 336 GB | 312.47 GiB |
| As released (whole checkpoint) | 1 (FP8) | 688 GB | 641.13 GiB |
GB here is 109 bytes; GiB (230) is what tools like nvidia-smi show. Real 4-bit files are a little larger: they also store scales, and some layers are often kept at higher precision. Every expert has to be in memory, not just the active ones: the router picks different experts for each token. A running model also needs its KV cache, activations and the runtime's own buffers.
On common GPUs
Whether the weights plus a 8K-token KV cache fit in 90% of the card (how this is worked out):
KV cache
MLA caches one compressed latent of r_kv = 512 numbers plus a shared RoPE key of h_r = 64 per layer, instead of full keys and values for every head:
L × (r_kv + h_r) × 2 bytes = 61 × (512 + 64) × 2 = 70,272 bytes per token
That is the figure for runtimes that cache the latent (vLLM, SGLang, DeepSeek's own). Code that expands it back to per-head keys and values caches 61 × 128 × (192 + 128) × 2 = 5.0 MB per token.
| Context | KV cache, BF16 | 8-bit KV | Weights + KV, BF16 |
|---|---|---|---|
| 4K | 288 MB | 144 MB | 1.34 TB |
| 32K | 2.3 GB | 1.2 GB | 1.34 TB |
| 128K | 9.2 GB | 4.6 GB | 1.35 TB |
| 160K (max) | 11.5 GB | 5.8 GB | 1.35 TB |
For one sequence. Batching multiplies the KV cache by the number of sequences, not the weights.
Every tensor shape
The names are those in the Hugging Face checkpoint; shapes are [out, in] for weight matrices, as PyTorch stores them. One block is shown: the model repeats it 61 times (in two kinds).
| Tensor | Shape | Parameters |
|---|---|---|
| Embedding | ||
model.embed_tokens.weight | [129,280, 7,168] | 926,679,040 |
| Dense blocks (layers 0–2): model.layers.N.… | ||
self_attn.q_a_proj.weightcompress the query | [1,536, 7,168] | 11,010,048 |
self_attn.q_a_layernorm.weight | [1,536] | 1,536 |
self_attn.q_b_proj.weightexpand to every head | [24,576, 1,536] | 37,748,736 |
self_attn.kv_a_proj_with_mqa.weightthe latent that is cached, plus one shared RoPE key | [576, 7,168] | 4,128,768 |
self_attn.kv_a_layernorm.weight | [512] | 512 |
self_attn.kv_b_proj.weightexpand the latent to keys and values | [32,768, 512] | 16,777,216 |
self_attn.o_proj.weight | [7,168, 16,384] | 117,440,512 |
mlp.gate_proj.weight | [18,432, 7,168] | 132,120,576 |
mlp.up_proj.weight | [18,432, 7,168] | 132,120,576 |
mlp.down_proj.weight | [7,168, 18,432] | 132,120,576 |
input_layernorm.weight | [7,168] | 7,168 |
post_attention_layernorm.weight | [7,168] | 7,168 |
| MoE blocks (layers 3–60): model.layers.N.… | ||
self_attn.q_a_proj.weightcompress the query | [1,536, 7,168] | 11,010,048 |
self_attn.q_a_layernorm.weight | [1,536] | 1,536 |
self_attn.q_b_proj.weightexpand to every head | [24,576, 1,536] | 37,748,736 |
self_attn.kv_a_proj_with_mqa.weightthe latent that is cached, plus one shared RoPE key | [576, 7,168] | 4,128,768 |
self_attn.kv_a_layernorm.weight | [512] | 512 |
self_attn.kv_b_proj.weightexpand the latent to keys and values | [32,768, 512] | 16,777,216 |
self_attn.o_proj.weight | [7,168, 16,384] | 117,440,512 |
mlp.gate.weightthe router: one score per expert | [256, 7,168] | 1,835,008 |
mlp.gate.e_score_correction_biasrouting only | [256] | 256 |
mlp.experts.{0…255}.gate_proj.weight | 256 × [2,048, 7,168] | 3,758,096,384 |
mlp.experts.{0…255}.up_proj.weight | 256 × [2,048, 7,168] | 3,758,096,384 |
mlp.experts.{0…255}.down_proj.weight | 256 × [7,168, 2,048] | 3,758,096,384 |
mlp.shared_experts.gate_proj.weightshared expert: runs for every token | [2,048, 7,168] | 14,680,064 |
mlp.shared_experts.up_proj.weightshared expert: runs for every token | [2,048, 7,168] | 14,680,064 |
mlp.shared_experts.down_proj.weightshared expert: runs for every token | [7,168, 2,048] | 14,680,064 |
input_layernorm.weight | [7,168] | 7,168 |
post_attention_layernorm.weight | [7,168] | 7,168 |
| After the last block | ||
model.norm.weightfinal norm | [7,168] | 7,168 |
lm_head.weightscores every token in the vocabulary | [129,280, 7,168] | 926,679,040 |
The parameter count, step by step
Each line gives the formula, the numbers from config.json, and the subtotal. The symbols:
- V
- vocabulary 129,280
- d
- hidden size 7,168
- L
- layers 61
- H
- attention heads 128
- h_n
- query/key size without RoPE 128
- h_r
- RoPE part of query/key 64
- h_v
- value size per head 128
- r_kv
- KV latent rank 512
- r_q
- query latent rank 1,536
- f
- FFN hidden size 18,432
- E
- routed experts 256
- k
- experts per token 8
- f_e
- expert FFN size 2,048
1. Embedding
One row of d numbers for each of the V tokens in the vocabulary.
2. Dense blocks (layers 0–2), ×3
3. MoE blocks (layers 3–60), ×58
4. Final norm and output head
5. Total
6. Active parameters per token
The router sends each token to 8 of the 256 experts in each MoE block, so only those experts' weights are used, plus the shared expert, which every token uses. One routed expert is 44,040,192 parameters.
7. Multi-token prediction
The checkpoint also ships 1 multi-token-prediction module, trained to guess a further token ahead. It is not used for ordinary decoding (it can drive speculative decoding), so it is left out of the total above but is in the files.
Hugging Face counts 684,489,845,504 parameters in the deepseek-ai/DeepSeek-R1 safetensors files. The arithmetic above matches exactly.
FLOPs per token
A forward pass costs about two floating-point operations (a multiply and an add) for every weight a token passes through: 2 × N, with N the active weights used in matrix multiplies (the embedding lookup is a read, not a multiply; the output head is a multiply). Here that is 2 × 37,552,297,472 = 75.1 GFLOPs per token.
Attention adds the work of comparing the token with every earlier one: 2 × L × T × H × (hqk + hv) for T tokens of context, which grows with the context while 2N does not.
That is for one new token at position T, as when generating. Averaged over a whole training sequence of length T, each token sees T/2 earlier ones on average, which halves it.
| Context T | 2N | Attention | Total per token |
|---|---|---|---|
| 4K | 75.1 GFLOPs | 20.5 GFLOPs | 95.6 GFLOPs |
| 32K | 75.1 GFLOPs | 163.7 GFLOPs | 238.9 GFLOPs |
| 128K | 75.1 GFLOPs | 655.0 GFLOPs | 730.1 GFLOPs |
| 160K | 75.1 GFLOPs | 818.7 GFLOPs | 893.8 GFLOPs |
Training costs about three times the forward pass per token (6N): the backward pass does roughly twice the forward work.
Compare
Close in size: DeepSeek-V3 671B · Llama 3.1 405B 406B · Llama 4 Maverick (17B-128E) 401B · Qwen3 235B-A22B 235B · Mixtral 8x22B 141B
Source
Read from deepseek-ai/DeepSeek-R1, fetched 2026-12-02.