Skip to content

DeepSeek-V3 Technical Report

main track #9corefrontierpaperrubric 11/122024 · ~60 min

DeepSeek-AI (Aixin Liu, Bei Feng, Bing Xue, et al.)

Read first: DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models · DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model

Status

TL;DR. DeepSeek-V3 is a Mixture-of-Experts model with 671B total and 37B active parameters, trained on 14.8T tokens. It combines Multi-head Latent Attention (MLA), DeepSeekMoE with auxiliary-loss-free load balancing, a one-token multi-token-prediction (MTP) objective and FP8 mixed-precision training. The full run took 2.788M H800 GPU-hours, with no irrecoverable loss spikes or rollbacks. Post-training (separate from the pretraining objective) distills reasoning from DeepSeek-R1 into SFT data and then runs GRPO (Group Relative Policy Optimization), an RL method that scores several sampled answers per prompt and uses their reward relative to the group average instead of a learned critic.

Why it matters now. V3 showed that an open model could match the best closed models of late 2024 at a fraction of the usual compute. Its architecture became the template for later open MoE models such as Kimi K2. It was also the base model for DeepSeek-R1 and the direct ancestor of DeepSeek-V4.

Cache a latent, not the keys and values. MLA compresses each token’s hidden state into a small latent ctKV=WDKVhtc^{KV}_t = W^{DKV} h_t (dc=512d_c = 512) and a shared RoPE key ktRk^R_t (64 dims). Keys and values for all 128 heads are recovered by up-projection. The cache per token per layer is

dc+dhR=512+64=576vs.2 nhdh=2⋅128⋅128=32,768 for MHA.d_c + d^R_h = 512 + 64 = 576 \quad\text{vs.}\quad 2\,n_h d_h = 2\cdot128\cdot128 = 32{,}768 \text{ for MHA.}

Balance experts with a bias, not a loss. Each routed expert has a bias bib_i used only for top-KK selection:

