Models / kimi_linear
Kimi-Linear-48B-A3B-Instruct: GPU memory to fine-tune
Fine-tuning Kimi-Linear-48B-A3B-Instruct at batch 1 and 512 tokens takes about 941 GB of GPU memory for a full fine-tune (at least 8 x H200 sharded), and 100.0 GB with LoRA r=16 on a bf16 base (borderline on one H200 141 GB). Estimated from the model's structure, reading the config under transformers semantics, not measured. What fits on which card.
Reconstructed from its own config.json
with no weights read. 177K downloads on Hugging Face.
Our count against the checkpoint
The left number comes from the graph. The right one is the number of scalars in the published weight files. Nothing on this page was tuned to make them agree.
custom-code This repository ships its own modeling code (`auto_map`, e.g. `configuration_kimi.py`), so `config.json` names a class in the repo rather than an architecture `transformers` defines. The graph below is what those config keys mean under `transformers` semantics, which is not necessarily what the repo's own file builds. A gap here is a statement about what we read, not about the checkpoint.
What it costs to run
Cost is a roofline estimate on the priced GPU for 10 epochs at batch 32, 512 tokens over 50,000 samples (assumed; no dataset attached).
Memory: what fits on which card
Largest batch per card. Training is sized at 512 tokens per sample, serving at 512 tokens per sequence.
| Card | Full fine-tune | LoRA r=16 | Serve bf16, 512 tokens |
|---|---|---|---|
| T4 16 GB | does not fit at batch 1 | does not fit at batch 1 | does not fit at batch 1 |
| L4 24 GB | does not fit at batch 1 | does not fit at batch 1 | does not fit at batch 1 |
| A100 40 GB | does not fit at batch 1 | does not fit at batch 1 | does not fit at batch 1 |
| A100 / H100 80 GB | does not fit at batch 1 | does not fit at batch 1 | does not fit at batch 1 |
| H200 141 GB | does not fit at batch 1 | batch 11, borderline | batch 1555 |
| Sharded, by memory alone | at least 8 x H200 or 14 x 80 GB |
Training: 512 tokens per sample (2048, or the model's context when shorter), AdamW with bf16 autocast, SDPA attention (no score matrix stored), 1.15x headroom on every card. Full fine-tune holds weights, gradients and optimizer state (1.2 x 16 bytes per parameter) plus activations. LoRA is r=16 on every linear layer but the head, base frozen in bf16 (2 bytes per parameter), adapters at full AdamW state, same activations. A two-card split is a contiguous layer cut (pipeline parallel), computed only where one card cannot hold batch 1. "Borderline" means the card holds batch 1 on the estimate but not on the conservative peak (the estimate x 1.43, at or above the measured peak on 95% of held-out runs): measure one step before reserving it. "Sharded" is a floor: the batch-1 peak with headroom divided across cards as if it split perfectly evenly (FSDP / ZeRO-3 for training, tensor parallel for serving), with no communication buffers counted. Serving: bf16 weights plus the KV cache of 512 tokens per sequence; prefill working set, CUDA context and framework reserve not counted.
These are estimates from the graph, not measurements. Against measured runs, held out by architecture, the estimate flagged 113 of the 131 jobs that did not fit their card and said "fits" on the other 18. Every measured run.
Structure
168 nodes. Output shapes are propagated from the input shape, batch dimension excluded, at 512 tokens: the config's maximum context.
| Layer | Type | Output shape | |
|---|---|---|---|
| 1 | Input | Input | 1 × 512 |
| 2 | Embedding | Embedding | 1 × 512 × 2304 |
| 3 | RoPE | RoPE | 1 × 512 × 2304 |
| 4 | RMSNorm_1_1 | RMSNorm | 1 × 512 × 2304 |
| 5 | Attention_1 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 6 | Add_1_attn | Add | 1 × 512 × 2304 |
| 7 | RMSNorm_1_2 | RMSNorm | 1 × 512 × 2304 |
| 8 | FFN_1 | SwiGLU | 1 × 512 × 2304 |
| 9 | Add_1_ffn | Add | 1 × 512 × 2304 |
| 10 | RMSNorm_2_1 | RMSNorm | 1 × 512 × 2304 |
| 11 | Attention_2 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 12 | Add_2_attn | Add | 1 × 512 × 2304 |
| 13 | RMSNorm_2_2 | RMSNorm | 1 × 512 × 2304 |
| 14 | MoE_2 | Shared-Expert MoE | 1 × 512 × 2304 |
| 15 | Add_2_ffn | Add | 1 × 512 × 2304 |
| 16 | RMSNorm_3_1 | RMSNorm | 1 × 512 × 2304 |
| 17 | Attention_3 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 18 | Add_3_attn | Add | 1 × 512 × 2304 |
| 19 | RMSNorm_3_2 | RMSNorm | 1 × 512 × 2304 |
| 20 | MoE_3 | Shared-Expert MoE | 1 × 512 × 2304 |
| 21 | Add_3_ffn | Add | 1 × 512 × 2304 |
| 22 | RMSNorm_4_1 | RMSNorm | 1 × 512 × 2304 |
| 23 | Attention_4 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 24 | Add_4_attn | Add | 1 × 512 × 2304 |
| 25 | RMSNorm_4_2 | RMSNorm | 1 × 512 × 2304 |
| 26 | MoE_4 | Shared-Expert MoE | 1 × 512 × 2304 |
| 27 | Add_4_ffn | Add | 1 × 512 × 2304 |
| 28 | RMSNorm_5_1 | RMSNorm | 1 × 512 × 2304 |
| 29 | Attention_5 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 30 | Add_5_attn | Add | 1 × 512 × 2304 |
| 31 | RMSNorm_5_2 | RMSNorm | 1 × 512 × 2304 |
| 32 | MoE_5 | Shared-Expert MoE | 1 × 512 × 2304 |
| 33 | Add_5_ffn | Add | 1 × 512 × 2304 |
| 34 | RMSNorm_6_1 | RMSNorm | 1 × 512 × 2304 |
| 35 | Attention_6 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 36 | Add_6_attn | Add | 1 × 512 × 2304 |
| 37 | RMSNorm_6_2 | RMSNorm | 1 × 512 × 2304 |
| 38 | MoE_6 | Shared-Expert MoE | 1 × 512 × 2304 |
| 39 | Add_6_ffn | Add | 1 × 512 × 2304 |
| 40 | RMSNorm_7_1 | RMSNorm | 1 × 512 × 2304 |
| 41 | Attention_7 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 42 | Add_7_attn | Add | 1 × 512 × 2304 |
| 43 | RMSNorm_7_2 | RMSNorm | 1 × 512 × 2304 |
| 44 | MoE_7 | Shared-Expert MoE | 1 × 512 × 2304 |
| 45 | Add_7_ffn | Add | 1 × 512 × 2304 |
| 46 | RMSNorm_8_1 | RMSNorm | 1 × 512 × 2304 |
| 47 | Attention_8 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 48 | Add_8_attn | Add | 1 × 512 × 2304 |
| 49 | RMSNorm_8_2 | RMSNorm | 1 × 512 × 2304 |
| 50 | MoE_8 | Shared-Expert MoE | 1 × 512 × 2304 |
| 51 | Add_8_ffn | Add | 1 × 512 × 2304 |
| 52 | RMSNorm_9_1 | RMSNorm | 1 × 512 × 2304 |
| 53 | Attention_9 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 54 | Add_9_attn | Add | 1 × 512 × 2304 |
| 55 | RMSNorm_9_2 | RMSNorm | 1 × 512 × 2304 |
| 56 | MoE_9 | Shared-Expert MoE | 1 × 512 × 2304 |
| 57 | Add_9_ffn | Add | 1 × 512 × 2304 |
| 58 | RMSNorm_10_1 | RMSNorm | 1 × 512 × 2304 |
| 59 | Attention_10 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 60 | Add_10_attn | Add | 1 × 512 × 2304 |
| 61 | RMSNorm_10_2 | RMSNorm | 1 × 512 × 2304 |
| 62 | MoE_10 | Shared-Expert MoE | 1 × 512 × 2304 |
| 63 | Add_10_ffn | Add | 1 × 512 × 2304 |
| 64 | RMSNorm_11_1 | RMSNorm | 1 × 512 × 2304 |
| 65 | Attention_11 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 66 | Add_11_attn | Add | 1 × 512 × 2304 |
| 67 | RMSNorm_11_2 | RMSNorm | 1 × 512 × 2304 |
| 68 | MoE_11 | Shared-Expert MoE | 1 × 512 × 2304 |
| 69 | Add_11_ffn | Add | 1 × 512 × 2304 |
| 70 | RMSNorm_12_1 | RMSNorm | 1 × 512 × 2304 |
| 71 | Attention_12 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 72 | Add_12_attn | Add | 1 × 512 × 2304 |
| 73 | RMSNorm_12_2 | RMSNorm | 1 × 512 × 2304 |
| 74 | MoE_12 | Shared-Expert MoE | 1 × 512 × 2304 |
| 75 | Add_12_ffn | Add | 1 × 512 × 2304 |
| 76 | RMSNorm_13_1 | RMSNorm | 1 × 512 × 2304 |
| 77 | Attention_13 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 78 | Add_13_attn | Add | 1 × 512 × 2304 |
| 79 | RMSNorm_13_2 | RMSNorm | 1 × 512 × 2304 |
| 80 | MoE_13 | Shared-Expert MoE | 1 × 512 × 2304 |
| 81 | Add_13_ffn | Add | 1 × 512 × 2304 |
| 82 | RMSNorm_14_1 | RMSNorm | 1 × 512 × 2304 |
| 83 | Attention_14 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 84 | Add_14_attn | Add | 1 × 512 × 2304 |
| 85 | RMSNorm_14_2 | RMSNorm | 1 × 512 × 2304 |
| 86 | MoE_14 | Shared-Expert MoE | 1 × 512 × 2304 |
| 87 | Add_14_ffn | Add | 1 × 512 × 2304 |
| 88 | RMSNorm_15_1 | RMSNorm | 1 × 512 × 2304 |
| 89 | Attention_15 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 90 | Add_15_attn | Add | 1 × 512 × 2304 |
| 91 | RMSNorm_15_2 | RMSNorm | 1 × 512 × 2304 |
| 92 | MoE_15 | Shared-Expert MoE | 1 × 512 × 2304 |
| 93 | Add_15_ffn | Add | 1 × 512 × 2304 |
| 94 | RMSNorm_16_1 | RMSNorm | 1 × 512 × 2304 |
| 95 | Attention_16 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 96 | Add_16_attn | Add | 1 × 512 × 2304 |
| 97 | RMSNorm_16_2 | RMSNorm | 1 × 512 × 2304 |
| 98 | MoE_16 | Shared-Expert MoE | 1 × 512 × 2304 |
| 99 | Add_16_ffn | Add | 1 × 512 × 2304 |
| 100 | RMSNorm_17_1 | RMSNorm | 1 × 512 × 2304 |
| 101 | Attention_17 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 102 | Add_17_attn | Add | 1 × 512 × 2304 |
| 103 | RMSNorm_17_2 | RMSNorm | 1 × 512 × 2304 |
| 104 | MoE_17 | Shared-Expert MoE | 1 × 512 × 2304 |
| 105 | Add_17_ffn | Add | 1 × 512 × 2304 |
| 106 | RMSNorm_18_1 | RMSNorm | 1 × 512 × 2304 |
| 107 | Attention_18 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 108 | Add_18_attn | Add | 1 × 512 × 2304 |
| 109 | RMSNorm_18_2 | RMSNorm | 1 × 512 × 2304 |
| 110 | MoE_18 | Shared-Expert MoE | 1 × 512 × 2304 |
| 111 | Add_18_ffn | Add | 1 × 512 × 2304 |
| 112 | RMSNorm_19_1 | RMSNorm | 1 × 512 × 2304 |
| 113 | Attention_19 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 114 | Add_19_attn | Add | 1 × 512 × 2304 |
| 115 | RMSNorm_19_2 | RMSNorm | 1 × 512 × 2304 |
| 116 | MoE_19 | Shared-Expert MoE | 1 × 512 × 2304 |
| 117 | Add_19_ffn | Add | 1 × 512 × 2304 |
| 118 | RMSNorm_20_1 | RMSNorm | 1 × 512 × 2304 |
| 119 | Attention_20 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 120 | Add_20_attn | Add | 1 × 512 × 2304 |
| 121 | RMSNorm_20_2 | RMSNorm | 1 × 512 × 2304 |
| 122 | MoE_20 | Shared-Expert MoE | 1 × 512 × 2304 |
| 123 | Add_20_ffn | Add | 1 × 512 × 2304 |
| 124 | RMSNorm_21_1 | RMSNorm | 1 × 512 × 2304 |
| 125 | Attention_21 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 126 | Add_21_attn | Add | 1 × 512 × 2304 |
| 127 | RMSNorm_21_2 | RMSNorm | 1 × 512 × 2304 |
| 128 | MoE_21 | Shared-Expert MoE | 1 × 512 × 2304 |
| 129 | Add_21_ffn | Add | 1 × 512 × 2304 |
| 130 | RMSNorm_22_1 | RMSNorm | 1 × 512 × 2304 |
| 131 | Attention_22 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 132 | Add_22_attn | Add | 1 × 512 × 2304 |
| 133 | RMSNorm_22_2 | RMSNorm | 1 × 512 × 2304 |
| 134 | MoE_22 | Shared-Expert MoE | 1 × 512 × 2304 |
| 135 | Add_22_ffn | Add | 1 × 512 × 2304 |
| 136 | RMSNorm_23_1 | RMSNorm | 1 × 512 × 2304 |
| 137 | Attention_23 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 138 | Add_23_attn | Add | 1 × 512 × 2304 |
| 139 | RMSNorm_23_2 | RMSNorm | 1 × 512 × 2304 |
| 140 | MoE_23 | Shared-Expert MoE | 1 × 512 × 2304 |
| 141 | Add_23_ffn | Add | 1 × 512 × 2304 |
| 142 | RMSNorm_24_1 | RMSNorm | 1 × 512 × 2304 |
| 143 | Attention_24 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 144 | Add_24_attn | Add | 1 × 512 × 2304 |
| 145 | RMSNorm_24_2 | RMSNorm | 1 × 512 × 2304 |
| 146 | MoE_24 | Shared-Expert MoE | 1 × 512 × 2304 |
| 147 | Add_24_ffn | Add | 1 × 512 × 2304 |
| 148 | RMSNorm_25_1 | RMSNorm | 1 × 512 × 2304 |
| 149 | Attention_25 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 150 | Add_25_attn | Add | 1 × 512 × 2304 |
| 151 | RMSNorm_25_2 | RMSNorm | 1 × 512 × 2304 |
| 152 | MoE_25 | Shared-Expert MoE | 1 × 512 × 2304 |
| 153 | Add_25_ffn | Add | 1 × 512 × 2304 |
| 154 | RMSNorm_26_1 | RMSNorm | 1 × 512 × 2304 |
| 155 | Attention_26 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 156 | Add_26_attn | Add | 1 × 512 × 2304 |
| 157 | RMSNorm_26_2 | RMSNorm | 1 × 512 × 2304 |
| 158 | MoE_26 | Shared-Expert MoE | 1 × 512 × 2304 |
| 159 | Add_26_ffn | Add | 1 × 512 × 2304 |
| 160 | RMSNorm_27_1 | RMSNorm | 1 × 512 × 2304 |
| 161 | Attention_27 | Multi-Head Latent Attention | 1 × 512 × 2304 |
| 162 | Add_27_attn | Add | 1 × 512 × 2304 |
| 163 | RMSNorm_27_2 | RMSNorm | 1 × 512 × 2304 |
| 164 | MoE_27 | Shared-Expert MoE | 1 × 512 × 2304 |
| 165 | Add_27_ffn | Add | 1 × 512 × 2304 |
| 166 | Final_RMSNorm | RMSNorm | 1 × 512 × 2304 |
| 167 | LM_Head | Linear | 1 × 512 × 163840 |
| 168 | Output | Output | 1 × 512 × 163840 |
What the verifier says
deep-attention-default-init
What changed upstream
The change tracker follows moonshotai/Kimi-Linear-48B-A3B-Instruct: every revision it has read, what changed in the config, tokenizer, chat template or weights between them, and an OSV advisory per change.
Do this to your own model
Same numbers, on a model in your repo, in one command. No account.
pip install neurarch-trace
neurarch-trace moonshotai/Kimi-Linear-48B-A3B-Instruct --plan --share