2405.04434-deepseek-v2-mla-moe-efficient-llm

DeepSeek V2: A Strong, Economical, and Efficient Mixture of Experts Language Model

DeepSeek-V2 最独立的贡献是 MLA (Multi-head Latent Attention,多头潜变量注意力):它把 generation cache 从完整 per-head K/V 改成由 hidden state 下投影得到的 512 维联合 KV latent 与 64 维 RoPE key,再用 projection absorption 让 latent 直接参与 content score 和 value aggregation,并用 decoupled RoPE 解除位置相关旋转对 absorption 的阻塞。模型同时把 DeepSeekMoE 扩展到 236B total / 21B active;论文报告的 42.5% 训练节省属于每 1T tokens H800 GPU-hours 口径,5.76 倍生成吞吐属于 MLA、FP8 weights、约 6-bit KV cache 和内部 serving stack 的组合结果。

Authors DeepSeek AI (group author);Appendix A 列出按三类角色分组的 156 位去重贡献者。

已审阅 Archived 2026-06-23 18:25 Updated 2026-07-16 12:25 Reviewed 2026-07-18 17:42 Source

Source

作者与关系

论文采用 DeepSeek-AI 团体署名,Appendix A 将 156 位去重姓名按 Research & Engineering、Data Annotation、Business & Compliance 分组。Wenfeng Liang 位于 Research & Engineering 名单,也是 arXiv submitter;Huazuo Gao 与 Wangding Zeng 被单独列为 MLA architecture innovations 的关键贡献者。四者同属 DeepSeek AI,当前档案中的 DeepSeekMoE、DeepSeek-V3、DeepSeek-R1 和 DeepSeek-V4 构成同一机构连续产出的直接方法谱系。

阅读目标与判断边界

归档关注:

  1. MLA 如何把长上下文服务中的 KV cache 从主要瓶颈降下来。
  2. DeepSeekMoE 如何把参数规模扩大到 236B total,同时保持 21B active 的训练和推理成本。
  3. DeepSeek-V2 到 V3/R1/V4 的架构连续性。
  4. 论文中的效率、能力和 RL alignment 证据强弱,以及公开 checkpoint 能复验到哪一层。

判断边界:

  • 论文是 2024 年技术报告;“top-tier”只按其 2024 年内部统一评测和当时模型集合解释。
  • 42.5% 是单位 token 训练 GPU-hours,93.3%5.76x 来自带量化的内部部署组合,不能视为 MLA 或 MoE 单组件的独立收益。
  • 训练数据、reward model 数据、HAI-LLM、内部 serving kernels 和完整部署参数没有开源;官方 Hugging Face reference attention 会缓存展开后的 per-head K/V,不能直接复现 latent-cache 路径。
  • 长上下文证据主要来自 NIAH 检索测试,复杂长文档推理和 agent trajectory 覆盖不足。
  • 论文使用 “open-source” 描述模型;本笔记按许可证与发布物将其称为 open-weight model。

术语预备

  • MHA (Multi-Head Attention,多头注意力): 每个 head 独立保存 key / value。
  • MQA (Multi-Query Attention,多查询注意力): 多个 query heads 共享 key / value,降低 KV cache。
  • GQA (Grouped-Query Attention,分组查询注意力): 在 MHA 和 MQA 之间折中。
  • RoPE (Rotary Position Embedding,旋转位置编码): 通过旋转变换编码 token 位置。
  • FFN (Feed-Forward Network,前馈网络): Transformer block 中 attention 后的前馈子层。
  • GRPO (Group Relative Policy Optimization,组相对策略优化): DeepSeekMath / DeepSeek-R1 线使用的 critic-free RL 方法。
  • ZeRO-1 (Zero Redundancy Optimizer stage 1,优化器状态切分): 数据并行中的 optimizer state partitioning。

论文脉络

1. 研究问题、背景和价值

大模型扩参会同时推高训练 FLOPs、推理 KV cache、长上下文内存成本和在线服务吞吐压力。Dense 67B 级模型在能力上已经有竞争力,但训练和服务成本很难继续线性扩展。DeepSeek-V2 的目标是在开放权重模型中同时追求能力、训练成本和推理效率。

2. 已有解决方案与不足

MHA 表达力强但 KV cache 重;MQA 和 GQA 通过共享 KV 降低缓存。论文自己的 7B、1.33T-token 消融在 BBH、MMLU、C-Eval、CMMLU 上观察到 MQA/GQA 低于 MHA,这一结果构成 MLA 的直接动机,结论范围限于该消融设置。传统 MoE 用稀疏激活降低 active compute,但会引入专家专门化不足、路由不均衡、跨设备通信和 token dropping 风险。DeepSeek-V2 把这两个成本中心分别拆开:attention 用 latent KV 压缩,FFN 用 DeepSeekMoE 扩大 total 参数并控制 active 参数。

3. 作者可能的思考路径

DeepSeek 67B 已经给出可用 dense baseline,继续扩大 dense model 会同时推高训练 FLOPs、KV cache、服务显存和吞吐成本。只把 FFN 换成 MoE 可以降低 active compute,但 decode 阶段的 KV cache 仍会限制在线服务;只用 MQA/GQA 压 KV,又会牺牲一部分 attention 表达。

因此 V2 的思路会先把成本中心拆开:attention 侧需要一种比 MQA/GQA 更保留表达力的 cache 压缩;FFN 侧可以继承 DeepSeekMoE 的 fine-grained experts / shared experts 来扩大 total capacity;路由和通信侧还要给 expert parallelism 加上扇出上限,否则 MoE 的 all-to-all 会吞掉稀疏激活节省下来的成本。

post-training 则沿用 DeepSeekMath 已验证的 GRPO 方向。V2 的问题在于让 MLA、DeepSeekMoE、device-limited routing 和 SFT/RL 在同一个 bilingual frontier-scale 模型上同时成立,单点算法创新只覆盖其中一层。

4. 核心假设或切入点

低秩联合压缩 KV 仍可保留强 attention 表达;RoPE 可以通过 decoupled key/query 分支保留位置能力;细粒度 routed experts 加 shared experts 能提升专家专门化;device-limited routing 与 balance losses 可以把 MoE 通信控制在可训练范围内。

5. 方法 / 系统 / 理论框架

MLA:从 per-head KV cache 到 latent KV cache

DeepSeek-V2 的设计先面对 decode 阶段的显存和带宽压力。标准 MHA (Multi-Head Attention,多头注意力) 在每个 token 上为每个 head 保存完整 key 和 value;序列越长,KV cache 越快变成服务吞吐瓶颈。MQA (Multi-Query Attention,多查询注意力)GQA (Grouped-Query Attention,分组查询注意力) 通过共享 KV 降低 cache,也减少了 KV 表达自由度。V2 新提出的 MLA (Multi-head Latent Attention,多头潜变量注意力) 选择另一条路线:先把当前 token 的 hidden state 下投影成一个低维 latent KV,再由这个 latent 生成各个 head 的 content key 和 value。优化后的推理路径缓存 compressed latent KV,避免保存展开后的多 head KV。V2 的配置是 60 layers、hidden size 5120、128 attention heads、content head dimension 128,KV compression dimension 512,query compression dimension 1536,decoupled RoPE dimension 64。

