DeepSeek-V3 is a 671B-parameter Mixture-of-Experts (MoE) model released in December 2024. Only 37B parameters are active for any one token. What makes the report important is less the performance than the cost structure. The whole training run, including 14.8T tokens of pre-training, took 2.788M H800 GPU hours (report Table 1), and DeepSeek’s later R1, V3.2 and V4 are all built on this model’s architecture and training recipe. This lesson is therefore the reference point for reading the whole DeepSeek line.
The report’s contributions fall into four pieces. (1) It keeps MLA and DeepSeekMoE, validated in V2; it adds (2) an auxiliary-loss-free scheme that balances MoE load with a bias instead of an auxiliary loss, and (3) a sequential multi-token prediction (MTP) objective; and (4) it trains all of this cheaply with FP8 mixed precision and communication overlap (DualPipe). Post-training distils the reasoning ability of R1-series models.
At a glance
| Item | DeepSeek-V3 |
|---|---|
| Developer | DeepSeek-AI |
| Release | 2024-12 (arXiv v1 2024-12-27, v2 2025-02-18) |
| Size | 671B total, 37B active per token (excluding the MTP module) |
| Architecture | 61-layer Transformer, MLA attention, dense FFN in the first 3 layers + MoE in the rest (1 shared + 256 routed, top-8) |
| Context length | 4K in pre-training → 32K with YaRN → 128K |
| Pre-training tokens | 14.8T |
| Precision | FP8 mixed precision (GEMMs in FP8, sensitive operations in BF16/FP32) |
| Training cost | 2.788M H800 GPU hours (pre-training 2,664K + context extension 119K + post-training 5K); 2 per GPU hour (Table 1) |
| Post-training | SFT on 1.5M samples (reasoning data generated by R1-series experts) → GRPO-based RL |
| Weights | Open (github.com/deepseek-ai/DeepSeek-V3) |
What is new.
- Aux-loss-free load balancing. Each expert gets a bias that is added only for the top-K selection. Gating values are computed from the original affinity, so the balancing device never touches the model’s output directly.
- Sequential MTP. The depth- module takes the previous depth’s representation and the embedding of the ground-truth token and predicts . It densifies the training signal; at inference it is either discarded or used as a draft for speculative decoding.
- Fine-grained FP8 training. A scale per 1×128 tile for activations and per 128×128 block for weights, E4M3 for every tensor, and promotion to FP32 every 128 elements to make up for the limited accumulation precision of the Tensor Cores. The report claims the first validation of FP8 training at this scale.
- Stability. It reports no irrecoverable loss spikes and no rollbacks over the whole training run.
- R1 distillation. A pipeline that carries the verification and reflection patterns of a long-CoT model over to a general model while keeping output length and format under control.
Architecture
The V3 block is a standard pre-norm Transformer. The difference is that MLA (Multi-head Latent Attention) sits in the attention slot and DeepSeekMoE in the FFN slot. The configuration is 61 layers, hidden size , attention heads, head dimension , and every FFN except those of the first 3 layers is an MoE (§4.2).
→ Go deeper: The DeepSeek lineage — how MLA, DeepSeekMoE and MTP change from V2 through V3.2 and V4.
MLA: K and V in one low-dimensional latent
As we saw in the inference optimisation lesson, the bottleneck of the decode phase is the KV cache. Standard multi-head attention (MHA) leaves numbers per token per layer. With the V3 configuration that is . GQA and MQA reduce this by having several query heads share a K/V head. MLA takes another route. It jointly compresses K and V into a low-dimensional latent, caches only that, and reconstructs the per-head K/V with an up-projection when needed.
is the KV compression dimension, 512 in V3 (much smaller than ). With only this, the cache would be numbers. The problem is position information.
Why decouple RoPE. To actually cash in on the compression, must not be reconstructed during decoding. Without RoPE, the attention logit of head is
so can be absorbed into the query side and the latent used directly in the dot product. In the same way is absorbed into the output projection . But apply RoPE to the key and a rotation , which depends on the query position and the key position , gets wedged between and :
The matrix differs for every key position, so it cannot be absorbed once and for all. MLA therefore carries the position information in a separate small key .
is shared by all heads (), while the query side exists per head. The logit becomes the sum of the two parts, , divided by (report Eq. 10). The only things to cache are and , marked with blue boxes in report Eqs. 1 and 3. That is numbers per token per layer, about 1/57 of MHA. The query is also compressed to a low dimension, , but that is not for the cache: it reduces activation memory during training.
DeepSeek-V3는 2024년 12월에 공개된 671B 파라미터 Mixture-of-Experts(MoE) 모델이다. 토큰 하나를 처리할 때는 37B만 활성화된다. 이 보고서가 중요한 이유는 성능보다 비용 구조에 있다. 사전학습 14.8T 토큰을 포함한 전체 학습이 H800 GPU 2.788M 시간(보고서 Table 1)이었고, 이후 DeepSeek의 R1, V3.2, V4가 모두 이 모델의 아키텍처와 학습 레시피 위에 올라간다. 즉 이 레슨은 DeepSeek 계열 전체를 읽기 위한 기준점이다.
보고서의 기여는 네 덩어리로 나뉜다. (1) V2에서 검증한 MLA와 DeepSeekMoE를 그대로 쓰고, (2) MoE 부하 균형을 보조 손실 없이 bias로 맞추는 auxiliary-loss-free 방식과 (3) 순차형 multi-token prediction(MTP) 목적함수를 새로 넣었으며, (4) 이것을 FP8 혼합 정밀도와 통신 겹치기(DualPipe)로 싸게 학습했다. 사후학습에서는 R1 계열 모델의 추론 능력을 증류했다.
한눈에
| 항목 | DeepSeek-V3 |
|---|---|
| 개발 | DeepSeek-AI |
| 공개 | 2024-12 (arXiv v1 2024-12-27, v2 2025-02-18) |
| 크기 | 총 671B, 토큰당 활성 37B (MTP 모듈 제외) |
| 구조 | 61층 Transformer, MLA attention, 처음 3층 dense FFN + 나머지 MoE (shared 1 + routed 256, top-8) |
| 문맥 길이 | 사전학습 4K → YaRN으로 32K → 128K |
| 사전학습 토큰 | 14.8T |
| 정밀도 | FP8 혼합 정밀도 (GEMM은 FP8, 민감한 연산은 BF16/FP32) |
| 학습 비용 | 2.788M H800 GPU 시간 (사전학습 2,664K + 문맥 확장 119K + 사후학습 5K), GPU 시간당 5.576M (Table 1) |
| 사후학습 | SFT 1.5M 샘플 (추론 데이터는 R1 계열 expert에서 생성) → GRPO 기반 RL |
| 가중치 | 공개 (github.com/deepseek-ai/DeepSeek-V3) |
무엇이 새로운가.
- aux-loss-free 부하 균형. expert마다 bias 를 두고 top-K 선택에만 더한다. gating 값은 원래 affinity로 계산하므로 균형 장치가 모델의 출력을 직접 건드리지 않는다.
- 순차형 MTP. 깊이 의 모듈이 이전 깊이의 표현과 정답 토큰 의 embedding을 받아 을 예측한다. 학습 신호를 촘촘하게 만들고, 추론 때는 버리거나 speculative decoding의 draft로 쓴다.
- 세분화 FP8 학습. activation은 1×128 tile, weight는 128×128 block마다 scale을 두고, 모든 텐서에 E4M3를 쓰며, Tensor Core의 제한된 누산 정밀도를 128개 원소마다 FP32로 승격해 보완한다. 이 규모에서 FP8 학습을 처음 검증했다고 주장한다.
- 안정성. 전체 학습 동안 복구 불가능한 loss spike나 rollback이 없었다고 보고한다.
- R1 증류. long-CoT 모델의 검증·반성 패턴을 일반 모델에 옮기면서 출력 길이와 형식은 통제하는 파이프라인.
아키텍처
V3의 블록은 표준 pre-norm Transformer다. 다른 점은 attention 자리에 MLA(Multi-head Latent Attention), FFN 자리에 DeepSeekMoE가 들어간다는 것이다. 설정은 61층, hidden , attention head , head 차원 이고, 처음 3층을 뺀 모든 FFN이 MoE다(§4.2).
→ 더 깊이: DeepSeek 계보 — MLA·DeepSeekMoE·MTP가 V2에서 V3.2, V4로 가며 어떻게 바뀌는지.
MLA: KV를 저차원 latent 하나로
추론 최적화 레슨에서 본 것처럼 decode 단계의 병목은 KV cache다. 표준 multi-head attention(MHA)은 토큰 하나, 층 하나마다 개의 숫자를 남긴다. V3 설정이면 개다. GQA·MQA는 여러 query head가 K/V head를 공유해서 이것을 줄인다. MLA는 다른 길을 간다. K와 V를 공동으로 저차원 latent에 압축해 그것만 캐시하고, head마다 다른 K/V는 필요할 때 up-projection으로 복원한다.
는 KV 압축 차원이고 V3에서 512다(보다 훨씬 작다). 여기까지만 있으면 캐시는 개다. 문제는 위치 정보다.
왜 RoPE를 분리하는가. 압축의 이득을 실제로 얻으려면 decode 때 를 복원하지 않아야 한다. RoPE가 없다면 head 의 attention logit은
이므로 를 query 쪽으로 **흡수(absorb)**해서 latent 와 바로 내적하면 된다. 같은 방식으로 는 출력 projection 에 흡수된다. 그런데 key에 RoPE를 걸면 query 위치 와 key 위치 에 따라 달라지는 회전 가 와 사이에 끼어
가 된다. 행렬이 키 위치마다 달라서 한 번에 흡수할 수 없다. 그래서 MLA는 위치 정보를 별도의 작은 key 에 싣는다.
는 모든 head가 공유하고(), query 쪽 는 head마다 있다. logit은 두 부분의 합 이 되고 로 나눈다(보고서 식 10). 캐시해야 하는 것은 보고서 식 1·3에서 파란 상자로 표시한 와 뿐이다. 토큰·층당 개, MHA의 약 1/57이다. query도 차원으로 저차원 압축하는데, 이것은 캐시가 아니라 학습 때 activation 메모리를 줄이기 위해서다.
Matching the same 576 numbers with GQA would require KV heads. Shrinking the groups that far in GQA makes the K/V of almost all heads the same, whereas in MLA every head has its own . The key point is that the compression is a rank constraint, not sharing between heads. The report only says that this cache keeps performance close to MHA (§2.1.1); the direct comparison with MHA and GQA is in the V2 report.
import numpy as np
rs = np.random.default_rng(0)
d, nh, dh, dc, dR, T = 64, 4, 16, 8, 8, 10 # a small MLA (V3: 7168, 128, 128, 512, 64)
W_DKV = rs.standard_normal((dc, d)) / np.sqrt(d)
W_UK = rs.standard_normal((nh * dh, dc)) / np.sqrt(dc)
W_KR = rs.standard_normal((dR, d)) / np.sqrt(d)
W_Q = rs.standard_normal((nh * dh, d)) / np.sqrt(d) # (query compression omitted)
W_QR = rs.standard_normal((nh * dR, d)) / np.sqrt(d)
def rope(x, pos): # rotate even/odd pairs of the last axis
half = x.shape[-1] // 2
ang = pos / (10000 ** (np.arange(half) / half))
x1, x2 = x[..., 0::2], x[..., 1::2]
out = np.empty_like(x)
out[..., 0::2] = x1 * np.cos(ang) - x2 * np.sin(ang)
out[..., 1::2] = x1 * np.sin(ang) + x2 * np.cos(ang)
return out
H = rs.standard_normal((T, d))
# cache: per token only c^KV (dc numbers) and the head-shared k^R (dR numbers)
c_kv = H @ W_DKV.T # (T, dc)
k_R = np.stack([rope(W_KR @ H[j], j) for j in range(T)]) # (T, dR)
t = T - 1 # the last token is the query
q_C = (W_Q @ H[t]).reshape(nh, dh)
q_R = rope((W_QR @ H[t]).reshape(nh, dR), t)
# (1) naive: reconstruct per-head k^C from the cache
k_C = (c_kv @ W_UK.T).reshape(T, nh, dh)
naive = np.einsum('hd,jhd->hj', q_C, k_C) + q_R @ k_R.T # (nh, T) attention logits
# (2) absorb: pull q^C through W^UK and dot with the latent directly (no k^C at decode time)
W_UK_h = W_UK.reshape(nh, dh, dc)
q_lat = np.einsum('hd,hdc->hc', q_C, W_UK_h) # (nh, dc), once per query
absorbed = q_lat @ c_kv.T + q_R @ k_R.T
print("max logit difference before/after absorb:", np.abs(naive - absorbed).max())
# (3) had RoPE been applied to the compressed key: R_(j-t) gets in and the matrix differs per position
k_C_rot = np.stack([rope(k_C[j], j) for j in range(T)])
q_rot = rope(q_C, t)
target = np.einsum('hd,jhd->hj', q_rot, k_C_rot)
try_absorb = np.einsum('hd,hdc->hc', q_rot, W_UK_h) @ c_kv.T
print("error of absorbing with RoPE on k^C:", np.abs(target - try_absorb).max().round(3), "→ cannot absorb, hence a separate k^R")
print(f"cache entries per token per layer: MHA {2*nh*dh}, MLA {dc+dR} (V3 config: {2*128*128} vs {512+64})")DeepSeekMoE: fine-grained experts + a shared expert
The FFN output is the sum of shared experts and experts chosen from routed experts (report Eqs. 12–15).
Two design choices make this different from a GShard-style MoE in place of the FFN of the Transformer block. Fine-grained: each expert has a small intermediate dimension (2048) and there are many of them (8 of 256 active), which increases the number of combinations. Shared expert: one expert that every token always passes through takes on common knowledge, so the routed experts do not each learn the same content redundantly. Unlike V2, the affinity is computed with a sigmoid rather than a softmax, and normalisation happens only among the selected experts.
To bound communication cost it also uses node-limited routing. Nodes are chosen by the sum of the top affinities of the experts on each node, so that a token goes to at most nodes. Because the load is well balanced, neither training nor inference drops tokens (no token dropping). The load-balancing method gets a deep look in the core-method section below.
→ Go deeper: Anatomy of MoE — routing, fine-grained and shared experts, and load balancing (including the aux-loss-free bias below) compared across models.
Multi-token prediction
MTP is an auxiliary objective that makes each position predict several tokens instead of only the next one. Instead of the independent parallel heads of Gloeckle et al. (2024), V3 uses sequential modules. The depth- module consists of the shared embedding, the shared output head, a Transformer block and a projection (Eqs. 21–23).
is the output of the main model. The depth- loss is , and the total loss is (Eqs. 24–25). V3 uses , with = 0.3 for the first 10T tokens and 0.1 for the remaining 4.8T.
→ Go deeper: Both ends of the model for MTP variants across labs, and Speculative decoding in depth for how an MTP head becomes a draft at inference and what its acceptance rate buys.
같은 576개를 GQA로 맞추면 KV head가 개여야 한다. GQA에서 그룹을 그렇게 줄이면 head 사이의 K/V가 거의 다 같아지지만, MLA는 head마다 서로 다른 를 가진다. 압축이 head 사이의 공유가 아니라 rank 제약이라는 점이 핵심이다. 보고서는 이 캐시로 MHA와 비슷한 성능을 유지한다고만 적고(§2.1.1), MHA·GQA와의 직접 비교는 V2 보고서에 있다.
import numpy as np
rs = np.random.default_rng(0)
d, nh, dh, dc, dR, T = 64, 4, 16, 8, 8, 10 # 작은 MLA (V3: 7168, 128, 128, 512, 64)
W_DKV = rs.standard_normal((dc, d)) / np.sqrt(d)
W_UK = rs.standard_normal((nh * dh, dc)) / np.sqrt(dc)
W_KR = rs.standard_normal((dR, d)) / np.sqrt(d)
W_Q = rs.standard_normal((nh * dh, d)) / np.sqrt(d) # (query 압축은 생략)
W_QR = rs.standard_normal((nh * dR, d)) / np.sqrt(d)
def rope(x, pos): # 마지막 축의 짝수/홀수 쌍을 회전
half = x.shape[-1] // 2
ang = pos / (10000 ** (np.arange(half) / half))
x1, x2 = x[..., 0::2], x[..., 1::2]
out = np.empty_like(x)
out[..., 0::2] = x1 * np.cos(ang) - x2 * np.sin(ang)
out[..., 1::2] = x1 * np.sin(ang) + x2 * np.cos(ang)
return out
H = rs.standard_normal((T, d))
# 캐시: 토큰마다 c^KV (dc개)와 head 공유 k^R (dR개)만
c_kv = H @ W_DKV.T # (T, dc)
k_R = np.stack([rope(W_KR @ H[j], j) for j in range(T)]) # (T, dR)
t = T - 1 # 마지막 토큰이 query
q_C = (W_Q @ H[t]).reshape(nh, dh)
q_R = rope((W_QR @ H[t]).reshape(nh, dR), t)
# (1) 순진한 방법: 캐시에서 head별 k^C를 복원
k_C = (c_kv @ W_UK.T).reshape(T, nh, dh)
naive = np.einsum('hd,jhd->hj', q_C, k_C) + q_R @ k_R.T # (nh, T) attention logit
# (2) absorb: q^C를 W^UK로 당겨 latent에서 바로 내적 (decode 때 k^C를 만들지 않는다)
W_UK_h = W_UK.reshape(nh, dh, dc)
q_lat = np.einsum('hd,hdc->hc', q_C, W_UK_h) # (nh, dc), query당 한 번
absorbed = q_lat @ c_kv.T + q_R @ k_R.T
print("absorb 전후 logit 최대 차이:", np.abs(naive - absorbed).max())
# (3) RoPE를 압축 key에 직접 걸었다면: R_(j-t)가 끼어 위치마다 행렬이 달라진다
k_C_rot = np.stack([rope(k_C[j], j) for j in range(T)])
q_rot = rope(q_C, t)
target = np.einsum('hd,jhd->hj', q_rot, k_C_rot)
try_absorb = np.einsum('hd,hdc->hc', q_rot, W_UK_h) @ c_kv.T
print("RoPE를 k^C에 걸고 absorb하면 오차:", np.abs(target - try_absorb).max().round(3), "→ 흡수 불가, 그래서 k^R을 따로 둔다")
print(f"토큰·층당 캐시 원소: MHA {2*nh*dh}, MLA {dc+dR} (V3 설정: {2*128*128} vs {512+64})")DeepSeekMoE: 세분화 expert + shared expert
FFN 출력은 shared expert 개와 routed expert 개 가운데 고른 개의 합이다(보고서 식 12–15).
두 가지 설계가 Transformer 블록의 FFN을 GShard식 MoE와 다르게 만든다. Fine-grained: expert 하나의 중간 차원을 작게(2048) 하고 개수를 늘려(256개 중 8개 활성) 조합의 수를 키운다. Shared expert: 모든 토큰이 반드시 거치는 expert 1개가 공통 지식을 맡아, routed expert들이 같은 내용을 중복해서 배우지 않게 한다. V2와 달리 affinity를 softmax가 아니라 sigmoid로 계산하고, 선택된 것끼리만 정규화한다.
통신 비용을 묶기 위해 node-limited routing도 쓴다. 각 노드에 있는 expert들의 affinity 상위 개 합으로 노드를 골라, 토큰 하나가 최대 개 노드에만 가게 한다. 부하 균형이 잘 맞아서 학습과 추론 모두 토큰을 버리지 않는다(no token dropping). 부하 균형 방법은 아래 핵심 method 절에서 깊게 본다.
→ 더 깊이: MoE 해부 — routing, 세분화·shared expert, 부하 균형(아래의 aux-loss-free bias 포함)을 여러 모델에 걸쳐 비교한다.
Multi-token prediction
MTP는 각 위치에서 다음 토큰 하나가 아니라 여러 개를 맞히게 하는 보조 목적함수다. V3는 Gloeckle et al.(2024)의 독립 병렬 head 대신 순차 모듈 개를 쓴다. 깊이 의 모듈은 공유 embedding, 공유 출력 head, Transformer 블록 , projection 로 이루어진다(식 21–23).
은 본 모델의 출력이다. 깊이 의 손실은 이고, 전체 손실은 다(식 24–25). V3는 이고 는 처음 10T 토큰 동안 0.3, 남은 4.8T 동안 0.1이다.
→ 더 깊이: 다른 lab의 MTP 변형은 모델의 양 끝에서, MTP head를 추론 때 draft로 쓰는 방법과 수락률이 주는 속도는 Speculative decoding 심화에서 다룬다.
The depth- module receives the ground truth as input (teacher forcing). So the prediction at every depth keeps a complete causal chain, and the gradient flows so that the main model’s representation holds information that is “useful two steps ahead”. The report gives two motivations. A denser training signal may improve data efficiency, and the model can pre-plan its representations for future tokens. At inference the MTP module can be discarded and the main model runs on its own, so there is no added cost. Keep it instead, and it becomes the draft for self-speculative decoding. The report gives an acceptance rate of 85–90% for the second token depending on the topic, and 1.8× TPS (§5.4.3). The in the figure above is exactly that upper bound. It also describes placing the MTP module, the embedding and the output head on the same pipeline rank so that parameters and gradients are physically shared (§3.2.3).
Data
The description of the data is short. What is disclosed is mostly how it was processed; there are no mixture ratios.
| Item | What the report says (§4.1, §5.1) |
|---|---|
| Scale | 14.8T tokens (counted with the V3 tokenizer) |
| Mixture changes | More mathematics and programming than V2, wider multilingual coverage beyond English and Chinese. Ratios not disclosed |
| Cleaning | Pipeline improved to reduce redundancy while keeping diversity (details not disclosed) |
| packing | Document packing of Ding et al. (2024), but without a cross-sample attention mask |
| FIM | Prefix-Suffix-Middle format, at document level, rate 0.1 (following DeepSeekCoder-V2) |
| tokenizer | byte-level BPE, 128K vocabulary. Adds new tokens that combine punctuation and line breaks, and randomly splits some of them during training to reduce the resulting token-boundary bias |
| Long-context data | Composition of the data for the YaRN extension stage not disclosed |
| SFT data | 1.5M instances across several domains |
| SFT reasoning data | Mathematics, coding contests, logic puzzles. Generated with the internal R1 model, but rejection-sampled through per-domain expert models (SFT+RL) |
| SFT non-reasoning data | Creative writing, role-play, simple QA. Generated with DeepSeek-V2.5, then checked by humans |
The process for building the reasoning data is interesting. Answers from R1 are accurate but overthink, are poorly formatted, and are long. So one expert is trained per domain, and for each problem two kinds of SFT samples are made: <problem, original answer> and <system prompt that induces reflection and verification, problem, R1 answer>. RL on this expert at a high temperature makes it produce answers that mix both styles even without the system prompt, and rejection sampling from the expert after a few hundred steps gives the final SFT data. The design aims to take the accuracy of long CoT while controlling its length.
Training
Pre-training recipe (§4.2)
| Item | Value |
|---|---|
| optimizer | AdamW, , weight decay 0.1, gradient clip 1.0 |
| Initialisation | standard deviation 0.006 for all parameters |
| Sequence length | 4K |
| Learning rate | linear warmup 0→2.2e-4 over 2K steps → held at 2.2e-4 until 10T tokens → cosine to 2.2e-5 over 4.3T tokens → of the last 500B, 333B at 2.2e-5 and 167B at 7.3e-6 |
| batch | increased from 3,072 to 15,360 sequences over the first 469B tokens, then held |
| Parallelism | pipeline parallel + routed experts of each layer spread evenly over 64 GPUs on 8 nodes (no tensor parallel) |
| Load balancing | bias speed (first 14.3T), for the last 500B; auxiliary sequence-wise loss |
| MTP | , (first 10T) → 0.1 |
| Cluster | 2,048 H800s. 180K GPU hours per 1T tokens (about 3.7 days) |
Context extension (§4.3). After pre-training, YaRN is applied only to the decoupled key and the context is extended in two stages (1,000 steps each). Stage 1 is 32K with batch 1,920, stage 2 is 128K with batch 480; both use learning rate 7.3e-6 and YaRN with and scaling . Because in MLA RoPE lives only on the small shared key, positional interpolation only has to be applied to those 64 dimensions.
FP8 mixed precision (§3.3)
All three GEMMs of a linear layer (forward, activation gradient, weight gradient) run in FP8. In theory this doubles compute speed over BF16, and with the weight-gradient GEMM in FP8 the activations kept for backward can also be stored in FP8. On the other hand, the embedding, output head, MoE gating, normalisation and attention stay in their original precision (BF16/FP32), as do the master weights, weight gradients and optimiser states (AdamW’s first and second moments in BF16, master weights and gradients in FP32).
FP8’s problem is dynamic range. The largest E4M3 value is 448 and the mantissa has 3 bits. With per-tensor scaling, which maps the tensor-wide maximum to 448, a single outlier sets the scale and pushes the remaining small values into subnormals or zero. V3 splits the scale finely.
- activation: one scale per 1×128 tile, 128 channels of one token
- weight: one scale per 128×128 block, 128 inputs × 128 outputs
- E4M3 for every tensor (the usual practice is E4M3 forward, E5M2 backward). Since small groups effectively share exponent bits, it can opt for mantissa precision.
- scales are computed on the fly from the current tile’s maximum, not from past iterations (online quantization)
The other issue is accumulation precision. The report says FP8 GEMM accumulation on the H800 keeps only about 14 bits, and that a random matrix product with showed a maximum relative error of nearly 2%. So every time the Tensor Cores have accumulated elements (4 WGMMAs), the partial sum is moved to FP32 registers on the CUDA cores and added there, with the per-tile scales multiplied in at that point. In a validation experiment at about 1T tokens, the relative loss error against BF16 was under 0.25%.
import numpy as np
def to_e4m3(x):
"""Mimic FP8 E4M3 rounding: max 448, 3 mantissa bits, min normal 2^-6, subnormal spacing 2^-9."""
x = np.clip(x, -448.0, 448.0)
a = np.abs(x)
e = np.floor(np.log2(np.maximum(a, 2.0 ** -6))) # subnormal range fixed at exponent -6
step = 2.0 ** (e - 3) # 8 steps per octave
return np.sign(x) * np.round(a / step) * step
def quant(x, block):
"""One scale per block=(br, bc) mapping amax to 448 → E4M3 → restore (dequant)."""
br, bc = block
R, Cc = x.shape
xb = x.reshape(R // br, br, Cc // bc, bc)
scale = 448.0 / np.maximum(np.abs(xb).max(axis=(1, 3), keepdims=True), 1e-12)
return (to_e4m3(xb * scale) / scale).reshape(R, Cc)
rs = np.random.default_rng(0)
M, K, N = 64, 4096, 256
base = rs.standard_normal((M, K)) # activation (token × channel)
W = rs.standard_normal((K, N)) * 0.02 # weight (in × out)
hot = rs.choice(K, 8, replace=False) # 8 outlier channels
print("outlier gain | share of normal entries → 0 | mean rel. error of normal entries")
print(" | per-tensor 1x128 tile | per-tensor 1x128 tile")
for f in [10, 100, 1000, 10000]:
X = base.copy(); X[:, hot] *= f
normal = np.ones(K, bool); normal[hot] = False
row = []
for blk in [(M, K), (1, 128)]:
Xq = quant(X, blk)[:, normal]; Xn = X[:, normal]
row.append((np.mean((Xq == 0) & (Xn != 0)), np.mean(np.abs(Xq - Xn)) / np.mean(np.abs(Xn))))
print(f"{f:>12} | {row[0][0]:8.4f} {row[1][0]:8.4f} | {row[0][1]:8.4f} {row[1][1]:8.4f}")
X = base.copy(); X[:, hot] *= 1000
ref = X @ W
for name, bx, bw in [("per-tensor X, per-tensor W", (M, K), (K, N)),
("V3: X 1x128 tile, W 128x128 block", (1, 128), (128, 128))]:
Y = quant(X, bx) @ quant(W, bw)
print(f"{name:34s} GEMM relative error {np.linalg.norm(Y - ref) / np.linalg.norm(ref):.4f}")
# accumulation precision: assume the accumulator keeps only ~14 bits, promote to FP32 every N_C=128
def acc_limited(a, b, bits=14, promote=None):
def rnd(v):
m, ex = np.frexp(v)
return np.ldexp(np.round(m * 2 ** bits) / 2 ** bits, ex)
out = np.zeros(a.shape[0]); part = np.zeros(a.shape[0])
for k in range(a.shape[1]):
part = rnd(part + a[:, k] * b[k])
if promote and (k + 1) % promote == 0:
out += part; part[:] = 0
return out + part
a = np.abs(rs.standard_normal((128, 4096))); b = np.abs(rs.standard_normal(4096))
exact = a @ b
for name, pr in [("14-bit accumulation only", None), ("FP32 promotion every N_C=128", 128)]:
r = np.abs(acc_limited(a, b, promote=pr) - exact) / exact
print(f"K=4096 dot product, {name:28s}: max relative error {r.max():.1e}")The larger the outlier, the larger the share of normal-sized entries that vanish to zero and the error under per-tensor scaling, while the 1×128 tile is barely affected. The accumulation experiment imitates “14-bit accumulation” by mantissa rounding, so it does not reproduce the report’s 2%, but the direction is the same: moving to FP32 every 128 elements cuts the error by two orders of magnitude.
Infrastructure in one paragraph
DualPipe is a schedule that splits forward/backward chunks into attention, all-to-all dispatch, MLP and combine so that computation and communication overlap, and feeds micro-batches from both directions to shrink the pipeline bubble. The cross-node all-to-all kernels are written to use IB and NVLink bandwidth together, and memory is saved by recomputing RMSNorm and the MLA up-projection, keeping the EMA on the CPU, and sharing the embedding and head between MTP and the main model, so training runs without tensor parallelism (§3.2). It is outside the scope of this lesson, but hiding the all-to-all cost of a fine-grained MoE almost entirely at the scale of 2,048 GPUs is a large part of the cost figure.
→ Go deeper: Parallelism for serving, and MoE — why V3 is served with wide expert parallelism and prefill/decode disaggregation, worked out in bytes per token.
Post-training (§5)
SFT. V3-Base is trained for 2 epochs on the 1.5M data above. The learning rate decays by cosine from 5e-6 to 1e-6, and several samples are packed into one sequence with sample masking so they cannot see each other.
Rewards. Questions that can be checked by rules (a final answer in a box, LeetCode tests) get a rule-based RM; questions with a free-form ground truth, or creative questions with no ground truth, get a model-based RM trained from the V3 SFT checkpoint. The preference data include not just the final score but the chain-of-thought leading to it, which is said to reduce reward hacking. In general domains, constitutional-AI-style self-rewarding, using V3’s own voting evaluations as feedback, was also used (§5.4.2).
RL. The same GRPO (DeepSeekMath) as V2. In this site’s notation (report Eqs. 26–28),
with the k3 estimator for the KL. The report writes the ratio per response, but implementations usually expand it per token. That difference and the length-normalisation issue are covered in the RLVR and GRPO lesson. The RL prompts mix coding, mathematics, writing, role-play and QA, and the detailed hyperparameters (, , ) are not disclosed. Keep in mind too that all of post-training was 5K GPU hours (Table 1). How this share grows in the DeepSeek reports after R1 is the storyline of this series.
Core method in depth: aux-loss-free load balancing
The problem: a tug of war between balance and performance
When an MoE router piles tokens onto a few experts, two things go wrong. Early in training only the popular experts get trained and the rest are never selected again (routing collapse), and with expert parallelism the busiest GPU sets the step time for everyone (wasted compute). The standard fix is an auxiliary loss. Look at the sequence-wise form that V3 uses as a supplement (Eqs. 17–20):
is the actual load (not differentiable) and the mean routing probability (differentiable). Under perfect balance . The gradient flows only through , so it pushes the router and every layer before it (the token representation ) in the direction that lowers the affinity of heavily loaded experts. That direction has nothing to do with the language-modelling loss, so a large hurts performance (Wang et al. 2024 call this the interference gradient). A small leaves the load unbalanced.
The fix: a bias used only for selection
V3 gives each expert a non-learned bias that is added only when choosing the top-K (Eq. 16).
The gating values are still normalised from the original . At the end of every step, the load over the whole batch is checked and overloaded experts get , underloaded ones . In the report’s words, “decrease by if overloaded, increase if underloaded”. Judged against the mean, that is .
Why this rule produces balance is simple. If an expert stays overloaded, its bias drops by every step until the tokens on the border of that expert move to other experts. Only tokens near the border move, so the “best-fitting expert” choice changes as little as possible. And since produces no gradient, it never touches the model parameters. It is a kind of integral controller. If is too large, the bias oscillates and the load actually fluctuates.
The side-effect-free advantage of batch-level balance. It also matters that balance is enforced over the whole batch. A sequence-wise aux loss demands balance even within a single sequence, which creates the odd constraint that a code document must not concentrate on the code experts. At batch level, each domain can use different experts as long as the overall sum is even. The report shows that the aux-loss-free model has more pronounced specialisation in per-domain expert load on the Pile (Figure 9), and that a batch-level aux loss gives similar performance (§4.5.3). V3 therefore adds only a very small sequence-wise loss () that guards against extreme imbalance.
깊이 의 모듈은 정답 를 입력으로 받는다(teacher forcing). 그래서 각 깊이의 예측도 완전한 인과 사슬을 유지하고, 본 모델의 표현 이 “두 칸 뒤까지 쓸모 있는” 정보를 담도록 gradient가 흐른다. 보고서가 드는 동기는 두 가지다. 학습 신호가 촘촘해져 데이터 효율이 오를 수 있고, 모델이 미래 토큰을 위해 표현을 미리 계획(pre-plan)할 수 있다. 추론 때 MTP 모듈은 버려도 본 모델이 독립적으로 돌아가므로 비용이 늘지 않는다. 반대로 남겨 두면 self-speculative decoding의 draft가 된다. 보고서는 두 번째 토큰의 수락률이 주제에 따라 85–90%였고 TPS가 1.8배가 되었다고 적는다(§5.4.3). 위 그림의 가 바로 그 상한이다. MTP 모듈과 embedding·출력 head를 같은 pipeline rank에 두어 파라미터와 gradient를 물리적으로 공유한다는 구현도 적혀 있다(§3.2.3).
데이터
데이터에 대한 서술은 짧다. 공개된 것은 대부분 처리 방식이고 구성 비율은 없다.
| 항목 | 보고서 서술 (§4.1, §5.1) |
|---|---|
| 규모 | 14.8T 토큰 (V3 tokenizer 기준) |
| 구성 변화 | V2 대비 수학·프로그래밍 비중을 높이고, 영어·중국어 밖 다국어 범위를 넓힘. 비율은 미공개 |
| 정제 | 다양성을 유지하면서 중복을 줄이도록 파이프라인 개선 (세부 미공개) |
| packing | Ding et al.(2024)의 document packing을 쓰되 cross-sample attention mask는 쓰지 않음 |
| FIM | Prefix-Suffix-Middle 형식, 문서 단위, 비율 0.1 (DeepSeekCoder-V2를 따름) |
| tokenizer | byte-level BPE, 어휘 128K. 구두점+줄바꿈 결합 토큰을 새로 넣고, 그로 인한 token boundary bias를 줄이려고 일부를 무작위로 쪼개서 학습 |
| 장문맥 데이터 | YaRN 확장 단계용 데이터의 구성은 미공개 |
| SFT 데이터 | 여러 도메인의 1.5M 인스턴스 |
| SFT 추론 데이터 | 수학·코드 대회·논리 퍼즐. 내부 R1 모델로 생성하되 도메인별 expert 모델(SFT+RL)을 거쳐 rejection sampling |
| SFT 비추론 데이터 | 창작·롤플레이·단순 QA. DeepSeek-V2.5로 생성 후 사람이 검수 |
추론 데이터를 만드는 과정이 흥미롭다. R1이 만든 답은 정확하지만 과하게 생각하고(overthinking), 형식이 엉성하고, 길다. 그래서 도메인마다 expert를 하나 학습하고, 한 문제에 대해 두 종류의 SFT 샘플을 만든다. <문제, 원래 답>과 <반성·검증을 유도하는 system prompt, 문제, R1 답>이다. 이 expert를 높은 temperature로 RL하면 system prompt 없이도 두 스타일이 섞인 답을 내게 되고, 수백 step 뒤의 expert에서 rejection sampling한 것이 최종 SFT 데이터다. Long CoT의 정확도는 가져오고 길이는 통제하려는 설계다.
학습
사전학습 레시피 (§4.2)
| 항목 | 값 |
|---|---|
| optimizer | AdamW, , weight decay 0.1, gradient clip 1.0 |
| 초기화 | 모든 파라미터 표준편차 0.006 |
| 시퀀스 길이 | 4K |
| 학습률 | 2K step 동안 0→2.2e-4 선형 warmup → 10T 토큰까지 2.2e-4 유지 → 4.3T 토큰 동안 cosine으로 2.2e-5 → 마지막 500B 중 333B는 2.2e-5, 167B는 7.3e-6 |
| batch | 처음 469B 토큰 동안 3,072 → 15,360 시퀀스로 늘린 뒤 유지 |
| 병렬화 | pipeline parallel + 층마다 routed expert를 8노드 64 GPU에 균등 배치 (tensor parallel 없음) |
| 부하 균형 | bias 속도 (처음 14.3T), 마지막 500B는 ; 보조 sequence-wise loss |
| MTP | , (처음 10T) → 0.1 |
| 클러스터 | H800 2,048장. 1T 토큰당 180K GPU 시간(약 3.7일) |
문맥 확장(§4.3). 사전학습 뒤 YaRN을 decoupled key 에만 적용해 두 단계(각 1,000 step)로 늘린다. 1단계는 32K·batch 1,920, 2단계는 128K·batch 480이고, 두 단계 모두 학습률 7.3e-6, YaRN은 , scaling 이다. RoPE가 작은 공유 key에만 있다는 MLA의 구조 덕분에 위치 보간을 그 64차원에만 걸면 된다.
FP8 혼합 정밀도 (§3.3)
선형층의 세 GEMM(forward, activation gradient, weight gradient)을 모두 FP8로 돌린다. 이론적으로 BF16 대비 연산 속도가 두 배이고, weight gradient GEMM이 FP8이면 backward용 activation도 FP8로 저장할 수 있다. 대신 embedding, 출력 head, MoE gating, normalization, attention은 원래 정밀도(BF16/FP32)로 남기고, master weight·weight gradient·optimizer 상태도 높은 정밀도로 둔다(AdamW의 1·2차 moment는 BF16, master weight와 gradient는 FP32).
FP8의 문제는 동적 범위다. E4M3의 최댓값은 448이고 가수는 3비트다. 텐서 전체의 최댓값을 448에 맞추는 per-tensor scaling에서는 outlier 하나가 scale을 정하므로 나머지 작은 값들이 subnormal이나 0으로 밀린다. V3는 scale을 잘게 쪼갠다.
- activation: 토큰마다 128 채널씩, 1×128 tile당 scale 하나
- weight: 입력 128 × 출력 128, 128×128 block당 scale 하나
- 모든 텐서에 E4M3 (기존 관행은 forward E4M3, backward E5M2). 작은 그룹이 지수 비트를 사실상 공유하므로 가수 정밀도를 택할 수 있다.
- scale은 이전 iteration의 기록이 아니라 현재 tile의 최댓값으로 그때그때 계산(online quantization)
또 하나는 누산 정밀도다. 보고서는 H800의 FP8 GEMM 누산이 약 14비트만 유지하며, 인 무작위 행렬 곱에서 최대 상대오차가 2% 가까이 나왔다고 적는다. 그래서 Tensor Core에서 개 원소(WGMMA 4번)를 누산할 때마다 부분합을 CUDA core의 FP32 레지스터로 옮겨 더하고, 이때 tile별 scale도 곱한다. 약 1T 토큰 규모의 검증 실험에서 BF16 대비 상대 loss 오차가 0.25% 미만이었다고 한다.
import numpy as np
def to_e4m3(x):
"""FP8 E4M3 반올림 흉내: 최대 448, 가수 3비트, 최소 정규수 2^-6, subnormal 간격 2^-9."""
x = np.clip(x, -448.0, 448.0)
a = np.abs(x)
e = np.floor(np.log2(np.maximum(a, 2.0 ** -6))) # subnormal 구간은 지수 -6에 고정
step = 2.0 ** (e - 3) # 한 옥타브를 8칸으로
return np.sign(x) * np.round(a / step) * step
def quant(x, block):
"""block=(br, bc)마다 amax를 448에 맞추는 scale 하나 → E4M3 → 복원(dequant)."""
br, bc = block
R, Cc = x.shape
xb = x.reshape(R // br, br, Cc // bc, bc)
scale = 448.0 / np.maximum(np.abs(xb).max(axis=(1, 3), keepdims=True), 1e-12)
return (to_e4m3(xb * scale) / scale).reshape(R, Cc)
rs = np.random.default_rng(0)
M, K, N = 64, 4096, 256
base = rs.standard_normal((M, K)) # activation (token × channel)
W = rs.standard_normal((K, N)) * 0.02 # weight (in × out)
hot = rs.choice(K, 8, replace=False) # outlier 채널 8개
print("outlier 배율 | 보통 원소가 0으로 사라진 비율 | 보통 원소의 평균 상대오차")
print(" | per-tensor 1x128 tile | per-tensor 1x128 tile")
for f in [10, 100, 1000, 10000]:
X = base.copy(); X[:, hot] *= f
normal = np.ones(K, bool); normal[hot] = False
row = []
for blk in [(M, K), (1, 128)]:
Xq = quant(X, blk)[:, normal]; Xn = X[:, normal]
row.append((np.mean((Xq == 0) & (Xn != 0)), np.mean(np.abs(Xq - Xn)) / np.mean(np.abs(Xn))))
print(f"{f:>12} | {row[0][0]:8.4f} {row[1][0]:8.4f} | {row[0][1]:8.4f} {row[1][1]:8.4f}")
X = base.copy(); X[:, hot] *= 1000
ref = X @ W
for name, bx, bw in [("per-tensor X, per-tensor W", (M, K), (K, N)),
("V3: X 1x128 tile, W 128x128 block", (1, 128), (128, 128))]:
Y = quant(X, bx) @ quant(W, bw)
print(f"{name:34s} GEMM 상대오차 {np.linalg.norm(Y - ref) / np.linalg.norm(ref):.4f}")
# 누산 정밀도: 누산기가 ~14비트만 유지한다고 가정, N_C=128마다 FP32로 승격
def acc_limited(a, b, bits=14, promote=None):
def rnd(v):
m, ex = np.frexp(v)
return np.ldexp(np.round(m * 2 ** bits) / 2 ** bits, ex)
out = np.zeros(a.shape[0]); part = np.zeros(a.shape[0])
for k in range(a.shape[1]):
part = rnd(part + a[:, k] * b[k])
if promote and (k + 1) % promote == 0:
out += part; part[:] = 0
return out + part
a = np.abs(rs.standard_normal((128, 4096))); b = np.abs(rs.standard_normal(4096))
exact = a @ b
for name, pr in [("14비트 누산만", None), ("N_C=128마다 FP32 승격", 128)]:
r = np.abs(acc_limited(a, b, promote=pr) - exact) / exact
print(f"K=4096 내적, {name:18s}: 최대 상대오차 {r.max():.1e}")outlier가 클수록 per-tensor scaling에서는 보통 크기의 원소가 0으로 사라지는 비율과 오차가 커지고, 1×128 tile은 거의 영향을 받지 않는다. 누산 실험은 “14비트 누산”을 가수 반올림으로 흉내 낸 것이라 보고서의 2%를 재현하지는 않지만, 128개마다 FP32로 옮기면 오차가 두 자릿수 줄어드는 방향은 같다.
인프라 한 줄 요약
DualPipe는 forward/backward chunk를 attention·all-to-all dispatch·MLP·combine으로 쪼개 계산과 통신을 겹치고, 양방향으로 micro-batch를 넣어 pipeline bubble을 줄이는 스케줄이다. 노드 간 all-to-all 커널은 IB와 NVLink 대역폭을 함께 쓰도록 짰고, RMSNorm·MLA up-projection 재계산, CPU의 EMA, MTP와 본 모델의 embedding·head 공유로 메모리를 줄여 tensor parallel 없이 학습했다(§3.2). 이 레슨의 범위 밖이지만, 2,048장 규모에서 fine-grained MoE의 all-to-all 비용을 거의 0으로 숨긴 것이 비용 수치의 큰 몫이다.
→ 더 깊이: 서빙을 위한 병렬화와 MoE — V3가 왜 wide expert parallelism과 prefill/decode 분리로 서빙되는지 토큰당 바이트로 계산한다.
사후학습 (§5)
SFT. 위 1.5M 데이터로 V3-Base를 2 epoch 학습한다. 학습률은 5e-6에서 1e-6까지 cosine으로 줄이고, 여러 샘플을 한 시퀀스에 packing하되 sample masking으로 서로 보이지 않게 한다.
보상. 규칙으로 검증할 수 있는 질문(박스 안 최종 답, LeetCode 테스트)에는 rule-based RM을 쓰고, 자유 형식 정답이 있는 질문이나 정답이 없는 창작 질문에는 V3 SFT checkpoint에서 학습한 model-based RM을 쓴다. 선호 데이터에 최종 점수뿐 아니라 그 점수에 이르는 chain-of-thought를 넣어 reward hacking을 줄였다고 한다. 일반 영역에서는 V3 자신의 투표 평가를 피드백으로 쓰는 constitutional AI식 self-rewarding도 썼다(§5.4.2).
RL. V2와 같은 GRPO(DeepSeekMath)를 쓴다. 이 사이트의 표기로 쓰면(보고서 식 26–28),
이고 KL은 k3 추정량 이다. 보고서는 응답 단위 ratio로 적었지만 구현은 보통 토큰 단위로 풀어 쓴다. 그 차이와 길이 정규화 문제는 RLVR과 GRPO 레슨에서 다뤘다. RL 프롬프트는 코딩·수학·글쓰기·롤플레이·QA를 섞었고, 세부 하이퍼파라미터(, , )는 공개하지 않았다. 사후학습 전체가 5K GPU 시간이라는 점(Table 1)도 기억해 두자. R1 이후 DeepSeek 보고서에서 이 비중이 어떻게 커지는지가 이 계열의 흐름이다.
핵심 method 깊게 보기: aux-loss-free 부하 균형
문제: 균형과 성능의 줄다리기
MoE router가 일부 expert에 토큰을 몰아주면 두 가지가 나빠진다. 학습 초기에 인기 expert만 학습되어 나머지가 영영 선택되지 않는 routing collapse, 그리고 expert parallel에서 가장 바쁜 GPU가 전체 step 시간을 정하는 계산 낭비다. 표준 해법은 보조 손실(auxiliary loss)이다. V3가 보조적으로 쓰는 sequence-wise 형태를 보면(식 17–20),
는 실제 부하(미분 불가)이고 는 평균 routing 확률(미분 가능)이다. 완전히 균등하면 이다. gradient는 를 통해서만 흐르므로, 부하가 큰 expert의 affinity를 낮추는 방향으로 router와 그 앞의 모든 층(토큰 표현 )을 민다. 이 gradient는 언어 모델링 손실과 무관한 방향이라 가 크면 성능을 해친다(Wang et al. 2024는 이것을 interference gradient라고 부른다). 가 작으면 균형이 안 맞는다.
해법: 선택에만 쓰는 bias
V3는 expert마다 학습되지 않는 bias 를 두고 top-K를 고를 때만 더한다(식 16).
gating 값은 여전히 원래 로 정규화한다. 매 step이 끝나면 batch 전체의 부하를 보고 과부하 expert는 , 저부하 expert는 로 바꾼다. 보고서의 말로는 “overloaded면 만큼 줄이고 underloaded면 늘린다”. 평균 대비로 판정하면 다.
이 규칙이 균형을 만드는 이유는 간단하다. 어떤 expert가 계속 과부하면 bias가 step마다 씩 내려가서, 결국 그 expert와 경계에 있던 토큰들이 다른 expert로 넘어간다. 경계 근처 토큰만 옮겨지므로 “가장 맞는 expert” 선택은 최소한으로만 바뀐다. 그리고 는 gradient를 만들지 않으므로 모델 파라미터를 한 번도 건드리지 않는다. 일종의 적분 제어기(integral controller)다. 가 너무 크면 bias가 진동해 부하가 오히려 출렁인다.
batch 단위 균형의 부작용 없는 장점. 균형을 batch 전체에서 맞춘다는 점도 중요하다. sequence-wise aux loss는 시퀀스 하나 안에서도 균등을 강요하므로, 코드 문서는 코드 expert에 몰리면 안 된다는 이상한 제약이 생긴다. batch 단위면 도메인마다 다른 expert를 쓰면서 전체 합만 고르면 된다. 보고서는 Pile의 도메인별 expert 부하에서 aux-loss-free 모델이 더 뚜렷한 특화를 보였고(Figure 9), batch 단위 aux loss로도 비슷한 성능이 나온다고 보고한다(§4.5.3). 그래서 V3는 극단적인 불균형만 막는 아주 작은 sequence-wise loss()만 덧붙인다.
What to check in the figure:
- With “no balancing”, MaxVio (load of the busiest expert / mean − 1) is 1.5 or more. The red bars are the popular experts.
- “aux-loss-free” brings MaxVio down to around 0.3 within a few dozen steps (the noise level of a 256-token sample), with zero affinity distortion. Raise γ to 0.1 or more and the bias oscillates, so MaxVio grows again.
- “aux loss (batch-wise)” balances about as well at α≈0.1, but it pushes the affinities and introduces distortion. Lower α to 0.01 and the balance gets worse. That is the tug of war of the aux loss.
- “aux loss (sequence-wise)” erases the specialisation in every row of the heatmap (domain specialisation falls to the uniform value 0.25). The batch-level methods stay above 0.9.
import numpy as np
N, D, TPD, K = 16, 4, 64, 2 # routed experts, domains (= sequences), tokens per sequence, top-K
rs0 = np.random.default_rng(7)
glob = rs0.permutation(np.linspace(1.4, -1.4, N)) # global popularity
pref = np.zeros((D, N))
for d in range(D):
pref[d, [(d + 4 * q) % N for q in range(4)]] = 2.0 # 4 preferred experts per domain
sig = lambda x: 1 / (1 + np.exp(-x))
def run(method, steps=300, gamma=1e-2, alpha=0.1, seed=11):
rs = np.random.default_rng(seed)
b = np.zeros(N) # aux-loss-free bias (used only for selection)
a_glob = np.zeros(N) # affinity shift caused by the aux loss (batch-wise)
a_dom = np.zeros((D, N)) # affinity shift caused by the aux loss (sequence-wise: the sequence representation changes)
dom_load, maxvio = np.zeros((D, N)), []
for step in range(steps):
s = sig(glob + pref[:, None, :] + 0.9 * rs.standard_normal((D, TPD, N)) + a_glob + a_dom[:, None, :])
key = s + b if method == "bias" else s
top = np.argsort(-key, axis=-1)[..., :K]
sel = np.zeros_like(s); np.put_along_axis(sel, top, 1.0, axis=-1)
cnt = sel.sum(1); load = cnt.sum(0) # (D,N), (N,)
if method in ("seq", "batch"): # gradient of L = α Σ f_i P_i
if method == "seq": f = N / (K * TPD) * cnt[:, None, :]
else: f = N / (K * D * TPD) * load[None, None, :]
S = s.sum(-1, keepdims=True)
g = s * (1 - s) / S * (f - (f * s / S).sum(-1, keepdims=True)) # ∂L/∂(logit_j)
if method == "seq": a_dom -= 4 * alpha * g.mean(1)
else: a_glob -= 4 * alpha * g.mean((0, 1))
if method == "bias":
b += gamma * np.sign(load.mean() - load) # overloaded -γ, underloaded +γ
maxvio.append(load.max() / load.mean() - 1)
dom_load = cnt if step == 0 else 0.9 * dom_load + 0.1 * cnt
spec = ((dom_load * (pref > 0)).sum(1) / dom_load.sum(1)).mean()
distort = np.sqrt((a_glob ** 2).mean() + (a_dom ** 2).mean())
return np.mean(maxvio[-50:]), spec, distort
print(f"{'method':28s} MaxVio spec. affinity distortion")
for name, kw in [("none", dict(method="none")),
("aux seq-wise α=0.1", dict(method="seq", alpha=0.1)),
("aux batch-wise α=0.01", dict(method="batch", alpha=0.01)),
("aux batch-wise α=0.1", dict(method="batch", alpha=0.1)),
("aux batch-wise α=1", dict(method="batch", alpha=1.0)),
("aux-loss-free γ=0.001", dict(method="bias", gamma=1e-3)),
("aux-loss-free γ=0.01", dict(method="bias", gamma=1e-2)),
("aux-loss-free γ=0.1", dict(method="bias", gamma=1e-1))]:
mv, sp, di = run(**kw)
print(f"{name:28s} {mv:6.2f} {sp:6.2f} {di:8.3f}")
print("spec. (specialisation) = share of a domain's tokens sent to that domain's preferred experts (0.25 if uniform)")In the results table, aux-loss-free reaches the same level of MaxVio as the aux loss with zero distortion, and oscillates. The real V3 uses over thousands of steps and switches it to 0 for the last 500B tokens, freezing the bias.
Ported to PyTorch, the router looks like this. In real distributed training, load has to be all-reduced over the whole data-parallel and expert-parallel group before the update for it to be “the load of the whole batch”.
import torch
import torch.nn as nn
class AuxFreeRouter(nn.Module):
"""DeepSeek-V3-style router: sigmoid affinity, bias only for top-k selection, gates normalised from the selected affinities."""
def __init__(self, d_model: int, n_routed: int, top_k: int, gamma: float = 1e-3):
super().__init__()
self.centroids = nn.Parameter(torch.randn(n_routed, d_model) * 0.006) # e_i
self.register_buffer("bias", torch.zeros(n_routed)) # b_i (not learned)
self.top_k, self.gamma = top_k, gamma
def forward(self, u: torch.Tensor):
# u: (tokens, d_model)
s = torch.sigmoid(u @ self.centroids.t()) # s_{i,t}
idx = torch.topk(s + self.bias, self.top_k, dim=-1).indices
g = torch.gather(s, -1, idx) # gates use the original affinity
g = g / g.sum(-1, keepdim=True)
return idx, g, s
@torch.no_grad()
def update_bias(self, idx: torch.Tensor):
# once at the end of a step. In distributed training, all_reduce load before calling.
load = torch.bincount(idx.flatten(), minlength=self.bias.numel()).float()
self.bias += self.gamma * torch.sign(load.mean() - load)
def sequence_balance_loss(s: torch.Tensor, idx: torch.Tensor, n_routed: int, top_k: int, alpha: float = 1e-4):
"""Auxiliary sequence-wise loss (Eqs. 17–20). s: (T, N_r) affinities of one sequence, idx: (T, top_k)."""
T = s.shape[0]
counts = torch.bincount(idx.flatten(), minlength=n_routed).float()
f = counts * n_routed / (top_k * T) # not differentiable (treated as constant)
P = (s / s.sum(-1, keepdim=True)).mean(0) # differentiable
return alpha * (f.detach() * P).sum()In DeepSeek-V3's aux-loss-free scheme, what does the expert bias b_i affect?
only changes which experts are chosen, through . The gating value that multiplies a selected expert’s output is made by normalising the original affinities among the selected experts. is updated by from the load, not by a gradient, so it creates no interference gradient in the router or the layers before it. That is the key difference from an aux loss.
Experimental results
Post-trained model (Table 6)
A comparison with every model’s output length capped at 8K. Benchmarks with fewer than 1,000 samples are averaged over several runs at varying temperatures; AIME and CNMO are averaged over 16 runs at temperature 0.7, and MATH-500 uses greedy decoding. SWE-bench Verified was evaluated with the agentless framework.
그림에서 확인할 것:
- “균형 장치 없음”에서 MaxVio(가장 바쁜 expert의 부하/평균 − 1)가 1.5 이상이다. 빨간 막대가 인기 expert다.
- “aux-loss-free”는 수십 step 안에 MaxVio가 0.3 근처로 내려가고(256토큰 표본 잡음 수준), affinity 왜곡은 0이다. γ를 0.1 이상으로 올리면 bias가 진동해 MaxVio가 다시 커진다.
- “aux loss (batch-wise)“도 α≈0.1이면 비슷하게 균형이 맞지만 affinity가 밀려 왜곡이 생긴다. α를 0.01로 낮추면 균형이 덜 맞는다. 이것이 aux loss의 줄다리기다.
- “aux loss (sequence-wise)“는 heatmap의 행마다 특화를 지운다(도메인 특화도가 균등값 0.25로 떨어진다). batch 단위 방법들은 0.9 이상을 유지한다.
import numpy as np
N, D, TPD, K = 16, 4, 64, 2 # routed expert, 도메인(=시퀀스), 시퀀스당 토큰, top-K
rs0 = np.random.default_rng(7)
glob = rs0.permutation(np.linspace(1.4, -1.4, N)) # 전역 인기도
pref = np.zeros((D, N))
for d in range(D):
pref[d, [(d + 4 * q) % N for q in range(4)]] = 2.0 # 도메인마다 선호 expert 4개
sig = lambda x: 1 / (1 + np.exp(-x))
def run(method, steps=300, gamma=1e-2, alpha=0.1, seed=11):
rs = np.random.default_rng(seed)
b = np.zeros(N) # aux-loss-free bias (선택에만 사용)
a_glob = np.zeros(N) # aux loss가 밀어낸 affinity (batch-wise)
a_dom = np.zeros((D, N)) # aux loss가 밀어낸 affinity (sequence-wise: 시퀀스 표현이 바뀜)
dom_load, maxvio = np.zeros((D, N)), []
for step in range(steps):
s = sig(glob + pref[:, None, :] + 0.9 * rs.standard_normal((D, TPD, N)) + a_glob + a_dom[:, None, :])
key = s + b if method == "bias" else s
top = np.argsort(-key, axis=-1)[..., :K]
sel = np.zeros_like(s); np.put_along_axis(sel, top, 1.0, axis=-1)
cnt = sel.sum(1); load = cnt.sum(0) # (D,N), (N,)
if method in ("seq", "batch"): # L = α Σ f_i P_i 의 gradient
if method == "seq": f = N / (K * TPD) * cnt[:, None, :]
else: f = N / (K * D * TPD) * load[None, None, :]
S = s.sum(-1, keepdims=True)
g = s * (1 - s) / S * (f - (f * s / S).sum(-1, keepdims=True)) # ∂L/∂(logit_j)
if method == "seq": a_dom -= 4 * alpha * g.mean(1)
else: a_glob -= 4 * alpha * g.mean((0, 1))
if method == "bias":
b += gamma * np.sign(load.mean() - load) # 과부하 -γ, 저부하 +γ
maxvio.append(load.max() / load.mean() - 1)
dom_load = cnt if step == 0 else 0.9 * dom_load + 0.1 * cnt
spec = ((dom_load * (pref > 0)).sum(1) / dom_load.sum(1)).mean()
distort = np.sqrt((a_glob ** 2).mean() + (a_dom ** 2).mean())
return np.mean(maxvio[-50:]), spec, distort
print(f"{'방법':28s} MaxVio 특화도 affinity 왜곡")
for name, kw in [("없음", dict(method="none")),
("aux seq-wise α=0.1", dict(method="seq", alpha=0.1)),
("aux batch-wise α=0.01", dict(method="batch", alpha=0.01)),
("aux batch-wise α=0.1", dict(method="batch", alpha=0.1)),
("aux batch-wise α=1", dict(method="batch", alpha=1.0)),
("aux-loss-free γ=0.001", dict(method="bias", gamma=1e-3)),
("aux-loss-free γ=0.01", dict(method="bias", gamma=1e-2)),
("aux-loss-free γ=0.1", dict(method="bias", gamma=1e-1))]:
mv, sp, di = run(**kw)
print(f"{name:28s} {mv:6.2f} {sp:6.2f} {di:8.3f}")
print("특화도 = 도메인 토큰 중 그 도메인 선호 expert로 간 비율 (균등이면 0.25)")결과 표에서 aux-loss-free는 왜곡 0으로 aux loss와 같은 수준의 MaxVio에 도달하고, 은 진동한다. 실제 V3는 수천 step 동안 을 쓰다가 마지막 500B 토큰에서는 0으로 꺼 bias를 고정한다.
PyTorch로 옮기면 router는 이렇게 된다. 실제 분산 학습에서는 load를 data-parallel·expert-parallel 전체로 all-reduce한 뒤 갱신해야 “batch 전체의 부하”가 된다.
import torch
import torch.nn as nn
class AuxFreeRouter(nn.Module):
"""DeepSeek-V3식 router: sigmoid affinity, bias는 top-k 선택에만, gate는 선택된 affinity로 정규화."""
def __init__(self, d_model: int, n_routed: int, top_k: int, gamma: float = 1e-3):
super().__init__()
self.centroids = nn.Parameter(torch.randn(n_routed, d_model) * 0.006) # e_i
self.register_buffer("bias", torch.zeros(n_routed)) # b_i (학습 X)
self.top_k, self.gamma = top_k, gamma
def forward(self, u: torch.Tensor):
# u: (tokens, d_model)
s = torch.sigmoid(u @ self.centroids.t()) # s_{i,t}
idx = torch.topk(s + self.bias, self.top_k, dim=-1).indices
g = torch.gather(s, -1, idx) # gate는 원래 affinity
g = g / g.sum(-1, keepdim=True)
return idx, g, s
@torch.no_grad()
def update_bias(self, idx: torch.Tensor):
# step 끝에 한 번. 분산 학습이면 load를 all_reduce한 뒤 호출.
load = torch.bincount(idx.flatten(), minlength=self.bias.numel()).float()
self.bias += self.gamma * torch.sign(load.mean() - load)
def sequence_balance_loss(s: torch.Tensor, idx: torch.Tensor, n_routed: int, top_k: int, alpha: float = 1e-4):
"""보조 sequence-wise loss (식 17–20). s: (T, N_r) 한 시퀀스의 affinity, idx: (T, top_k)."""
T = s.shape[0]
counts = torch.bincount(idx.flatten(), minlength=n_routed).float()
f = counts * n_routed / (top_k * T) # 미분 불가 (상수 취급)
P = (s / s.sum(-1, keepdim=True)).mean(0) # 미분 가능
return alpha * (f.detach() * P).sum()DeepSeek-V3의 aux-loss-free 방식에서 expert bias b_i가 영향을 주는 것은?
는 로 어떤 expert를 고를지만 바꾼다. 선택된 expert의 출력에 곱하는 gating 값은 원래 affinity 를 선택된 것끼리 정규화해 만든다. 는 gradient가 아니라 부하를 보고 로 갱신되므로 router나 앞단 층에 간섭 gradient를 만들지 않는다. 이것이 aux loss와의 핵심 차이다.
실험 결과
사후학습 모델 (Table 6)
모든 모델의 출력 길이를 8K로 제한한 비교다. 1,000개 미만의 벤치마크는 temperature를 바꿔 여러 번 돌린 평균이고, AIME·CNMO는 temperature 0.7로 16번 평균, MATH-500은 greedy다. SWE-bench Verified는 agentless 프레임워크로 평가했다.
The gap is largest in mathematics and coding contests. AIME 2024 at 39.2 and MATH-500 at 90.2 are unusual for a non-long-CoT model, and the natural reading is that this is the effect of the R1 distillation described above. On the other hand it trails on SWE Verified (42.0 vs Claude 50.8) and SimpleQA (24.9 vs GPT-4o 38.2). The report itself says it is slightly below Claude-3.5-Sonnet on engineering tasks.
The ablations that justify the methods
MTP (Table 4). A comparison that only adds a 1-depth MTP module to the same data and architecture. The MTP module is discarded at inference, so inference cost is the same. small has 2.4B active / 15.7B total parameters trained on 1.33T tokens; large has 20.9B active / 228.7B total trained on 540B tokens.
| Benchmark | small baseline | small +MTP | large baseline | large +MTP |
|---|---|---|---|---|
| Pile-test (BPB, lower is better) | 0.729 | 0.729 | 0.658 | 0.657 |
| BBH (3-shot EM) | 39.0 | 41.4 | 70.0 | 70.7 |
| MMLU (5-shot EM) | 50.0 | 53.3 | 67.5 | 66.6 |
| DROP (1-shot F1) | 39.2 | 41.3 | 68.5 | 70.6 |
| HumanEval (0-shot Pass@1) | 20.7 | 26.8 | 44.5 | 53.7 |
| MBPP (3-shot Pass@1) | 35.8 | 36.8 | 61.6 | 62.2 |
| GSM8K (8-shot EM) | 25.4 | 31.4 | 72.3 | 74.0 |
| MATH (4-shot EM) | 10.7 | 12.6 | 38.6 | 39.8 |
aux-loss-free (Table 5). The two baselines use a pure aux loss (of the same strength as V2-Lite and V2) and sigmoid gating; the comparison models drop every aux loss and add the bias scheme. small: 15.7B on 1.33T tokens; large: 228.7B on 578B tokens.
| Benchmark | small aux-loss | small aux-free | large aux-loss | large aux-free |
|---|---|---|---|---|
| Pile-test (BPB) | 0.727 | 0.724 | 0.656 | 0.652 |
| BBH (3-shot EM) | 37.3 | 39.3 | 66.7 | 67.9 |
| MMLU (5-shot EM) | 51.0 | 51.8 | 68.3 | 67.2 |
| HumanEval (0-shot Pass@1) | 22.0 | 22.6 | 40.2 | 46.3 |
| MBPP (3-shot Pass@1) | 36.6 | 35.8 | 59.2 | 61.2 |
| GSM8K (8-shot EM) | 27.1 | 29.6 | 70.7 | 74.5 |
| MATH (4-shot EM) | 10.9 | 11.1 | 37.2 | 39.6 |
Batch vs sequence balance (§4.5.3). For a 1B MoE the validation loss was 2.258 with a sequence-wise aux loss, 2.253 aux-loss-free, and 2.253 with a batch-wise aux loss. For a 3B MoE it was 2.085 vs 2.080 and 2.080. So the source of the gain is closer to balance being enforced over the batch than to “there is no loss”. The report notes that the price of batch-level balance is possible imbalance with small batches or under domain shift at inference, which it guards against with large micro-batches and redundant expert placement at inference.
R1 distillation (Table 9, on V2.5). LiveCodeBench-CoT pass@1 rises 31.1→37.4 and MATH-500 74.6→83.2, but the average response length also grows, 718→783 and 769→1,510 tokens. Because of this trade-off between accuracy and length, the distillation settings were tuned for V3.
Reading critically
- The scope of $5.576M. As the report itself says, this figure covers only the official training run and excludes the cost of prior research and ablations on architecture, algorithms and data. Nor does it include building the cluster. It should not be read as “V3 was made for six million dollars”.
- Almost nothing about the data is disclosed. There are no per-source ratios for the 14.8T tokens, no filtering criteria, no deduplication method, no composition of the long-context data. “More mathematics and code” alone cannot separate the share of the benchmark gains due to data from the share due to architecture.
- Scale of the ablations and mixed results. The MTP and aux-free ablations were run on 15.7B and 228.7B models, not at 671B. Most are improvements, but MMLU of the large model fell in both ablations (67.5→66.6, 68.3→67.2). Each is a single run, so the variance is unknown. By Table 3’s criterion that “differences of 0.3 or less are on par”, some of the improvements are within noise.
- Evaluation uses an internal framework (HAI-LLM). The base-model comparison is said to have been rerun with identical settings, but the prompts and extraction rules are not published in an externally reproducible form. The chat comparison caps output at 8K, which disadvantages models that think at length.
- Same model, different numbers. The DeepSeek-V3 scores in R1 report Table 8 differ from Table 6 of this report (e.g. LiveCodeBench-CoT 36.2 vs 40.5, Codeforces percentile 58.7 vs 51.6, C-SimpleQA 68.0 vs 64.8). The LiveCodeBench problem windows differ (2024-08–11 vs 2024-08–2025-01), and it may be a later revision of V3. When carrying numbers between reports, read the table footnotes first.
- Contamination. The V3 report itself describes no benchmark decontamination procedure (the R1 report explains V3-Base’s 10-gram filtering after the fact). Read high scores on long-public sets such as AIME 2024 and MATH-500 with that in mind.
- RL details not disclosed. There is no GRPO group size, clip, KL coefficient, step count or RM size. It is also unclear what the small 5K GPU hours of post-training include (very likely not the cost of training the R1-series experts).
Summary
- V3 keeps MLA (K/V jointly compressed into a latent + a 64-dimensional shared RoPE key, 576 numbers per token per layer) and DeepSeekMoE (1 shared + 8 of 256 routed), and decoupled RoPE is what makes it possible to absorb the up-projections into the query and output.
- Aux-loss-free balancing adds a bias only to the top-K selection and updates it by from the load. There is no gradient interference, and batch-level balance allows domain specialisation. In the ablations it is generally better than the aux-loss baseline.
- Sequential MTP (D=1, λ 0.3→0.1) predicts one more token while keeping the causal chain, adding training signal, and at inference serves as a draft with an 85–90% acceptance rate for 1.8× TPS.
- The essentials of FP8 are the fine-grained 1×128/128×128 scales, E4M3 for all tensors, FP32 promotion every 128 elements and online scales; the report gives a loss difference within 0.25% of BF16.
- Post-training is 1.5M SFT samples rejection-sampled from R1 experts + GRPO, at a very small cost relative to pre-training (5K GPU hours). How this share changes in later reports is the storyline of the next lessons.
수학과 코드 대회에서 차이가 가장 크다. AIME 2024 39.2, MATH-500 90.2는 long-CoT가 아닌 모델로는 이례적인데, 위에서 본 R1 증류의 효과로 읽는 것이 자연스럽다. 반면 SWE Verified(42.0 vs Claude 50.8)와 SimpleQA(24.9 vs GPT-4o 38.2)에서는 뒤진다. 보고서도 공학 과제에서 Claude-3.5-Sonnet보다 약간 아래라고 적는다.
방법을 정당화하는 ablation
MTP (Table 4). 같은 데이터·구조에 1-depth MTP 모듈만 붙인 비교다. 추론 때 MTP 모듈은 버리므로 추론 비용은 같다. small은 활성 2.4B·총 15.7B를 1.33T 토큰, large는 활성 20.9B·총 228.7B를 540B 토큰 학습했다.
| 벤치마크 | small 기준 | small +MTP | large 기준 | large +MTP |
|---|---|---|---|---|
| Pile-test (BPB, 낮을수록 좋음) | 0.729 | 0.729 | 0.658 | 0.657 |
| BBH (3-shot EM) | 39.0 | 41.4 | 70.0 | 70.7 |
| MMLU (5-shot EM) | 50.0 | 53.3 | 67.5 | 66.6 |
| DROP (1-shot F1) | 39.2 | 41.3 | 68.5 | 70.6 |
| HumanEval (0-shot Pass@1) | 20.7 | 26.8 | 44.5 | 53.7 |
| MBPP (3-shot Pass@1) | 35.8 | 36.8 | 61.6 | 62.2 |
| GSM8K (8-shot EM) | 25.4 | 31.4 | 72.3 | 74.0 |
| MATH (4-shot EM) | 10.7 | 12.6 | 38.6 | 39.8 |
aux-loss-free (Table 5). 두 기준 모델은 순수 aux loss(V2-Lite, V2와 같은 세기)와 sigmoid gating을 쓰고, 비교 모델은 aux loss를 모두 빼고 bias 방식을 넣었다. small 15.7B·1.33T 토큰, large 228.7B·578B 토큰.
| 벤치마크 | small aux-loss | small aux-free | large aux-loss | large aux-free |
|---|---|---|---|---|
| Pile-test (BPB) | 0.727 | 0.724 | 0.656 | 0.652 |
| BBH (3-shot EM) | 37.3 | 39.3 | 66.7 | 67.9 |
| MMLU (5-shot EM) | 51.0 | 51.8 | 68.3 | 67.2 |
| HumanEval (0-shot Pass@1) | 22.0 | 22.6 | 40.2 | 46.3 |
| MBPP (3-shot Pass@1) | 36.6 | 35.8 | 59.2 | 61.2 |
| GSM8K (8-shot EM) | 27.1 | 29.6 | 70.7 | 74.5 |
| MATH (4-shot EM) | 10.9 | 11.1 | 37.2 | 39.6 |
batch vs sequence 균형(§4.5.3). 1B MoE의 validation loss는 sequence-wise aux loss 2.258, aux-loss-free 2.253, batch-wise aux loss 2.253이었다. 3B MoE에서는 2.085 대 2.080, 2.080이다. 즉 이득의 원천은 “loss가 없다”보다 균형을 맞추는 범위가 batch라는 것에 가깝다. 보고서는 batch 단위 균형의 대가로 작은 batch나 추론 시 도메인 이동에서 불균형이 생길 수 있다고 적고, 이를 큰 micro-batch와 추론 때의 redundant expert 배치로 막는다.
R1 증류 (Table 9, V2.5 기준). LiveCodeBench-CoT pass@1이 31.1→37.4, MATH-500이 74.6→83.2로 오르지만, 평균 응답 길이도 718→783, 769→1,510 토큰으로 늘었다. 정확도와 길이의 trade-off 때문에 V3에서는 증류 설정을 조절했다고 한다.
비판적으로 읽기
- $5.576M의 범위. 보고서가 직접 밝히듯 이 수치는 공식 학습 실행만 포함하고 아키텍처·알고리즘·데이터에 대한 사전 연구와 ablation 비용은 뺐다. 클러스터 구축비도 없다. “V3를 6백만 달러에 만들었다”로 읽으면 안 된다.
- 데이터는 거의 공개되지 않았다. 14.8T의 출처별 비율, 필터링 기준, 중복 제거 방법, 장문맥 데이터 구성이 없다. 수학·코드 비중을 높였다는 서술만으로는 벤치마크 향상 가운데 데이터의 몫과 아키텍처의 몫을 나눌 수 없다.
- ablation의 규모와 혼재된 결과. MTP와 aux-free ablation은 15.7B·228.7B 모델에서 했고 671B에서는 하지 않았다. 대부분 개선이지만 large 모델의 MMLU는 두 ablation 모두에서 떨어졌다(67.5→66.6, 68.3→67.2). 한 번의 실행이라 분산도 모른다. Table 3의 “0.3 이하 차이는 같은 수준”이라는 기준에 비추면 일부 개선은 잡음 범위다.
- 평가는 내부 프레임워크(HAI-LLM). base 모델 비교는 같은 설정으로 다시 돌렸다고 하지만 프롬프트·추출 규칙이 외부에서 재현 가능한 형태로 공개되지 않았다. chat 비교는 출력 8K 제한이라 길게 생각하는 모델에 불리하다.
- 같은 모델, 다른 숫자. R1 보고서 Table 8에 실린 DeepSeek-V3 점수는 이 보고서 Table 6과 다르다(예: LiveCodeBench-CoT 36.2 vs 40.5, Codeforces percentile 58.7 vs 51.6, C-SimpleQA 68.0 vs 64.8). LiveCodeBench 문제 기간이 다르고(2024-08–11 vs 2024-08–2025-01) 이후 개정된 V3일 수도 있다. 보고서 사이에서 숫자를 옮겨 비교할 때는 표의 각주부터 봐야 한다.
- 오염. V3 보고서 자체에는 벤치마크 오염 제거 절차가 서술되어 있지 않다(R1 보고서가 V3-Base의 10-gram 필터링을 사후에 설명한다). AIME 2024·MATH-500처럼 공개된 지 오래된 세트의 고득점은 이 점을 감안해 읽자.
- RL 세부 미공개. GRPO의 그룹 크기, clip, KL 계수, step 수, RM 크기가 없다. 사후학습 5K GPU 시간이라는 작은 수치가 무엇을 포함하는지도 불분명하다(R1 계열 expert 학습 비용은 포함되지 않았을 가능성이 크다).
정리
- V3는 MLA(K/V를 latent로 공동 압축 + 64차원 공유 RoPE key, 토큰·층당 576개)와 DeepSeekMoE(shared 1 + routed 256 중 8)를 그대로 쓰고, decoupled RoPE는 up-projection을 query·output에 흡수하기 위해 필요하다.
- aux-loss-free 균형은 bias를 top-K 선택에만 더하고 부하에 따라 로 갱신한다. gradient 간섭이 없고, batch 단위 균형이라 도메인 특화를 허용한다. ablation에서 aux-loss 기준보다 대체로 낫다.
- 순차형 MTP(D=1, λ 0.3→0.1)는 인과 사슬을 유지한 채 한 토큰 더 예측해 학습 신호를 늘리고, 추론 때는 85–90% 수락률의 draft로 1.8배 TPS를 낸다.
- FP8은 1×128/128×128 세분화 scale, 전 텐서 E4M3, 128원소마다 FP32 승격, online scale이 핵심이며 BF16 대비 0.25% 이내 loss 차이를 보고한다.
- 사후학습은 R1 expert에서 rejection sampling한 1.5M SFT + GRPO이고, 사전학습 대비 매우 작은 비용(5K GPU 시간)이었다. 이 비중이 이후 보고서에서 어떻게 바뀌는지가 다음 레슨들의 줄거리다.
더 읽을거리Further reading
- DeepSeek-AI, DeepSeek-V3 Technical Report (2024) — 이 레슨의 대상. 모든 수치의 출처(v2, 2025-02 개정판).The subject of this lesson; the source of every number (v2, the 2025-02 revision).
- DeepSeek-AI, DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model (2024) — MLA와 decoupled RoPE를 처음 제안하고 MHA·GQA와 비교한 보고서. V3는 "언급하지 않은 세부는 V2를 따른다"고 적는다.The report that first proposed MLA and decoupled RoPE and compared them with MHA and GQA. V3 says that "details not mentioned follow V2".
- Dai et al., DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models (2024) — fine-grained expert 분할과 shared expert 분리의 원 논문.The original paper on fine-grained expert segmentation and shared-expert isolation.
- Wang et al., Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Experts (2024) — bias로 top-K 선택만 조정하는 부하 균형. aux loss의 간섭 gradient 논의와 MaxVio 지표.Load balancing that adjusts only the top-K selection with a bias. Discusses the interference gradient of aux losses and the MaxVio metric.
- Gloeckle et al., Better & Faster Large Language Models via Multi-token Prediction (2024) — 독립 head로 여러 토큰을 병렬 예측하는 MTP. V3는 이것을 순차 모듈로 바꿨다.MTP that predicts several tokens in parallel with independent heads. V3 turned this into sequential modules.
- Shao et al., DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models (2024) — V3의 RL 단계가 쓰는 GRPO의 원 논문.The original paper of GRPO, which V3's RL stage uses.
- Peng et al., YaRN: Efficient Context Window Extension of Large Language Models (2023) — 4K→32K→128K 확장에 쓴 RoPE 보간법.The RoPE interpolation used for the 4K→32K→128K extension.
- Micikevicius et al., FP8 Formats for Deep Learning (2022) — E4M3/E5M2 형식의 정의. V3는 모든 텐서에 E4M3를 쓴다.Defines the E4M3/E5M2 formats. V3 uses E4M3 for every tensor.