TL;DR
DeepSeek-V3 is a large open language model with 671 billion parameters in total, of which 37 billion are switched on for each token. The authors report that it was pre-trained on 14.8 trillion tokens, then fine-tuned and trained with reinforcement learning, for a total of 2.788 million H800 GPU hours. On standard benchmarks it is reported to beat the other open models they tested and to be comparable with leading closed models on many tasks.
Builds on: KV Cache, Mixed-Precision Training, Load-Balancing Loss · Leads to: DeepSeek-R1 (whose reasoning the authors distil into it)
Why it mattered
The model's checkpoints were released publicly, so other teams could run and study a model at this scale without access to a closed API. Its reported cost drew attention: the authors estimate the official training run at 5.576 million dollars, assuming a rental price of 2 dollars per H800 GPU hour, and they state that this excludes earlier research and ablation runs.
It also showed that a mixture-of-experts design, where most parameters sit idle for any one token, can match dense models that use every parameter. The authors compare it with LLaMA-3.1 405B, a dense model with about 11 times as many activated parameters, and report that DeepSeek-V3 is better on most of the benchmarks they chose.
The problem
A dense language model uses all of its weights for every token, so doubling its size roughly doubles the compute per token. Mixture-of-experts layers break that link: a router sends each token to a few specialised feed-forward networks, the experts, so the total capacity can grow while the work per token stays fixed.
Three problems stand in the way. First, the router can send most tokens to a few favourite experts, which the authors call routing collapse, and leaves the others idle; the usual fix is an auxiliary loss, which can hurt the model. Second, when experts sit on different GPUs, moving tokens between them is expensive. Third, during generation the attention cache for long inputs takes a lot of memory. The paper's aim is efficient inference and cheap training at this scale, with the best possible quality.
How it works
Follow one token through the model, using the paper's design.
- Attention with a small cache. The token's hidden vector is compressed into a latent vector of 512 numbers. Only this latent, plus a 64-number positional key, is stored for later tokens. Check: the full keys and values for 128 heads of 128 numbers each would need far more storage.
- Expert scoring. The token's vector is compared with one centroid vector per routed expert, using a sigmoid, which gives an affinity score for each of the 256 routed experts. Check: each score lies between 0 and 1.
- Choosing experts. Each token is sent to the 8 routed experts with the highest biased scores, and to one shared expert that always runs. Check: 9 expert computations per token, out of 257 expert networks.
- Weighting the outputs. The gate for each chosen expert is its original score divided by the sum of the chosen scores, and the layer output is the token plus the weighted expert outputs. Check: the gates of the chosen experts add up to 1.
- Balancing the load. The bias added in step 3 is not part of the gate. After each step the bias of an overloaded expert goes down by a small amount , and an underloaded expert's goes up. Check: this changes which experts are picked, not how strongly they count.
- Predicting ahead during training. One extra module predicts the token after next and adds its loss to the training objective. At inference the module is dropped. Check: the model still predicts one token at a time.
- Running it across GPUs. The layers are split into pipeline stages, the experts are spread across many GPUs, and matrix multiplications run in FP8 precision, with communication overlapped with computation. Check: the paper reports that no tokens are dropped during training.
flowchart TD A[Token embedding] --> B[Multi-head latent attention, small KV cache] B --> C[Sigmoid affinity to 256 routed experts] C --> D[Pick top 8 by biased score] D --> E[Gate by original scores, add 1 shared expert] E --> F[Layer output to next block] C -. bias update per step .-> D
The toy routing below shows step 3 and step 5 with four experts and K = 2, with made-up numbers. Scores for the token are 0.9, 0.2, 0.7 and 0.5. The bias is for expert 1 and 0 for the rest. Biased scores are 0.6, 0.2, 0.7 and 0.5, so the top two are experts 3 and 1. The gates come from the original scores 0.7 and 0.9, giving for expert 1 and for expert 3. The bias changed who was chosen, but the gate values use the original scores.
The math
Step 1 in symbols: the cache per token
Standard multi-head attention with heads of dimension stores keys and values, which is numbers per layer per token. Under the paper's multi-head latent attention, only of dimension and the decoupled RoPE key of dimension are cached, which is numbers. The ratio is , about one fifty-seventh of the standard cache. This is a count derived from the hyper-parameters in Section 4.2 of the paper, not a figure the paper states.
Step 2 and 4 in symbols: affinities and gates
The affinity is , where is the centroid of expert . Selection uses , and the gate is
The toy example gives equal to 0.9 for expert 1 and 0.7 for expert 3, so the gates are and .
Step 5 in symbols: the bias update
At the end of each step, for each expert , if the expert is overloaded and if underloaded. The paper sets for the first 14.3 trillion tokens and 0 for the rest.
Step 6 in symbols: the prediction loss
Each extra prediction depth has a cross-entropy loss , and the total extra loss is . The paper uses , and the weight is 0.3 for the first 10 trillion tokens and 0.1 afterwards.
Step 7 in symbols: the cost arithmetic
Pre-training costs 2.664 million H800 GPU hours for 14.8 trillion tokens, which is thousand GPU hours per trillion tokens. Adding 119 thousand hours for context extension and 5 thousand for post-training gives hours. At 2 dollars per hour the total is million dollars.
Worked examples
Setup: four routed experts, , scores 0.9, 0.2, 0.7, 0.5 and biases 0, 0, 0, 0.
- Biased scores equal the scores, so the top two are experts 1 (0.9) and 3 (0.7).
- Gates: the sum of the two scores is .
- Gate for expert 1: . Gate for expert 3: .
- The gates add to 1, as expected.
Interpretation: with no bias, the two highest-scoring experts share the work in proportion to their scores.
Setup: the hyper-parameters in Section 4.2 of the paper, with 61 layers.
- Standard cache per token per layer: numbers.
- Latent cache per token per layer: numbers.
- Ratio: .
- Over 61 layers, the standard cache is numbers per token, and the latent cache is numbers per token.
- Interpretation: the latent cache is about 57 times smaller, so a long conversation fits in much less memory.
Note that this count ignores the precision of each number and the extra projection cost, so it is a storage comparison, not a total memory figure.
Setup: a team wants to estimate the pre-training cost of a run on 4 trillion tokens, using the paper's rate of 180 thousand H800 GPU hours per trillion tokens and a rental price of 2 dollars per hour.
- GPU hours: .
- Cost: dollars.
- Time on the paper's cluster of 2048 GPUs: hours, about 14.7 days.
- Check against the paper: 14.8 trillion tokens took less than two months and 2.664 million hours, so 4 trillion tokens at the same rate is about a quarter of that.
Interpretation: the rate turns token counts into hours and dollars, but it assumes the same cluster, efficiency and rental price. It does not include the earlier research and ablation runs the authors exclude.
Try it: a run uses 10 trillion tokens at the same rate and price. How many dollars is the pre-training cost?
Answer: hours, and dollars, or 3.6 million dollars.
Results
The paper reports two kinds of results. Base-model results (Table 3) compare pre-trained models under the authors' internal evaluation setup. Chat results (Table 6) compare the fine-tuned model, with output length capped at 8K tokens.
| Benchmark (metric) | DeepSeek-V2 base | Qwen2.5 72B base | LLaMA-3.1 405B base | DeepSeek-V3 base |
|---|---|---|---|---|
| MMLU (5-shot, EM) | 78.4 | 85.0 | 84.4 | 87.1 |
| MMLU-Pro (5-shot, EM) | 51.4 | 58.3 | 52.8 | 64.4 |
| MATH (4-shot, EM) | 43.4 | 54.4 | 49.0 | 61.6 |
| HumanEval (0-shot, Pass@1) | 43.3 | 53.0 | 54.9 | 65.2 |
| Benchmark (metric) | GPT-4o 0513 | Claude-3.5-Sonnet-1022 | DeepSeek-V3 chat |
|---|---|---|---|
| MMLU (EM) | 87.2 | 88.3 | 88.5 |
| MMLU-Pro (EM) | 72.6 | 78.0 | 75.9 |
| GPQA-Diamond (Pass@1) | 49.9 | 65.0 | 59.1 |
| MATH-500 (EM) | 74.6 | 78.3 | 90.2 |
| SWE-bench Verified (resolved) | 38.8 | 50.8 | 42.0 |
The numbers are copied from the paper's tables. The chat comparison is not uniform: the Claude-3.5-Sonnet column is higher on MMLU-Pro, GPQA-Diamond and SWE-bench Verified. On the ablations, the multi-token objective helps the small model on most benchmarks (MMLU 50.0 to 53.3 for the 15.7B-parameter model), but on the large 228.7B-parameter model MMLU drops slightly (67.5 to 66.6) while HumanEval rises (44.5 to 53.7). The auxiliary-loss-free balancing shows the same mixed pattern: MMLU for the large model goes from 68.3 to 67.2, while HumanEval goes from 40.2 to 46.3.
The paper's limits are its own: most evaluations come from an internal framework, the recommended deployment unit is large, and the authors note the risk of tuning to a fixed set of benchmarks.
Reading guide
- Abstract and Section 1 give the headline numbers and the cost table. Read them first; they need no prerequisites beyond the TL;DR.
- Section 2.1.1 (multi-head latent attention) needs Multi-Head Attention, KV Cache and Rotary Position Embedding. The matrices with superscripts , and are down- and up-projections; Low-Rank Matrix explains why compressing to a small latent works.
- Section 2.1.2 (DeepSeekMoE and load balancing) needs Mixture of Experts and Load-Balancing Loss. The predecessor design is DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts....
- Section 2.2 (multi-token prediction) needs Transformer. The inference use for the extra modules is related to Speculative Decoding.
- Section 3 (infrastructure and FP8 training) needs Mixed-Precision Training and Floating-Point Numbers. Parallelism terms in Section 3.2 are covered in Model Parallelism.
- Section 4 (pre-training and evaluation) needs no new idea beyond the earlier sections; the tables are the results.
- Section 5 (post-training) needs Reinforcement Learning, Group Relative Policy Optimization (GRPO) and Knowledge Distillation, since the reasoning style is distilled from DeepSeek-R1.
Check yourself
QuestionWhy does a mixture-of-experts model with 671 billion parameters use only 37 billion for each token?Show answer
The router sends each token to a small subset of experts, here 8 of 256 routed experts plus one shared expert. The other expert weights are not used for that token, so the compute per token depends on the activated parameters, not the total.
QuestionUsing the paper's Section 4.2 settings, how many numbers per layer per token does the latent cache store, and how many would standard multi-head attention store?Show answer
The latent cache stores numbers. Standard multi-head attention stores numbers. The latent cache is about 1/57 of the standard size.
QuestionThe paper's pre-training used 2.664 million H800 GPU hours and the authors assume 2 dollars per hour. What is the pre-training cost they state?Show answer
million dollars. The paper's Table 1 gives this figure as $5.328M.
QuestionIn the bias-based balancing, a bias changes which experts are chosen. Why does it not change how much each chosen expert contributes?Show answer
The bias is added to the score only when choosing the top-K experts. The gate value comes from the original affinity score, normalised over the chosen experts. Balancing therefore changes the routing decision without distorting the weight that each expert's output receives.