从部署视角看,MLA 由一条三阶段因果链组成:先把缓存表示从投影后的 per-head K/V 换成 ctKV=WDKVhtc_t^{KV}=W^{DKV}h_t;再通过 projection absorption 把 key up-projection 移到当前 query 侧、把 value up-projection 合并进 output projection,使历史 latent 无需展开;最后把 RoPE 放入独立的小型 position 分支,保持 content 路径可以继续做 absorption。这里缓存的是 hidden-derived latent,完整 ht:[5120]h_t:[5120] 在生成 ctKV:[512]c_t^{KV}:[512] 后不会作为历史状态保留。

Figure 2 把整套 architecture-system co-design 放在同一张数据流图中。下半部分的斜线节点标出 generation 时实际缓存的 ctKVc_t^{KV}ktRk_t^R,也显示 query latent、content/position 分支和最终 multi-head attention 的连接;上半部分显示 shared experts、routed experts 与 top-KrK_r router。它适合作为后续公式和 MoE 路由小节的结构索引。

Figure 2: DeepSeek-V2 architecture with MLA and DeepSeekMoE
Figure 2:DeepSeek-V2 架构示意图;MLA 通过压缩 generation KV cache 支持高效推理,DeepSeekMoE 通过稀疏架构控制训练成本。Image Source: official DeepSeek-V2 repository, commit ec98ee3.

按论文 Table 1 的 element-count 口径,MLA 每 token 的 cache 为:

CMLA=(dc+dhR)L=(512+64)×60=34,560, C_{\mathrm{MLA}}=(d_c+d_h^R)L=(512+64)\times 60=34{,}560,

同一 head/layer 配置的标准 MHA 为:

CMHA=2nhdhL=2×128×128×60=1,966,080. C_{\mathrm{MHA}}=2n_hd_hL=2\times128\times128\times60=1{,}966{,}080.

这个理论比较只计算元素数,MLA 相当于 2.25-group GQA;实际 byte 数还取决于 cache dtype、allocator metadata、page fragmentation 和 serving layout。query compression 主要降低训练 activation memory,不减少 autoregressive KV cache。

朴素 latent-KV 前向:仍需展开历史 K/V

先暂时忽略位置编码,只看低秩 Q/K/V 路径。以下统一采用列向量;WiUQW_i^{UQ}WiUKW_i^{UK}WiUVW_i^{UV} 表示相应矩阵切给第 ii 个 head 的 block。对第 tt 个 token 的 attention 输入 htRdh_t\in\mathbb{R}^{d},content query 路径是:

