Parallelism Transition Point(并行度切换点)

定义

在 LLM 推理中,随着模型规模增大,最优并行策略从 Data Parallelism(DP)切换到 Tensor Parallelism(TP)或 hybrid DP+TP 的模型规模阈值。论文通过 8B-671B 的系统实验确定了这一 inflection point。

三个规模区间

1. Small (8B-14B): DP Dominant

  • Weights fit comfortably in per-GPU HBM(8B ≈16 GB, 14B ≈28 GB)
  • TP 的 all-reduce 通信开销不值得——通信 > 内存释放收益
  • DP=8 optimal(near-linear throughput scaling)
  • Hybrid(如 PP=2+TP=4)比纯 DP 慢 3.5×

2. Medium (32B): The Inflection Point

关键阈值: 32B 是 DP→TP 的切换点

StrategySpeedup (8 GPU)Why
DP=84.9×Weight replication (64 GB) leaves only 77 GB KV
TP=86.15×Weights shard to 8 GB/GPU, releases 133 GB KV
DP=4+TP=2OptimalMin TP degree (reduce comm) + DP concurrency

核心洞察: TP 的收益来自释放 KV capacity(缓解 Inference Capacity Trap),而非加速 kernel 执行。性能 inflection 与 DP replicas 达到 KV-capacity-bound 的点对齐。

3. Frontier (405B-671B): Architecture-Dependent

Dense (Llama-405B):

  • KV: 1.05 MB/token → 需要所有 GPU 内存
  • DP=1 forced, TP=8 or PP=8
  • TP=8: 986s ✓ | PP=8: 7537s ✗(dense activation 太大 → pipeline bubbles 无法填满)

MoE (DeepSeek-R1-671B):

  • 37B active params → 低 compute-to-communication ratio
  • TP=8 的 all-reduce 成瓶颈(GPU 间计算时间不足以掩盖同步)
  • MLA 压缩 KV → 支持 higher micro-batch depth → 填满 PP bubbles
  • PP=4+TP=2: 1663s ✓ (beats TP=8: 2047s)

切换判据

论文给出经验判据:

if model_weights_per_gpu < HBM_capacity × 0.4:
    → DP (weights comfortably fit, KV space sufficient)
elif model_weights_per_gpu < HBM_capacity × 0.6:
    → Hybrid DP+TP (minimal TP to release KV space)
else:
    → TP or PP (all memory needed)
    
if MoE and active_params/token is low:
    → prefer PP+TP over pure TP (sync latency dominates)

Bandwidth-Compute Inversion

论文发现一个反直觉现象:

Model SizeHBM UtilizationBottleneck
8B≈85%Memory bandwidth
70B≈70%Mixed
671B (MoE)≈50-60%Sync + routing latency

→ 超大 MoE 模型不是 bandwidth-bound,而是 synchronization-bound。这解释了为何 high-degree TP 对 MoE 不利。

MLA 的关键角色

DeepSeek-R1 的 MLA(Multi-Head Latent Attention)在推理优化中起到双重作用:

  1. 压缩 KV cache → 延缓 Reasoning Cliff 到来
  2. 使 PP 可行 → reduced KV 允许更高 micro-batch depth → 填满 pipeline bubbles

这是 MoE + MLA 天然适配 PP 架构的根本原因。

决策矩阵

ModelTypeOptimalE2E (2K BS)Key Factor
8BDenseDP=8Weight fits, comm not justified
14BDenseDP=8332sSame
32BDenseDP=4+TP=2484sWeight replication exceeds HBM
70BDenseHybrid TPMixed regime
405BDenseTP=8986sKV footprint demands all memory
671BMoEPP=4+TP=21663sSync latency, MLA advantage

相关概念

Citations

[1] Understanding_Inference_Scaling_for_LLMs.pdf