Kimi · Moonshot AI
Kimi K2
Kimi K2 from Moonshot AI has 1,026,408,232,448 parameters, of which about 32.9B are used for each token (a mixture of experts). Its weights take 2.05 TB in BF16 and about 513 GB at 4-bit, and each token of context adds 70.3 KB of KV cache (2.3 GB at 32K tokens).
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 | 64 (query/key 128+64, value 128); KV compressed to rank 512 |
| Feed-forward | 384 experts of 2,048, 8 per token, plus 1 shared (SwiGLU); 1 dense layer (layer 0) with FFN 18,432 |
| Vocabulary (V) | 163,840 |
| Tied embeddings | no: separate output head |
| Biases | none |
| Extra norms | pre-norm (RMSNorm before attention and FFN) |
| Max context | 131,072 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 | 4.11 TB | 3823.67 GiB |
| BF16 / FP16 | 2 | 2.05 TB | 1911.83 GiB |
| INT8 / FP8 | 1 | 1.03 TB | 955.92 GiB |
| INT4 | 0.5 | 513 GB | 477.96 GiB |
| As released | 1 (FP8) | 1.03 TB | 958.26 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):
Too big for any single card up to 80 GB, even at 4-bit: it needs 578 GB there. Split across 80 GB GPUs it takes at least 27 at BF16, 15 at 8-bit, 8 at 4-bit (the last row).
| GPU memory | BF16 | 8-bit | 4-bit |
|---|---|---|---|
| 80 GB | 2.05 TBtoo big | 1.09 TBtoo big | 578 GBtoo big |
| 80 GB × n | 27 cards | 15 cards | 8 cards |
Each cell is the weights plus the 8K-token KV cache at that precision; ✓ where it fits. The 80 GB × n row divides that evenly over n cards (tensor or pipeline parallel), the best case: real splits duplicate some buffers.
KV cache
What it is: the KV cache, explained.
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 × 64 × (192 + 128) × 2 = 2.5 MB per token.
| Context | KV cache, BF16 | 8-bit KV | Weights + KV, BF16 |
|---|---|---|---|
| 4K | 288 MB | 144 MB | 2.05 TB |
| 32K | 2.3 GB | 1.2 GB | 2.06 TB |
| 128K (max) | 9.2 GB | 4.6 GB | 2.06 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 | [163,840, 7,168] | 1,174,405,120 |
| Dense blocks (layer 0): 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 | [12,288, 1,536] | 18,874,368 |
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 | [16,384, 512] | 8,388,608 |
self_attn.o_proj.weight | [7,168, 8,192] | 58,720,256 |
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 1–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 | [12,288, 1,536] | 18,874,368 |
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 | [16,384, 512] | 8,388,608 |
self_attn.o_proj.weight | [7,168, 8,192] | 58,720,256 |
mlp.gate.weightthe router: one score per expert | [384, 7,168] | 2,752,512 |
mlp.gate.e_score_correction_biasrouting only | [384] | 384 |
mlp.experts.{0…383}.gate_proj.weight | 384 × [2,048, 7,168] | 5,637,144,576 |
mlp.experts.{0…383}.up_proj.weight | 384 × [2,048, 7,168] | 5,637,144,576 |
mlp.experts.{0…383}.down_proj.weight | 384 × [7,168, 2,048] | 5,637,144,576 |
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 | [163,840, 7,168] | 1,174,405,120 |
The parameter count, step by step
Each line gives the formula, the numbers from config.json, and the subtotal. The symbols:
- V
- vocabulary 163,840
- d
- hidden size 7,168
- L
- layers 61
- H
- attention heads 64
- 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 384
- 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 (layer 0)
3. MoE blocks (layers 1–60), ×60
4. Final norm and output head
5. Total
6. Active parameters per token
The router sends each token to 8 of the 384 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.
Hugging Face counts 1,026,408,235,864 parameters in the moonshotai/Kimi-K2-Base safetensors files. That includes 3,416 that are not separate weights: The checkpoint also stores 61 × 56 rotary-embedding frequency buffers (rotary_emb.inv_freq). They are recomputed at load time and are not weights. 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 × 32,861,500,928 = 65.7 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 | 65.7 GFLOPs | 10.2 GFLOPs | 76.0 GFLOPs |
| 32K | 65.7 GFLOPs | 81.9 GFLOPs | 147.6 GFLOPs |
| 128K | 65.7 GFLOPs | 327.5 GFLOPs | 393.2 GFLOPs |
Training costs about three times the forward pass per token (6N): the backward pass does roughly twice the forward work.
More in the glossary: FLOPs per token · quantization · parameters.
Compare
Kimi K2 vs Inkling · Kimi K2 vs DeepSeek-V3 · Compare with any model →
Close in size: Ling-1T 1000B · Inkling 947B · GLM-5.2 743B · DeepSeek-V3.2 672B · DeepSeek-V3 671B
Source
Read from moonshotai/Kimi-K2-Base, fetched 2026-12-03. Kimi K2.5, K2.6 and K2.7-Code keep this language model and add a vision encoder; Kimi K2-Thinking ships it with INT4 experts.