ctQ=WDQhtRdc,qt,iC=WiUQctQRdh. \begin{aligned} c_t^Q &= W^{DQ}h_t &&\in\mathbb{R}^{d_c'},\\ q_{t,i}^C &= W_i^{UQ}c_t^Q &&\in\mathbb{R}^{d_h}. \end{aligned}

key/value 路径先共享同一个 KV latent:

ctKV=WDKVhtRdc,kt,iC=WiUKctKVRdh,vt,iC=WiUVctKVRdh. \begin{aligned} c_t^{KV} &= W^{DKV}h_t &&\in\mathbb{R}^{d_c},\\ k_{t,i}^C &= W_i^{UK}c_t^{KV} &&\in\mathbb{R}^{d_h},\\ v_{t,i}^C &= W_i^{UV}c_t^{KV} &&\in\mathbb{R}^{d_h}. \end{aligned}

代入 V2 的实际维度,content 路径形成以下 bottleneck;表中省略 batch 和 sequence 维:

路径 维度变化 产生的张量
Attention 输入 - ht:[5120]h_t:[5120]
Query bottleneck 512015365120\rightarrow1536 ctQ:[1536]c_t^Q:[1536]
Content queries 1536128×1281536\rightarrow128\times128 qtC:[128,128]q_t^C:[128,128],共 16,384 elements
Joint KV bottleneck 51205125120\rightarrow512 ctKV:[512]c_t^{KV}:[512]
Content keys 512128×128512\rightarrow128\times128 ktC:[128,128]k_t^C:[128,128],共 16,384 elements
Content values 512128×128512\rightarrow128\times128 vtC:[128,128]v_t^C:[128,128],共 16,384 elements

ctKVc_t^{KV} 是所有 128 个 heads 共享的一份 512 维表示,它共同参数化逻辑上的 16,384 维 content keys 和 16,384 维 content values。若推理引擎只缓存 cjKVc_j^{KV},按上述朴素公式计算下一 token 时仍需为每个历史位置 jtj\le t 重新执行 WiUKcjKVW_i^{UK}c_j^{KV}WiUVcjKVW_i^{UV}c_j^{KV}。缓存目标已经变小,历史 K/V 展开计算仍然存在;projection absorption 用于消除这一步。

Projection absorption:把历史 key 展开移到当前 query

缓存 latent 只有在后续 Attention 可以直接使用它时才会转化为推理收益。上面的朴素前向仍需把每个历史 cjKVc_j^{KV} 展开成 per-head kj,iCk_{j,i}^Cvj,iCv_{j,i}^C;deployment path 利用矩阵乘法结合律重排计算。content score 可以写成:

(qt,iC)kj,iC=(qt,iC)WiUKcjKV=((WiUK)qt,iC)(q~t,iC)cjKV. \begin{aligned} (q_{t,i}^C)^\top k_{j,i}^C &=(q_{t,i}^C)^\top W_i^{UK}c_j^{KV}\\ &=\underbrace{\left((W_i^{UK})^\top q_{t,i}^C\right)^\top}_{(\widetilde q_{t,i}^C)^\top}c_j^{KV}. \end{aligned}

定义当前 token 的 absorbed query:

q~t,iC=(WiUK)qt,iC=(WiUK)WiUQWDQhtRdc, \widetilde q_{t,i}^C =(W_i^{UK})^\top q_{t,i}^C =(W_i^{UK})^\top W_i^{UQ}W^{DQ}h_t \in\mathbb{R}^{d_c},

content logit 便可直接作用于缓存中的 latent:

t,j,iC=(q~t,iC)cjKV. \ell_{t,j,i}^C=(\widetilde q_{t,i}^C)^\top c_j^{KV}.

value/output 侧也可以在 latent 空间完成。对任意一组 attention weights at,j,ia_{t,j,i},把 WOW^O 按 heads 分成 W1O,,WnhOW_1^O,\ldots,W_{n_h}^O,并定义:

zt,i=j=1tat,j,icjKVRdc,ot,i=WiUVzt,i,W~iO=WiOWiUV, z_{t,i}=\sum_{j=1}^{t}a_{t,j,i}c_j^{KV}\in\mathbb{R}^{d_c},\qquad o_{t,i}=W_i^{UV}z_{t,i},\qquad \widetilde W_i^O=W_i^OW_i^{UV},

就有:

ut=i=1nhWiOot,i=i=1nhWiOWiUV(j=1tat,j,icjKV)=i=1nhW~iOzt,i. \begin{aligned} u_t &=\sum_{i=1}^{n_h}W_i^Oo_{t,i}\\ &=\sum_{i=1}^{n_h}W_i^OW_i^{UV} \left(\sum_{j=1}^{t}a_{t,j,i}c_j^{KV}\right)\\ &=\sum_{i=1}^{n_h}\widetilde W_i^Oz_{t,i}. \end{aligned}

到这里,content K/V 已经无需按历史 token 物化。这个代数重排仍缺少位置编码,RoPE 正是在下一步出现的关键障碍。

RoPE 为何阻塞 projection absorption

标准 RoPE 会分别旋转当前位置 query 与历史位置 key。若直接把它施加在 content 分支,content score 变为:

(Rtqt,iC)(Rjkj,iC)=(qt,iC)RtRjWiUKcjKV. \begin{aligned} (R_tq_{t,i}^C)^\top(R_jk_{j,i}^C) &=(q_{t,i}^C)^\top R_t^\top R_jW_i^{UK}c_j^{KV}. \end{aligned}

RjR_j 随历史位置 jj 变化,并且位于 query 与 WiUKW_i^{UK} 之间。此时 (WiUK)qt,iC(W_i^{UK})^\top q_{t,i}^C 无法成为只对当前 token 计算一次的固定 absorbed query;推理引擎需要恢复或预存带位置旋转的历史 content keys,latent cache 的高效路径由此中断。

Decoupled RoPE:把位置能力移到独立小分支

V2 让 content Q/K 保持无 RoPE 的可吸收结构,再增加 head-specific RoPE queries 与所有 heads 共享的 RoPE key:

qt,iR=RoPEt ⁣(WiQRctQ)RdhR,ktR=RoPEt ⁣(WKRht)RdhR. \begin{aligned} q_{t,i}^R &=\operatorname{RoPE}_t\!\left(W_i^{QR}c_t^Q\right) &&\in\mathbb{R}^{d_h^R},\\ k_t^R &=\operatorname{RoPE}_t\!\left(W^{KR}h_t\right) &&\in\mathbb{R}^{d_h^R}. \end{aligned}

每个 head 的逻辑 query/key 是两个子空间的拼接:

qt,i=[qt,iC;qt,iR],kj,i=[kj,iC;kjR]. q_{t,i}=[q_{t,i}^C;q_{t,i}^R],\qquad k_{j,i}=[k_{j,i}^C;k_j^R].

content 与 position 两个 dot products 在同一次 Softmax 前相加。把 content key projection 吸收后,最终 logit 与权重为:

t,j,i=(q~t,iC)cjKVabsorbed content logit+(qt,iR)kjRposition logitdh+dhR,at,j,i=Softmaxjt(t,j,i). \ell_{t,j,i} =\frac{ \underbrace{(\widetilde q_{t,i}^C)^\top c_j^{KV}}_{\text{absorbed content logit}} +\underbrace{(q_{t,i}^R)^\top k_j^R}_{\text{position logit}} }{\sqrt{d_h+d_h^R}}, \qquad a_{t,j,i}=\operatorname{Softmax}_{j\le t}(\ell_{t,j,i}).

两个 logits 相加后产生的一组权重继续用于前一节的 latent aggregation zt,i=jat,j,icjKVz_{t,i}=\sum_j a_{t,j,i}c_j^{KV}。RoPE 只进入 64 维 position 分支,content 路径中的 projection absorption 因而保持成立;generation cache 需要在 512 维 ctKVc_t^{KV} 之外再保存 64 维 ktRk_t^R

完整 absorbed decode:维度、缓存与计算顺序

把 V2 的实际超参数代入,position 分支新增的维度是:

路径 维度变化 产生的张量 Generation cache
RoPE queries 1536128×641536\rightarrow128\times64 qtR:[128,64]q_t^R:[128,64],共 8,192 elements
Shared RoPE key 5120645120\rightarrow64 ktR:[64]k_t^R:[64],所有 heads 共享 是,64 elements

结合前面的 content 路径,query 会在当前 step 使用后释放;历史 token 只留下 ctKV:[512]c_t^{KV}:[512]ktR:[64]k_t^R:[64]

128×128K+128×128V=32,768512cKV+64kR=576. \underbrace{128\times128}_{K} +\underbrace{128\times128}_{V} =32{,}768 \quad\longrightarrow\quad \underbrace{512}_{c^{KV}} +\underbrace{64}_{k^R} =576.

单层缓存元素数变为标准 MHA 的 576/32,7681.76%576/32{,}768\approx1.76\%,即约缩小 56.9 倍。51205125120\rightarrow512 描述 hidden-to-latent 的 10 倍 bottleneck;56.9 倍才是与标准 MHA per-head K/V cache 对齐后的缓存压缩比例。

设当前 prefix 长度为 TT,optimized decode 依次执行以下矩阵运算:

步骤 矩阵 shape 输出 shape
Content logits Q~tC:[128,512]  (C1:TKV):[512,T]\widetilde Q_t^C:[128,512]\ \cdot\ (C_{1:T}^{KV})^\top:[512,T] LtC:[128,T]L_t^C:[128,T]
Position logits QtR:[128,64]  (K1:TR):[64,T]Q_t^R:[128,64]\ \cdot\ (K_{1:T}^{R})^\top:[64,T] LtR:[128,T]L_t^R:[128,T]
合并与 Softmax Softmax(LtC+LtR)\operatorname{Softmax}(L_t^C+L_t^R) At:[128,T]A_t:[128,T]
Latent value aggregation At:[128,T]  C1:TKV:[T,512]A_t:[128,T]\ \cdot\ C_{1:T}^{KV}:[T,512] Zt:[128,512]Z_t:[128,512]
Absorbed output 每个 zt,i:[512]z_{t,i}:[512]W~iO:[5120,512]\widetilde W_i^O:[5120,512] 后跨 heads 求和 ut:[5120]u_t:[5120]

对照标准 MHA,历史 K/V cache 分别是 [T,128,128][T,128,128];MLA 的两份历史状态是 C1:TKV:[T,512]C_{1:T}^{KV}:[T,512]K1:TR:[T,64]K_{1:T}^R:[T,64]。attention logits 和 weights 仍为 [128,T][128,T],所以 head 数和历史位置数没有压缩;发生压缩的是被所有 heads 共享的持久 K/V 表示。absorbed content score 和 latent value aggregation 对每个 head 使用 512 维 latent,标准 MHA 的对应 head dimension 是 128,因此 attention arithmetic 未必更少。系统收益主要来自历史状态读取量、可容纳 batch/context 和 memory-bound decode,仍保留 O(T)O(T) decode 历史扫描与 O(T2)O(T^2) prefill attention。

论文的优化路径与公开 reference path 需要分开理解。Appendix C 说明 serving engine 应缓存 ctKVc_t^{KV}ktRk_t^R,并将 WUKW^{UK}WUVW^{UV} 吸收到 query/output 侧。官方 Hugging Face modeling_deepseek.py 的 eager attention 先通过 kv_b_proj 展开 k_nopevalue_states,随后把展开后的 key_states / value_states 交给标准 past_key_value.update。因此该 reference path 可以加载和运行 checkpoint,却没有直接实现论文的 compressed latent cache;论文吞吐需要内部 kernels 或支持 MLA absorption/cache layout 的 serving engine。

证据定位:Section 2.1,Equations 1–17;Table 1;Appendix C,Equations 26–36;official Hugging Face modeling_deepseek.py:1570-1633

DeepSeekMoE FFN:扩大 total capacity 并控制 active compute

FFN 侧的压力从参数容量转到路由可运行性。V2 沿用并规模化 DeepSeekMoE:除第一层外,Transformer block 的 FFN 都换成稀疏专家层,每层包含 2 个 shared experts 和 160 个 routed experts,每个 token 激活 6 个 routed experts。shared experts 处理所有 token,吸收通用模式;routed experts 只处理被 gate 选中的 token,扩大 total capacity 并保持 active compute 可控。对第 tt 个 token,论文把 MoE-FFN 写成:

ht=ut+i=1NsFFNi(s)(ut)+i=1Nrgi,tFFNi(r)(ut),si,t=Softmaxi(utei). h'_t = u_t + \sum_{i=1}^{N_s}\mathrm{FFN}^{(s)}_i(u_t) + \sum_{i=1}^{N_r} g_{i,t}\mathrm{FFN}^{(r)}_i(u_t), \quad s_{i,t}=\mathrm{Softmax}_i(u_t^\top e_i).

其中 gi,tg_{i,t} 只在 affinity score si,ts_{i,t} 进入 top-KrK_r routed experts 时保留,其他专家 gate 置零。V2 的具体配置是 Ns=2N_s=2Nr=160N_r=160Kr=6K_r=6,每个 expert 的 intermediate hidden dimension 为 1536,最终形成 236B total / 21B active 参数。

Device-limited routing:限制 MoE 通信扇出

直接 top-KK 路由会把每个 token 发往若干专家;在 expert parallelism 下,通信频次取决于这些专家覆盖了多少设备。DeepSeekMoE 的 fine-grained expert segmentation 提高了专家专门化,也会让跨设备扇出更容易成为瓶颈。V2 加入 device-limited routing:对每个设备取其最高 expert affinity,先选得分最高的 MM 个设备,再只在这些设备上的 experts 中做 top-KrK_r 选择。训练中 routed experts 均匀部署到 D=8D=8 个设备,M=3M=3,因此单个 token 的 MoE all-to-all 扇出有硬上限。论文文字称 M3M\ge 3 时能力大致贴近 unrestricted top-KK,但没有给出独立消融表或通信吞吐曲线。

Balance losses:同时约束专家、设备和接收端

路由受限只能约束发送端扇出,负载仍可能集中到少数 experts、少数设备或少数接收端。V2 因此叠加三类 balance loss。expert-level balance loss 约束专家使用:

LExpBal=α1i=1NrfiPi,fi=NrKrTt=1T1{ti},Pi=1Tt=1Tsi,t. \mathcal{L}_{\mathrm{ExpBal}} = \alpha_1 \sum_{i=1}^{N_r} f_iP_i,\quad f_i=\frac{N_r}{K_rT}\sum_{t=1}^{T}\mathbb{1}\{t\to i\},\quad P_i=\frac{1}{T}\sum_{t=1}^{T}s_{i,t}.

device-level balance loss 把专家负载聚合到设备组 Ei\mathcal{E}_i,约束不同设备的计算量:

LDevBal=α2i=1DfiPi,fi=1EijEifj,Pi=jEiPj. \mathcal{L}_{\mathrm{DevBal}} = \alpha_2 \sum_{i=1}^{D} f'_iP'_i,\quad f'_i=\frac{1}{|\mathcal{E}_i|}\sum_{j\in\mathcal{E}_i}f_j,\quad P'_i=\sum_{j\in\mathcal{E}_i}P_j.

communication balance loss 进一步约束接收端通信量:

LCommBal=α3i=1DfiPi,fi=DMTt=1T1{tEi},Pi=jEiPj. \mathcal{L}_{\mathrm{CommBal}} = \alpha_3 \sum_{i=1}^{D} f''_iP''_i,\quad f''_i=\frac{D}{MT}\sum_{t=1}^{T}\mathbb{1}\{t\to \mathcal{E}_i\},\quad P''_i=\sum_{j\in\mathcal{E}_i}P_j.

其中 TT 是一个序列内的 token 数。device-limited routing 保证每个设备最多发送约 MTMT 个 hidden states,communication balance loss 鼓励每个设备也接收约 MTMT 个 hidden states。V2 的 balance factors 是 α1=0.003\alpha_1=0.003α2=0.05\alpha_2=0.05α3=0.02\alpha_3=0.02

Token dropping:用训练期硬容量处理短时过载

balance loss 仍是软约束,训练中还会出现短时负载偏斜。V2 用 device-level token dropping 处理这个尾部成本:先按设备计算平均计算预算,相当于 capacity factor 为 1.0;每个设备上超出预算时,丢弃 affinity score 最低的 token,直到回到预算内。为了保留完整序列监督,约 10% training sequences 的 token 永远不丢。论文的正式评测阶段不丢 token,训练阶段使用 token dropping 主要服务加速。

Training system:让并行策略配合 MLA/MoE

训练系统的配置服务于这套 MoE/MLA 结构。数字密集部分按新 SOP 拆成表格。

维度 配置
训练框架 DeepSeek HAI-LLM internal framework
训练硬件 H800 cluster;每节点 8 GPUs,节点内 NVLink/NVSwitch,节点间 InfiniBand;完整 GPU/节点总数未披露
并行方式 16-way zero-bubble pipeline parallelism;8-way expert parallelism;ZeRO-1 optimizer-state partitioning
Tensor parallelism 训练阶段不使用 TP;部分 operators recompute 以节省 activation memory
通信 / kernel shared experts 计算与 expert parallel all-to-all overlap;定制 communication、routing、multi-expert fused linear CUDA kernels;改进版 FlashAttention-2
维度 配置
Tokenizer BBPE (Byte-level Byte-Pair Encoding,字节级 BPE);vocab 100K
Pretraining data 8.1T bilingual / multi-source tokens;中文 token 数约比英文多 12%;具体来源比例、许可与 benchmark contamination 审计未披露
Sequence / batch sequence length 4K;前 225B tokens 将 batch size 从 2304 ramp 到 9216,随后保持 9216
Optimizer AdamW;beta1 0.9;beta2 0.95;weight decay 0.1;max LR 2.4e-4;2K warmup;约 60% 与 90% tokens 处各乘 0.316;gradient clip 1.0
训练时间 / 成本 每 1T tokens 训练 172.8K H800 GPU hours;MFU 数值、完整 wall-clock、失败实验、长上下文/SFT/RL 增量和总美元成本未披露

效率数字的三种口径

论文把 architecture、quantization 和 internal runtime 的收益集中展示,重审时需要拆成三个口径:

论文数字 直接测量对象 最窄解释
训练成本降低 42.5% 每训练 1T tokens,DeepSeek-V2 为 172.8K H800 GPU-hours,DeepSeek 67B 为 300.6K 同一组织内部的单位 token 训练成本;8.1T 主训练按线性外推约为 1.40M H800 GPU-hours,仍未包含完整项目成本
KV cache 减少 93.3% 实际部署 DeepSeek-V2 相对 DeepSeek 67B bundled result;V2 同时使用 MLA 和平均约 6-bit/element KV quantization,论文没有给出该生产数字的逐组件分解
最大生成吞吐 5.76x 单节点 8×H800;V2 weights 转 FP8,KV 约 6-bit;prompt/output length 来自已部署 DeepSeek 67B 流量分布 内部 serving workload 的 maximum throughput;论文未披露 baseline precision、batch size、latency SLO、软件版本和完整吞吐曲线

42.5% 不能直接表述为完整预训练 run 或总研发成本下降;5.76x 也不能直接外推到 latency、低 batch、BF16 reference implementation 或其他服务流量。证据定位:Section 3.2.3;Figure 1。

Long context:YaRN 只作用在 position 分支

长上下文扩展的关键在 position 分支。MLA 已经把 content 分支和 RoPE position 分支拆开,所以 YaRN 只需要作用到承载 RoPE 的 decoupled shared key ktRk_t^R,content latent KV 路径继续保持 cache 压缩结构。V2 用 YaRN 将默认 4K context 扩展到 128K,设置 scale s=40s=40α=1\alpha=1β=32\beta=32,target maximum context length 160K。由于 MLA attention 结构和原始 YaRN 假设存在差异,V2 额外调整 length scaling factor 来控制 attention entropy,论文给出的形式是 t=0.0707lns+1\sqrt{t}=0.0707\ln{s}+1。长上下文继续训练只跑 1000 steps,sequence length 32K,batch 576;评测在 128K NIAH 上显示可用。

Post-training:SFT 与两阶段 GRPO

Chat 后训练先用 1.5M instruction instances 做 SFT (Supervised Fine-Tuning,监督微调),其中 1.2M helpfulness、0.3M safety,训练 2 epochs,learning rate 5×1065\times10^{-6}。随后使用 GRPO (Group Relative Policy Optimization,组相对策略优化) 降低 RL 成本:它省去与 policy 同规模的 critic,让同一 prompt 的一组 sampled outputs 彼此提供 baseline。对问题 qq,旧策略 πθold\pi_{\theta_{\mathrm{old}}} 采样 {oi}i=1G\{o_i\}_{i=1}^{G},advantage 用组内 reward 标准化:

Ai=rimean({r1,,rG})std({r1,,rG}). A_i=\frac{r_i-\mathrm{mean}(\{r_1,\ldots,r_G\})} {\mathrm{std}(\{r_1,\ldots,r_G\})}.

策略更新使用 clipped ratio 加 reference KL penalty:

min ⁣(πθ(oiq)πθold(oiq)Ai,clip ⁣(πθ(oiq)πθold(oiq),1ϵ,1+ϵ)Ai)βDKL(πθπref). \min\!\left( \frac{\pi_\theta(o_i|q)}{\pi_{\theta_{\mathrm{old}}}(o_i|q)}A_i,\, \mathrm{clip}\!\left( \frac{\pi_\theta(o_i|q)}{\pi_{\theta_{\mathrm{old}}}(o_i|q)},1-\epsilon,1+\epsilon \right)A_i \right) -\beta D_{\mathrm{KL}}(\pi_\theta\|\pi_{\mathrm{ref}}).

论文中的 KL 项采用基于 ratio 的正向 KL 估计形式:

DKL(πθπref)=πref(oiq)πθ(oiq)logπref(oiq)πθ(oiq)1. D_{\mathrm{KL}}(\pi_\theta\|\pi_{\mathrm{ref}}) = \frac{\pi_{\mathrm{ref}}(o_i|q)}{\pi_\theta(o_i|q)} -\log\frac{\pi_{\mathrm{ref}}(o_i|q)}{\pi_\theta(o_i|q)} -1.

RL 分两阶段。第一阶段是 reasoning alignment,针对 code/math prompt 训练 RMreasoningRM_{\mathrm{reasoning}},令 ri=RMreasoning(oi)r_i=RM_{\mathrm{reasoning}}(o_i);论文强调数学和代码能力可在更长 RL steps 中继续提升。第二阶段是 human preference alignment,用 helpful、safety、rule 三类 reward 合成最终反馈:

ri=c1RMhelpful(oi)+c2RMsafety(oi)+c3RMrule(oi). r_i=c_1RM_{\mathrm{helpful}}(o_i) +c_2RM_{\mathrm{safety}}(o_i) +c_3RM_{\mathrm{rule}}(o_i).

reward model 从 DeepSeek-V2 Chat SFT 初始化,并用 point-wise 或 pair-wise loss 训练;代码偏好数据依赖 compiler feedback,数学偏好数据依赖 ground-truth labels。RL 系统侧采用 hybrid engine,训练和推理使用不同并行策略,rollout 后端使用 vLLM 大 batch 推理,并通过 CPU/GPU offload 调度平衡训练速度和显存占用。需要保留的边界是:论文披露了 GRPO 目标和 reward 来源,但没有完整给出 group size、ϵ/β\epsilon/\beta 实际值、reward coefficients、reward 数据规模、rollout 数量或 RL compute。GRPO 已由 DeepSeekMath 提出,V2 的新增价值主要是把它扩展到 236B MoE 的两阶段 alignment 和 hybrid-engine 训练,不宜将其列为本文的主算法创新。

6. 结论链条

论文的因果链条可以收紧为三层:MLA 压缩 decode-time persistent state;DeepSeekMoE 配合 device-limited routing、balance losses 和 token dropping 控制 active compute 与 expert-parallel communication;内部训练/serving kernels 把结构优势转成 GPU-hours 与 throughput。SFT/GRPO 负责 Chat checkpoint 的能力分布,属于完整模型交付的一部分。论文证据支持这套组合在其 H800/internal-stack 环境成立,尚未把各组件对端到端吞吐的贡献完全拆开。

关键实验/定理

结果 1:base model 的 2024 年能力位置

  • 设置:DeepSeek 内部统一评测框架;DeepSeek-V2 与 DeepSeek 67B、Qwen1.5 72B、Mixtral 8x22B、LLaMA3 70B 使用相同 few-shot/evaluation setting。
  • Baseline:2024 年 5 月可用的四个代表性 open-weight models。
  • 指标:英文理解、代码、数学和中文 benchmark;重点包括 MMLU、MATH、C-Eval、CMMLU。
  • 结果:DeepSeek-V2 为 MMLU 78.5、MATH 43.6、C-Eval 81.7、CMMLU 84.0;它显著高于 DeepSeek 67B,多数中文指标领先该表,其 BBH、MMLU、DROP、commonsense/QA 等多项英文指标仍低于 LLaMA3 70B。
  • 证据定位:Section 3.2.1–3.2.2;Table 2。
  • 对照是否可比:评测 harness 和 shot 数对齐;训练 tokens、数据组成、tokenizer、total parameters、active parameters 与训练 compute 均未对齐。MoE 的 21B active parameters 也不能单独代表总容量或真实 FLOPs/communication。
  • 支持的最窄结论:DeepSeek-V2 在论文选取的 2024 年模型集合中,以较低 active parameter count 获得有竞争力的双语、数学和代码能力;证据不足以支持跨时代或 compute-normalized 的“最强模型”判断。
  • 解读:优势集中在相对 DeepSeek 67B 的全面提升、中文任务和部分数学/代码任务;LLaMA3 70B 仍展示更强的多项英文基础能力。

结果 2:训练与推理效率来自整套内部系统

  • 设置:训练成本按 H800 cluster 上每 1T tokens 的实际 GPU-hours 统计;推理在单节点 8×H800 上使用 FP8 weights、平均约 6-bit KV cache,并按已部署 DeepSeek 67B 的 prompt/generation length 分布测量。
  • Baseline:DeepSeek 67B dense model 及其内部 deployment。
  • 指标:每 1T tokens H800 GPU-hours、deployed KV cache、maximum generation throughput、prompt throughput。
  • 结果:
指标 DeepSeek-V2 DeepSeek 67B baseline
每 1T tokens 训练 172.8K H800 GPU-hours 300.6K H800 GPU-hours
单位 token 训练降幅 42.5% 0%
Deployed KV cache 作者报告减少 93.3% 1.00x
单节点最大生成吞吐 >50K tokens/s;5.76x baseline 1.00x
Prompt throughput >100K tokens/s 未披露
  • 证据定位:Section 3.2.3;Figure 1;Conclusion。
  • 对照是否可比:同一组织、硬件代际和真实流量分布增强了内部可比性;baseline precision、quantization、batch、latency SLO、software/kernel version 和 throughput curve 未披露,外部无法重建完整 protocol。
  • 支持的最窄结论:MLA、sparse MoE、量化和 internal kernels 的组合在 DeepSeek 的 H800 stack 上显著降低单位 token 训练成本并提高 maximum throughput。
  • 解读:这是系统 bundle 的证据。它支持 V2 的 architecture-system co-design,无法分辨 MLA、MoE、FP8、6-bit KV 和 runtime 各自贡献多少,也没有证明低并发 latency 或总项目成本同比下降。

结果 3:MLA 消融支持 cache-quality trade-off

  • 设置:Table 8 用约 7B dense models、1.33T tokens 比较 MQA、8-group GQA、MHA;Table 9 用约 16B total/1.33T-token 与约 250B total/420B-token 两组 MoE models 比较 MLA、MHA。
  • Baseline:MHA、MQA、8-group GQA。
  • 指标:每 token、跨全部 layers 的 KV cache element count,以及 BBH、MMLU、C-Eval、CMMLU。
  • 结果:7B MHA 在四项 benchmark 均高于 MQA/GQA。large-MoE MLA 的 cache 为 34.6K elements/token,MHA 为 860.2K,即约 4.0%;MLA 在 BBH 50.7 vs 46.6、MMLU 59.0 vs 57.5、C-Eval 59.2 vs 57.9、CMMLU 62.5 vs 60.7 上更高。small-MoE MLA cache 为 MHA 的约 14%,三项更高,C-Eval 为 50.9 vs 51.6。
  • 证据定位:Appendix D.1–D.2;Tables 8–9。
  • 对照是否可比:训练 token 数和模型族内设置接近;7B attention variants 为对齐参数量调整了 layer count,large MLA/MHA active parameters 为 21.5B vs 25.0B、total parameters 为 247.4B vs 250.8B,仍有结构与 compute 差异。论文没有报告 seeds、误差线或该 ablation 的端到端 serving throughput。
  • 支持的最窄结论:在两档 MoE 规模和四个 benchmark 上,MLA 大幅降低理论 cache element count,并维持相近或更高的 benchmark scores。
  • 解读:该实验直接支撑“cache 压缩不必复现 MQA/GQA 的能力下降”;它还不能独立支撑 5.76x throughput,也不能证明 MLA 在所有任务上严格优于 MHA。

结果 4:128K 证据只覆盖 needle retrieval

  • 设置:4K pretraining 后应用 YaRN;额外训练 1000 steps,sequence length 32K、batch 576,再外推评测到 128K。
  • Baseline:原始 4K positional setting;论文没有提供同等训练预算的其他 long-context method。
  • 指标:Needle In A Haystack retrieval accuracy。
  • 结果:Figure 4 的多数 sampled context-length/depth cells 得分为 10;约 35K 的中部与较深位置、约 104K 的中部位置出现局部低分,结果包含少量非满分测试点。
  • 证据定位:Section 3.1.4;Figure 4。
  • 对照是否可比:属于单模型 capability check,缺少 long-context baseline、perplexity、multi-needle、长文档 QA、代码仓库理解和端到端 serving cost。
  • 支持的最窄结论:YaRN-adjusted checkpoint 在该 NIAH protocol 的多数采样位置上把单条信息检索扩展到 128K,同时保留少量 length/depth-sensitive failures。
  • 解读:该证据覆盖位置外推和简单检索;局部低分说明“128K support”适合解释为多数 NIAH 位置可检索,复杂推理质量仍未被该实验覆盖。
Figure 4: DeepSeek-V2 Needle In A Haystack evaluation through 128K
Figure 4:DeepSeek-V2 在不同 context length 与 document depth 下的 Needle In A Haystack 测试。Image Source: official DeepSeek-V2 repository, commit ec98ee3.

结果 5:RL checkpoint 改变了能力分布

  • 设置:同一 DeepSeek-V2 Chat 的 SFT 与 RL checkpoints,并与 Qwen1.5、Mixtral、LLaMA3、DeepSeek 67B Chat 比较。
  • Baseline:最直接 baseline 是 DeepSeek-V2 Chat (SFT);外部模型用于同期位置参考。
  • 指标:standard benchmarks、MT-Bench、AlpacaEval 2.0 length-controlled win rate、AlignBench。
  • 结果:SFT -> RL 后,HumanEval 76.8 -> 81.1、LiveCodeBench 28.7 -> 32.5、MATH 52.7 -> 53.9、MT-Bench 8.62 -> 8.97、AlpacaEval 30.0 -> 38.9、AlignBench 7.74 -> 7.91;同时 BBH 81.3 -> 79.7、MMLU 78.4 -> 77.8、C-Eval 80.9 -> 78.0、CMMLU 82.4 -> 81.6。
  • 证据定位:Section 4.2–4.4;Tables 3–5。
  • 对照是否可比:SFT/RL checkpoint 对照较直接;缺少多 seed、judge variance、reward/rollout 数据规模和 GRPO hyperparameters,也没有展示 online-vs-offline RL 数值对照。
  • 支持的最窄结论:论文的两阶段 GRPO pipeline 提高了该 checkpoint 的开放生成、代码与数学指标,同时带来部分标准 benchmark 下降。
  • 解读:结果支持存在 alignment trade-off;它没有隔离 GRPO、reward data、online sampling 或系统优化中哪一项产生提升。

实验设置与 baseline 审计

维度 记录
评测协议 Base models 使用 DeepSeek 内部统一 harness;perplexity-based 与 generation-based tasks 混合;chat 另用 MT-Bench、AlpacaEval 2.0、AlignBench
统计报告 缺少 seed、误差线、置信区间和显著性检验;latency/throughput 只有 point estimates
Baseline 是否 tuned 论文称统一 setting;未报告为每个外部模型单独调 prompt、decoding 或 tokenizer-specific format
Baseline 是否 compute-matched 否;模型训练 tokens、总参数、激活参数、数据和训练 FLOPs 均不同。MLA ablation 仅近似匹配参数规模
Baseline 是否 implementation-matched 能力表使用同一内部 harness;效率表都来自 DeepSeek 内部系统,但 baseline precision、kernel、quantization 与 batch policy 未完整披露
Baseline 是否覆盖强替代方案 2024 年能力 baseline 较强;attention ablation 覆盖 MHA/MQA/GQA;缺少同硬件的其他 MoE serving、PagedAttention/GQA optimized runtime 和完整长上下文 baseline
Baseline 是否存在弱化风险 7B attention ablation 通过改变 layer count 对齐参数;外部 chat model 可能受 format compliance 影响,论文也承认 TriviaQA/NQ 的格式问题
结论边界 支持 DeepSeek 内部 H800 stack 和 2024 模型集合下的结果;不能外推到所有 serving engine、并发度、cache dtype 或当前模型生态
模型与初始化 236B total / 21B active DeepSeek-V2;Lite 版本 15.7B total / 2.4B active
数据与任务 8.1T bilingual/multi-source pretraining tokens;中文约比英文多 12%;SFT 1.5M instances,其中 helpfulness 1.2M、safety 0.3M
RL / 训练配置 GRPO;reasoning alignment 后接 human-preference alignment;reasoning/helpful/safety/rule rewards;group size、clip/KL values、reward coefficients、rollout 数和 RL compute 未披露
系统配置 H800;16-way zero-bubble pipeline、8-way expert parallel、ZeRO-1;无 TP;shared-expert compute/all-to-all overlap;custom communication/routing/fused-expert kernels;改进 FlashAttention-2
框架基座 / paper base Pretraining 基于内部 HAI-LLM;RL rollout 使用 vLLM large-batch inference,训练/推理采用不同 parallel strategy,并有 CPU/GPU model offload scheduler;serving 使用未公开 internal runtime
框架版本与证据来源 HAI-LLM、vLLM、CUDA/FlashAttention 版本和 internal commit 均未披露;official repository commit ec98ee3 主要提供报告、模型入口、运行说明和许可证
框架改动范围 论文称新增或定制 zero-bubble pipeline、communication/routing/fused-expert kernels、MLA FlashAttention-2 path、RL hybrid engine 与 offload scheduling;实现未随报告完整发布
技术报告训练配置 60 layers、hidden 5120、8.1T tokens、sequence 4K、batch 2304 -> 9216、max LR 2.4e-4;长上下文训练 1000 steps、32K sequences、batch 576
训练硬件与拓扑 H800 cluster;每节点 8 GPUs,节点内 NVLink/NVSwitch,节点间 InfiniBand;总节点/GPU 数未披露
训练时间 / GPU hours / 成本 172.8K H800 GPU-hours / 1T tokens;完整主训练线性外推约 1.40M;长上下文、SFT、RL、失败实验、wall-clock 和美元成本未披露
未披露项 MFU 数值、token dropping rate、expert load/communication distribution、完整数据来源与 contamination audit、生产 batch/SLO、RL 数据与 compute

证据链强度评估

强证据

  • MLA 的 cached-state 公式、维度和 projection absorption 在 Section 2.1 与 Appendix C 中完整给出;released config 与 512/1536/64 dimensions 对齐。
  • Appendix D 在两档 MoE 规模上比较 MLA/MHA,并报告 element-count 与四项能力指标,直接支持 cache-quality trade-off。
  • 236B/21B-active、8.1T tokens、专家配置、parallel strategy 和单位 token GPU-hours 都有明确表述;V2/V2-Lite weights 可检查模型结构和 checkpoint 行为。

中等强度证据

  • 42.5% unit-training-cost、93.3% deployed-cache 与 5.76x maximum-throughput 来自内部实际系统,但缺少复现实验所需的 baseline precision、kernel version、batch/SLO 与逐组件消融。
  • Base-model 表在统一 harness 下覆盖较多任务;模型之间的数据、compute、参数和 tokenizer 不匹配。
  • RL preference alignment 有同 family checkpoint 对照,GRPO 目标和 reward 类型已披露;group size、实际 KL/clip、reward coefficients、数据规模和 judge variance 仍缺。

需要谨慎的推论

  • 将每 1T tokens 的 42.5% 降幅写成完整训练 run、总美元成本或研发成本下降。
  • 将内部 bundled throughput 归因给 MLA 单组件,或外推到低 batch latency、其他硬件与朴素 Transformers path。
  • 将 NIAH 的 128K retrieval 外推为复杂长文档推理能力。
  • 在线 RL 优于离线 RL、GRPO 优于其他 RL algorithms,以及与闭源/API 模型的泛化比较。

OpenReview / 审稿意见吸收

  • Page type: metadata-only
  • Match confidence: high
  • Observed at: 2026-07-14
  • Venue status: CoRR / arXiv technical report;OpenReview URL 与标题、arXiv id 匹配,未显示会议审稿 invitation。
  • Public reviews: 未发现 official review;当前页面/API 访问触发 challenge verification,因此没有把不可读取的 reply count 当作本次新证据。
  • Ratings / confidence: 未发现。
  • Reviewer consensus: 未发现。
  • Main criticisms: 无公开 reviewer comments;本地审计集中在效率口径、baseline matching、公开实现差距、长上下文证据和 RL 细节缺口。
  • Author response: 未发现。
  • 对可信度的影响: 可作为 MLA 与 DeepSeek-V2 系统设计的原始报告使用;正式同行评审和独立系统复现证据仍缺。

本地讨论补充

1. 核心贡献的层级

MLA 是本文最独立的新架构贡献;DeepSeekMoE 来自前作,V2 的贡献在于将其扩展到 236B total parameters,并补齐 device-limited routing、三类 balance loss、token dropping 和 expert-parallel kernels;GRPO 来自 DeepSeekMath,V2 展示了 236B MoE 上的 reasoning-first / preference-second alignment 与 hybrid engine。用这个层级阅读,可以避免把所有组件都写成同等 novelty。

2. “Economical”首先是单位 token 口径

172.8K vs 300.6K H800 GPU-hours 比较的是每 1T training tokens。V2 主预训练使用 8.1T tokens,按同一速率线性外推约为 1.40M H800 GPU-hours;完整投入还包括数据处理、失败实验、long-context extension、SFT、reward models 和 RL。论文的经济性结论适合写成“更低的单位 token active-compute cost”,完整训练项目总成本没有披露。

3. MLA 的主线是缓存表示替换

标准 MHA 保存 WKhtW^Kh_tWVhtW^Vh_t 生成的完整 per-head K/V。MLA 保存 ctKV=WDKVhtc_t^{KV}=W^{DKV}h_t 这一份 512 维、K/V 与 heads 共享的 compressed precursor,以及 64 维 shared RoPE key。把它口语化为“存 hidden state”可以抓住缓存位置向投影前移动的方向;精确表述应使用“存 hidden-derived KV latent”,因为完整 hidden state 有 5120 维,MLA 只保留任务相关的 learned low-rank projection。

缓存替换只有在历史 latent 无需重新展开时才能转化为推理收益。projection absorption 负责重排 content K/V 的矩阵乘法;decoupled RoPE 负责把 position-dependent transform 移出 content 路径,使这种重排持续成立。因此三者的层级是“缓存表示替换”作为目标,“projection absorption + decoupled RoPE”作为高效实现该目标的使能机制。MLA 仍访问所有历史位置,prefill 的二次 attention 和 decode 对 context length 的扫描继续存在;收益集中在更小的 persistent state 与 memory traffic。

4. MLA 改写 Q/K/V 表示,保留 Softmax Attention

从 operator graph 看,MLA 仍为每个 head 生成一组对历史位置的 logits,并执行 causal Softmax。content query 与共享 KV latent 形成 content logit,RoPE query 与共享 position key 形成 position logit,两项相加后得到同一组权重;这些权重先对历史 KV latent 求和,再经过 absorbed value/output projection。它属于带低秩 Q/K/V 参数化和压缩 cache 的 multi-head attention,attention matrix、causal mask 和历史访问范围保持不变,也不属于 linear attention。

5. 发布 checkpoint 与发布高效 runtime 是两个复现层级

官方 weights、config 和 Hugging Face custom code 足以检查架构参数并运行模型。HF eager attention 在 cache 前展开 K/V,论文的 latent-cache/absorption path 需要 SGLang、vLLM 或内部 kernels。官方 repository 也明确指出 Hugging Face path 慢于 internal code。因而“open weights”支持能力复验,“93.3% cache / 5.76x throughput”仍是内部系统证据。

MLA 的 93.3% 是模型级单份 cache 压缩口径。常见 absorbed tensor-parallel runtime 会在各 attention rank 复制不含 head 轴的 latent KV;展开 K/V 则可以沿 local heads 分片。多卡部署还需同时核算每 rank 收益、盈亏点,以及 DP Attention / DCP 等 ownership 方案。这项边界补充了模型报告到多卡 runtime 之间的第二个复现层级。

6. 后续复验指标

  • 在 BF16/FP8/6-bit 或 FP8 KV 下分别测 allocated KV bytes/token、fragmentation、batch capacity、TTFT、TPOT、P50/P95 latency 与 throughput。
  • 对 optimized latent-cache path 和 expanded-KV HF path做相同 checkpoint/hardware 对照。
  • 报告 routing entropy、per-device token load、all-to-all bytes、token dropping rate 与 dropped-token quality effect。
  • 将 8.1T pretraining、long-context extension、SFT、RM 和 RL 的 GPU-hours 分账。
  • 在 NIAH 外加入 multi-needle、long-document QA、long code、retrieval distractors 和 128K serving cost。

主要启发

  • KV cache 压缩可以和 MoE 稀疏激活叠加,分别处理 attention memory 和 FFN compute。
  • 低秩 KV 的收益需要 decoupled position subspace 与 projection absorption 配合,cache layout 和 kernel 属于架构契约的一部分。
  • 效率论文中的 cost、memory、throughput 可能来自不同 protocol;写作时应分别标明 denominator、baseline、precision、workload 和 SLO。
  • Device-limited routing展示了 MoE 架构参数与网络拓扑的直接耦合;后续 V3 用 auxiliary-loss-free balance继续处理路由偏置问题。
  • GRPO 在 V2 中承担大模型 chat alignment,R1 随后把这条线扩展为以 verifiable reward 为中心的 reasoning RL。

局限

  1. 训练数据仅披露 8.1T、双语和中文/英文相对数量;来源比例、许可、去重和 benchmark contamination 审计不足。
  2. HAI-LLM、训练 kernels、internal serving runtime、6-bit KV 实现和完整版本信息没有发布,核心效率数字难以精确复现。
  3. 官方 HF reference attention 缓存展开后的 K/V,不能代表论文的 compressed latent-cache deployment path。
  4. 42.5% 是每 1T tokens 的 GPU-hours 降幅;总 pretraining、long-context、SFT、RM、RL、失败实验和美元成本没有披露。
  5. 5.76x maximum throughput 缺少 batch、latency SLO、baseline precision、quantization、software version 和 curve;没有 tail latency 或多并发 protocol。
  6. MLA/MHA ablation 的 active/total parameters 未严格匹配,7B MQA/GQA/MHA 对照还通过 layer count 调参;全部实验缺少 seeds 和误差线。
  7. Device-limited routing、三类 balance loss、token dropping 和 custom communication kernels没有逐组件端到端消融;训练期 token dropping rate 未披露。
  8. 128K 证据主要来自单一 NIAH;没有复杂推理、perplexity、multi-needle 或真实长上下文服务测量。
  9. GRPO group size、KL/clip、reward coefficients、rollout/reward data、RL compute 和 online/offline 数值对照未披露;online RL 优势仍是作者观察。
  10. 模型权重受带用途限制的 DeepSeek Model License 约束,精确分类应使用 open-weight;公开正式审稿也未发现。

跨论文关系

  • 2401.06066 DeepSeekMoE:V2 直接继承 fine-grained expert segmentation 与 shared expert isolation,并把其扩展到 236B total parameters、8-way expert parallel 和 device-aware routing。
  • 2412.19437 DeepSeek-V3:V3 继承 MLA/DeepSeekMoE,继续加入 auxiliary-loss-free load balancing、MTP、FP8 training 和更完整的通信优化;V2 是这条 architecture-system co-design 的起点。
  • 2501.12948 DeepSeek-R1:V2 已使用 GRPO 做 chat RL;R1 在 V3-Base 上把 GRPO / verifiable reward 扩展成 reasoning RL 主线。
  • 2026-04-24 DeepSeek-V4:V4 的 CSA/HCA、mHC、Muon、deterministic kernels、heterogeneous/on-disk KV cache 是 V2 的 MLA/KV/MoE 效率路线在 1M context 上的后续系统化。
  • 2602.15763 GLM-5:GLM-5 采用 MLA 并讨论 latent KV 的优化器适配;V2 是理解 MLA 原始设计动机的前置材料。
  • 2606.04101 UltraEP:V2 用 auxiliary losses、device-limited routing、token dropping 控制负载;UltraEP 用 post-gating exact load 做实时重均衡。

Reference Intake Brief

Target

Reusable Elements

  1. MLA cached-state 公式、projection absorption 与 decoupled RoPE。
  2. DeepSeekMoE 的 device-limited scaling relation。
  3. 单位训练成本、deployed cache、maximum throughput 三种效率口径。

Risks

  • Copyright/over-copying: 只摘取关键数值和结构,不复制原表。
  • Unsourced or unverifiable claims: 大团队只保留论文明确角色和 MLA 特别贡献者;内部评测按作者报告处理。
  • Tone/brand mismatch: 保持技术归档语气。
  • Safety/compliance issues: 只记录能力、训练和安全边界,不提供滥用流程。
  • Overlap with existing assets: 与 DeepSeekMoE/V3/R1/V4 存在直接谱系,本条定位为 MLA 与 V2 系统化起点。

Skipped

Material Reason
公开 reviewer comments OpenReview 只有 metadata-only 记录;本次访问触发 challenge verification,未找到可核验 official review。
内部 HAI-LLM / serving source 官方仓库没有发布论文对应的完整训练和生产 serving code。

Recommendation

Decision: merge

Why: 重审后保留 DeepSeek-V2 作为 MLA 原始设计、DeepSeekMoE 大规模系统化和 V3/R1 后续路线的关键上游节点;效率结论已收紧到单位 token 与 internal bundled-system 口径。