gi,t′={si,t,si,t+bi∈Topk⁡({sj,t+bj},Kr)0,otherwise,si,t=σ(ut⊤ei).g'_{i,t} = \begin{cases} s_{i,t}, & s_{i,t} + b_i \in \operatorname{Topk}(\{s_{j,t}+b_j\}, K_r) \\ 0, & \text{otherwise,}\end{cases} \qquad s_{i,t} = \sigma(u_t^\top e_i).

After each step bib_i moves by γ\gamma toward balance. Predict one extra token. A sequential MTP module with shared embedding and output head adds a loss λ LMTP\lambda\,\mathcal{L}_{\text{MTP}}. It can be discarded at inference or reused for speculative decoding.

DeepSeek-V3: MLA cache, MoE routing and multi-token prediction Left: the hidden state h is down-projected to a 512-dimensional latent and a 64-dimensional RoPE key; only these 576 numbers per token per layer are cached, and keys and values for 128 heads are up-projected from them. Middle: an MoE layer where a sigmoid router with a per-expert bias picks 8 of 256 routed experts, plus 1 always-on shared expert. Right: the main model predicts token t+1 and a single MTP module, sharing the embedding and output head, predicts token t+2. MLA h_t latent c_KV 512 RoPE key 64 cache: 576 / token / layer K, V for 128 heads up-projected MHA would cache 2 × 128 × 128 = 32,768 MoE layer (58 of 61) router: sigmoid(u·e_i) + b_i bias b_i only picks top-8 shared 8 of 256 routed γ = 0.001: lower b_i if overloaded, raise b_i if underloaded 2,048-wide experts · ≤ 4 nodes/token 671B total · 37B active MTP (D = 1) main model predicts t+1 MTP block predicts t+2 shared embedding + head loss weight 0.3 → 0.1 inference: drop it, or use it as a draft (85–90% accepted) Core GEMMs in FP8 (1×128 / 128×128 scales, FP32 promotion) · 14.8T tokens · 2.788M H800 GPU-hours
Original sketch. MLA caches a 576-dim vector per token; each MoE layer runs 1 shared + 8 of 256 routed experts; the MTP module predicts token t+2.
  • Cost (Table 1). 180K H800 GPU-hours per trillion tokens. Total 2.788M GPU-hours (2,664K pretraining + 119K context extension + 5K post-training), or 5.576M USD at 2 USD per GPU-hour. Excludes research and ablations.
  • Chat model (Table 6). MMLU 88.5, MMLU-Pro 75.9, GPQA-Diamond 59.1, MATH-500 90.2, AIME 2024 39.2, Codeforces percentile 51.6, SWE-bench Verified 42.0 (Claude 3.5 Sonnet 50.8).
  • MTP (§5.4.3). The second-token acceptance rate is 85–90%, giving 1.8× tokens per second when used for speculative decoding. Ablations at 15.7B and 228.7B total parameters improve most benchmarks (Table 4).
  • R1 distillation (Table 9, on V2.5). LiveCodeBench-CoT 31.1 → 37.4 and MATH-500 74.6 → 83.2, but MATH-500 response length roughly doubles (769 → 1,510 tokens).
  • MLA + fine-grained MoE + loss-free balancing became the default open MoE template. Kimi K2 says its architecture “follows a similar design to DeepSeek-V3”; GLM-4.5 adopts loss-free balance routing and sigmoid gates.
  • Fine-grained FP8 training showed FP8 was workable at the 671B scale.
  • Distilling a reasoning model into a general model and controlling response length became standard post-training practice.
  • DualPipe and all-to-all overlap showed how much MoE efficiency depends on communication engineering.
  • The headline cost excludes research, ablations and the R1 models used for distillation.
  • Serving needs large deployments (a prefill unit of 4 nodes with 32 GPUs) to use expert parallelism well.
  • FP8 relies on H800-specific accumulation workarounds; the paper asks hardware vendors for better FP8 accumulation.
  • R1 distillation increases response length, which needs extra control.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    DeepSeek-V3 has 61 layers, 128 heads of dimension 128, a KV latent of d_c = 512 and a decoupled RoPE key of 64 dimensions. Compute the per-token KV cache for MLA and for standard multi-head attention, in elements and in BF16 bytes, across all layers.

    What a strong answer covers
    • MLA caches only the latent c_KV (512) and the shared RoPE key k_R (64): 576 elements per token per layer.
    • MHA caches K and V for every head: 2 × 128 × 128 = 32,768 elements per token per layer, about 57× more.
    • Across 61 layers: MLA ≈ 35,136 elements ≈ 70 KB per token in BF16; MHA ≈ 2.0M elements ≈ 4.0 MB per token.
    • At 128K context, MLA needs about 9 GB per sequence, against about 520 GB for MHA, which is why MHA at this size is impractical.
    • The up-projection W_UK can be absorbed into the query side at inference, so no full keys are rebuilt.
  2. Mechanism

    Explain DeepSeek-V3's auxiliary-loss-free load balancing. Why is the bias added only when choosing the top-8 experts and not when computing the gate value, and what does the small sequence-wise loss add?

    What a strong answer covers
    • Each expert has a bias b_i. Routing picks the top-K of s_i + b_i, but the gate value is still the normalized sigmoid affinity s_i.
    • After each step, b_i drops by γ if the expert was overloaded and rises by γ if underloaded (γ = 0.001 for the first 14.3T tokens, then 0).
    • Keeping the bias out of the gate means balancing changes which experts run without distorting the output mix or adding a gradient that fights the language-modeling loss.
    • A tiny sequence-wise balance loss (α = 0.0001) only prevents extreme imbalance within one sequence.
    • Balance is enforced per batch rather than per sequence, which lets experts specialize by domain (Fig. 9).
  3. What if…

    Section 4.5.3 compares sequence-wise auxiliary loss, auxiliary-loss-free balancing and a batch-wise auxiliary loss. What do the numbers show, and what does that imply about why the loss-free method helps?

    What a strong answer covers
    • 1B MoE validation loss: 2.258 with a sequence-wise loss, 2.253 loss-free, 2.253 with a batch-wise loss.
    • 3B MoE: 2.085 sequence-wise against 2.080 for both loss-free and batch-wise.
    • So the gain comes mostly from the balancing scope (batch vs sequence), not from removing the auxiliary gradient.
    • Batch-wise balancing has its own risks: imbalance within small batches and domain-shift imbalance at inference.
  4. Critique

    DeepSeek-V3 is often summarized as "a frontier model for 5.576M USD". Using the paper's own wording, critique this framing. What is and is not counted, and what is the fairer comparison?

    What a strong answer covers
    • The figure is 2.788M H800 GPU-hours × 2 USD per hour: 2,664K for pretraining, 119K for context extension, 5K for post-training.
    • The paper says it covers only the official training run and excludes prior research and ablations on architecture, algorithms and data.
    • It also excludes the cost of the R1 models used for distillation, data collection and the cluster itself.
    • The fair comparison is GPU-hours per trillion tokens for similar quality: 180K H800 GPU-hours per trillion tokens, which is much cheaper than dense 72B or 405B training.
    • The real lesson is efficiency from MoE sparsity, FP8 and communication overlap, not that frontier work is cheap overall.
  5. Design

    You are moving a 100B-scale MoE training run from BF16 to FP8 using DeepSeek-V3's recipe. List the choices you would copy and the tests you would run before committing.

    What a strong answer covers
    • Use E4M3 for all GEMM inputs with fine-grained scales: 1×128 tiles for activations and 128×128 blocks for weights.
    • Promote partial sums to FP32 on CUDA cores every N_C = 128 elements, because H800 FP8 accumulation keeps only about 14 bits (nearly 2% max relative error at K = 4096).
    • Keep embedding, output head, MoE gating, norms and attention in BF16 or FP32; keep FP32 master weights and gradients; store AdamW moments in BF16.
    • Test: run a matched BF16 baseline at small scale and check the relative loss gap stays under about 0.25%, as DeepSeek reports.
    • Watch for outlier activations and loss spikes, and log per-layer scale statistics.
  6. Connect

    Kimi K2 and GLM-4.5 both describe their architectures relative to DeepSeek-V3. Which V3 components did they keep and which did they change, and what does that say about which ideas transferred?

    What a strong answer covers
    • Kimi K2 follows a design similar to V3 with MLA, but uses 64 attention heads instead of 128 and more experts (384), with about 1.04T total and 32B active parameters.
    • GLM-4.5 keeps loss-free balance routing and sigmoid gates for its MoE layers but goes deeper with less width.
    • MLA, sigmoid-gated fine-grained MoE with shared experts, and loss-free balancing became a common open MoE template in 2025.
    • FP8 training and MTP spread more slowly, since they depend on custom kernels and serving support.

Done with this page?

Status