训练框架生态:Megatron-LM / DeepSpeed / FSDP / Colossal-AI


1. 介绍

1.1. 整合篇定位

本篇将开源训练框架生态整合为一篇研究,覆盖四个代表性框架:Megatron-LM(NVIDIA)、DeepSpeed(Microsoft)、FSDP/torchtitan(PyTorch 原生/Meta)、Colossal-AI(潞晨科技)。它们是大模型预训练与后训练的「并行编排层」——决定了万卡集群的实际算力利用率。

本篇与 09 篇(推理 serving)构成开源 AI Infra 生态的两翼:训练侧决定模型生产成本,推理侧决定模型服务成本。

1.2. 四框架基本信息卡

框架起源首发核心创新定位
Megatron-LM / Megatron-CoreNVIDIA2019(论文)张量并行完整工业实现;后续 Sequence/Context Parallelism、Zero-Bubble Pipeline、FP8「切模型」派标杆,一线大厂预训练标配
DeepSpeedMicrosoft2020ZeRO 1/2/3 渐进分片 + Offload/NVMe「省显存」派标杆,中小团队普惠
FSDP / FSDP2 / torchtitanPyTorch 原生(Meta 主导)FSDP 随 PyTorch 演进DTensor 重写、无通信分片 checkpoint、4D 并行参考实现原生路线,研究界与中等规模默认
Colossal-AI潞晨科技(HPC-AI Tech)2021 起统一并行接口(1D/2D/2.5D/3D 张量并行)+ Gemini 异构内存管理 + Booster 自动并行国产易用派

1.3. 与 03 篇的分工说明

本篇与 03-huawei-ascend.md 在 MindSpeed(昇腾训练加速库,对接 Megatron 风格 API)与 MindSpore 上存在交叉。分工约定:MindSpore/MindSpeed 的昇腾侧背景归 03 篇,本篇承担开源训练框架格局的完整描述,交叉处以「详见 03 篇 / 10 篇」方式互引。本篇 4.2 节的 MFU 指标体系与 03 篇(DeepSeek-V4-Pro 后训练 MFU 超 30%)、05 篇(夸娥 Dense MFU 60% 公司口径)口径打通,形成全组统一的训练效率指标参照。

1.4. 在 AI Harness 体系中的位置

训练框架是「训练域的 Harness」:并行策略选择、流水线调度、断点续训、精度治理分别对应 Harness 六层中的 L3(编排)、L4(状态)、L5(观测)、L6(治理)。与智能体 Harness 的区别在于:训练 Harness 的「任务」是固定的(前向—反向—优化器循环),可变性在于如何把模型与数据切分到数千张卡上——因此其 L3 是数学问题(并行拓扑)而非规划问题。此为类比映射,见 5.6 节声明。


2. 名词解释

术语英文/缩写释义
DPData Parallelism数据并行:各卡持有完整模型副本,切分数据
TPTensor Parallelism张量并行:把单层权重矩阵切分到多卡(Megatron 起源)
PPPipeline Parallelism流水线并行:按层切分模型,微批次流水填充
EPExpert Parallelism专家并行:MoE 模型按专家维度切分到不同卡
SP / CPSequence / Context Parallelism序列/上下文并行:把长序列切分到多卡(长上下文训练)
ZeROZero Redundancy OptimizerDeepSpeed 核心技术:优化器态/梯度/参数渐进分片,消除数据并行冗余
ZeRO-Offload / NVMe将优化器态/梯度卸载至 CPU 内存/NVMe 盘,单卡可训 13B+
FSDPFully Sharded Data ParallelismPyTorch 原生全分片数据并行(ZeRO-3 的 PyTorch 实现)
DTensorDTensorPyTorch 分布式张量抽象,FSDP2 的基础
1F1BOne Forward One Backward流水线并行调度策略;交错 1F1B 与 Zero-Bubble 为其演进
MFUModel FLOPs Utilization模型浮点算力利用率——训练集群效率的核心指标
断点续训Resumable Training故障后从 checkpoint 恢复训练的能力
无通信分片 checkpointCommunication-free CheckpointingFSDP2 特性:保存 checkpoint 时无需额外通信重分片
BoosterBoosterColossal-AI 的自动并行注入接口
DualPipeDualPipeDeepSeek 开源的流水线并行调度算法(HAI-LLM 生态)

3. 功能说明与产品线

3.1. Megatron-LM / Megatron-Core

  1. 起源与演化:2019 论文起源(TP 完整工业实现);2021 交错 1F1B → 2022 Sequence Parallelism → 2023 Megatron-Core 独立可嵌入库 → 2024—2025 Zero-Bubble Pipeline、Context Parallelism、MoE、FP8、Mamba/SSM 合入(A 级论文序列);
  2. 地位:「三大并行哲学」之「切模型」派标杆;一线大厂预训练工业标配(GPT-3/OPT/LLaMA 时代延续);
  3. 效率经验:70B 级 Dense 模型经验 MFU 45—55% 以上(技术社区经验区间,非基准结论,B 级);
  4. 协同:与 Transformer Engine、FlashAttention 协同;NeMo 为其产品化封装。

3.2. DeepSpeed 与 ZeRO 系列

  1. ZeRO 1/2/3:优化器态/梯度/参数渐进分片,显存分别降 4/8 倍与线性扩展;
  2. ZeRO-Offload / NVMe:单卡训 13B+ 模型——中小团队训大模型的普惠起点;
  3. 其他能力:MoE、Ulysses 长上下文、1-bit Adam(通信量降 5 倍);
  4. 治理归属:2025-05 与 vLLM 同批加入 PyTorch 基金会(伞形首批);
  5. 态势:部分势头被 FSDP2 追赶(社区口径,B/C 级)。

3.3. FSDP / FSDP2 / torchtitan

  1. FSDP2:基于 DTensor 重写——确定性显存管理、无通信分片 checkpoint;吞吐较 FSDP1 约 +1.5%;Llama2-7B@128×A100 达 3700 tokens/s/GPU(官方口径);
  2. torchtitan(ICLR 2025 接收):4D 并行(FSDP2 + TP + PP + CP)生产参考实现;Llama 3.1 8B@128 卡提速 65%、70B@256 卡 12.6%、405B@512 卡 30%(官方口径);
  3. 定位:PyTorch 原生路线,研究界与中等规模训练默认;Meta 自用路线。

3.4. Colossal-AI 与组合流派

  1. Colossal-AI:统一并行接口(1D/2D/2.5D/3D 张量并行)+ Gemini 异构内存管理(单张消费级 GPU 训 13B)+ Booster 自动并行注入;最高 2.76 倍训练加速(论文口径);国产易用派代表(潞晨科技);
  2. 组合流派:Megatron-DeepSpeed 混合栈(BLOOM、GPT-NeoX 时代主流:TP/PP 用 Megatron + ZeRO-1 用 DeepSpeed);
  3. 国内自研:DeepSeek HAI-LLM(DualPipe 已开源)、上海 AI Lab InternEvo、百度昆仑镜/PaddleNLP(细节有限公开,见信息缺口声明)。

4. 平台架构

4.1. 并行策略谱系

图 10-1|并行策略谱系:DP / TP / PP / EP / SP(CP)与框架映射

并行策略谱系与框架映射(4D 并行) 信息截止 2026-09-12 · 示意:基于本文分析绘制 五种并行维度(可组合为 4D 并行) DP 数据并行 切数据 · ZeRO/FSDP 消冗余 TP 张量并行 切权重矩阵 · Megatron PP 流水线并行 切层 · 1F1B/Zero-Bubble EP 专家并行 切 MoE 专家 · 大 EP SP/CP 序列并行 切长序列 框架对并行的承载方式 Megatron-Core TP/PP/SP/EP/CP 全谱系 Zero-Bubble · FP8 · MoE 70B 经验 MFU 45—55%+ DeepSpeed ZeRO 1/2/3 + Offload 单卡训 13B+ · Ulysses 长上下文 已入 PyTorch 基金会 FSDP2 / torchtitan DTensor · 4D 并行参考 无通信分片 checkpoint 405B@512 卡提速 30% Colossal-AI 1D~3D TP 统一接口 Gemini 异构内存 · Booster 国产易用派 选型阶梯(社区经验):<1B 用 DDP/FSDP2 → 10B—70B 主流 Megatron TP+PP+DP → >100B/MoE 用 Megatron-Core + 自研补丁或 DeepSpeed-MoE; 组合流派:Megatron-DeepSpeed 混合栈(TP/PP 用 Megatron + ZeRO-1 用 DeepSpeed,BLOOM/GPT-NeoX 时代主流); 国内自研:HAI-LLM(DualPipe 已开源)/ InternEvo / 昆仑镜;昇腾侧 MindSpeed 对接 Megatron 风格 API(详见 03 篇) 跨文档指标打通:训练 MFU 参照系——Megatron 45—55%+(经验值)· 夸娥集群 Dense 60%/MoE 40%(05 篇公司口径)· DeepSeek-V4-Pro 后训练超 30%(03 篇 B/C 级口径)——三者口径来源不同,比较须谨慎; 红框 Megatron-Core 为当前万卡预训练的事实标准编排层。

数据来源:NVIDIA Megatron 论文序列(2019—2024)、arXiv 综述(2025)、掘金技术专栏梳理(2026-04);示意图基于本文分析,MFU 均为经验/公司口径。

4.2. MFU 经验区间与指标体系

70B Dense 经验 MFU 区间(技术社区经验值,务必标注非基准结论,B/C 级):

框架经验 MFU 区间
Megatron-Core45—55% 以上
torchtitan40—50%
FSDP235—45%
Colossal-AI35—45%
DeepSpeed30—40%

配套指标:有效训练时间占比(05 篇夸娥口径 90%+)、线性扩展效率(夸娥口径 95%)、断点续训时间——四项构成训练集群效率的统一指标体系(与 03/05 篇口径打通)。


5. Harness 设计

5.1. 六层能力总览

训练域与智能体域的六层映射为类比映射(声明见 5.6 节):

训练域对应物成熟度
L1 上下文工程序列/上下文并行(SP/CP)、Ulysses 长上下文——「模型看到什么」=长序列如何切分中强
L2 工具与执行框架对硬件的执行封装(FP8/Transformer Engine、算子融合)强(NVIDIA 栈)
L3 编排与控制并行策略编排(TP/PP/DP/EP/SP 组合、Zero-Bubble 调度)
L4 记忆与状态Checkpoint 体系(分布式 checkpoint、无通信分片 checkpoint、断点续训)
L5 评估与观测MFU、有效训练时间占比、线性扩展效率、loss 曲线监控中强
L6 治理与安全精度治理(FP8/量化精度门限,MLPerf 训练任务的质量目标约束)

5.2. L3 训练编排:并行策略即编排

训练侧的「Harness」即并行策略编排:TP/SP/PP/CP/DP 的组合选择、Zero-Bubble 流水线调度、1F1B/交错流水线选择,本质是「计划—执行—反馈」循环在训练域的对应物——计划(并行配置)→ 执行(数千卡训练步)→ 反馈(MFU/吞吐观测)→ 再计划(配置调优)。Megatron-Core 是该层当前的事实标准。

5.3. L4 状态管理:Checkpoint 演进

  1. FSDP2 无通信分片 checkpoint:保存时无需额外通信重分片,降低大集群 checkpoint 开销;
  2. Megatron 分布式 checkpoint 转换工具:跨并行配置的 checkpoint 迁移;
  3. 断点续训能力与 03 篇(10 秒级断点恢复)、05 篇(有效训练时间 90%+)口径衔接——状态连续性是万卡训练可用性的决定性变量。

5.4. L5 评估与观测层

MFU、有效训练时间占比、线性扩展效率、断点续训时间构成标准指标体系;需要强调:各框架 MFU 为经验区间而非统一基准,跨框架/跨硬件比较时必须核对模型规模、精度(FP8/BF16)与集群配置。

5.5. L6 治理与安全层

精度治理是训练域 L6 的核心:FP8/量化精度的质量门限(MLPerf 训练任务要求满足精度目标)决定「低精度训练」的合规边界——算力效率与模型质量的权衡被制度化。

5.6. 类比声明

本节将训练框架的机制映射到 Harness 六层,属于结构类比而非直接对应:训练域的「任务」是确定性的训练循环,「编排」是数学化的并行拓扑问题,与智能体域的开放式任务编排(规划、工具调用、人工中断)性质不同。引用本节结论时应保留类比限定。


6. 实际案例

6.1. 框架采用格局

框架采用实践口径
Megatron 系GPT-3/OPT/LLaMA 预训练工业标配;NeMo 产品化封装 Megatron-CoreB
DeepSpeedChatGLM 微调、Hugging Face 集成最广;ZeRO-Offload 使中小团队可训大模型B
FSDP/torchtitanPyTorch 原生、研究界与中等规模训练默认;Meta 自用路线B
Colossal-AI教学/中小团队/国产自主可控场景快速崛起C(CSDN/DevPress 口径)

6.2. 组合流派与国内自研

  1. Megatron-DeepSpeed 混合栈:BLOOM、GPT-NeoX 时代主流——TP/PP 用 Megatron、ZeRO-1 用 DeepSpeed;
  2. 国内自研:DeepSeek HAI-LLM(DualPipe 已开源)、上海 AI Lab InternEvo、百度昆仑镜/PaddleNLP(闭源/有限公开,仅概述);
  3. 国产硬件侧衔接:昇腾 MindSpeed 对接 Megatron 风格 API(详见 03 篇);华为 CloudMatrix 384 训练 40 天稳定依托昇思/MindSpeed 栈。

6.3. 选型经验

社区经验选型阶梯(B 级梳理):

模型规模主流选择
&lt;1BDDP / FSDP2
10B—70BMegatron TP+PP+DP 组合
&gt;100B / MoEMegatron-Core + 自研补丁,或 DeepSpeed-MoE
中小团队/单机DeepSpeed ZeRO-Offload、Colossal-AI Gemini
研究与中等规模FSDP2 / torchtitan

7. 总结

优势(生态合并)

  1. 演化成熟:从 2019 Megatron 论文到 2025 torchtitan 4D 并行,并行编排层的工业实践已高度收敛;
  2. 治理中立化:DeepSpeed 与 vLLM 同批进入 PyTorch 基金会,开源训练基础设施的中立治理成型;
  3. 指标体系公开:MFU/扩展效率/有效训练时间构成可交流的效率语言,国产厂商(夸娥、河套)已采用同一话语体系。

劣势

  1. 无统一基准:MFU 全部为经验区间或公司口径,跨框架比较依赖自查自测;
  2. Blackwell 代际数据缺口:各框架在 GB200 上的 FP8/FP4 训练 MFU 官方数字缺失;
  3. 国内自研栈公开度低:HAI-LLM/InternEvo 细节有限,生态迁移性不可评估。

适用边界:万卡级预训练 → Megatron-Core;中小团队与单机大模型 → DeepSpeed/Colossal-AI;研究与中等规模 → FSDP2/torchtitan;昇腾集群 → MindSpeed(03 篇)。

选型建议:按模型规模走选型阶梯,避免「一套框架通吃」的执念;万卡部署时把「有效训练时间占比」与「断点续训时间」置于峰值 MFU 之上评估(稳定性损失是万卡训练的头号成本);FP8 训练必须建立精度回归集(L6 精度治理)后再放量。

信息缺口声明

  1. 各框架在 Blackwell/GB200 上的 FP8/FP4 训练 MFU 官方数字缺失(NVIDIA 未单独公开 Megatron-B200 MFU 白皮书);
  2. Colossal-AI 商业化(潞晨科技)客户与营收数据缺失;
  3. HAI-LLM/InternEvo 细节闭源/有限公开,只能概述;
  4. 本文全部 MFU 数据为经验区间或公司口径,非统一基准实测,引用时必须携带口径限定。

8. 参考资料

  1. 【大模型基础设施工程】07:Megatron-LM 与 DeepSpeed — 掘金技术专栏,2026-04。https://juejin.cn/post/7633318137166823487
  2. Model Parallelism — AI Wiki,2025。https://aiwiki.ai/wiki/model_parallelism
  3. From Code Foundation Models to Agents and Applications(DeepSpeed/FSDP/TorchTitan/Colossal-AI 学术综述章节)— arXiv,2025。https://arxiv.org/pdf/2511.18538v1.pdf
  4. 三种并行方式融合全景图:Megatron × DeepSpeed × Colossal-AI 配置对比实战指南 — CSDN,2025。https://blog.csdn.net/sinat_28461591/article/details/147168750
  5. 至目前 2025 年,深度学习框架、训练框架、推理框架 — DevPress/CSDN,2025。https://devpress.csdn.net/awstech/6a9274d23bda720d4b371d5a.html
  6. Megatron-LM 开源仓库 — NVIDIA GitHub,2025。https://github.com/NVIDIA/Megatron-LM
  7. DeepSpeed 开源仓库 — Microsoft GitHub,2025。https://github.com/microsoft/DeepSpeed
  8. PyTorch FSDP 官方教程 — PyTorch,2025。https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html
  9. PyTorch Foundation Welcomes vLLM(伞形基金会首批项目含 DeepSpeed 佐证)— PyTorch,2025。https://pytorch.org/blog/pytorch-foundation-welcomes-vllm/

Training Framework Ecosystem: Megatron-LM / DeepSpeed / FSDP / Colossal-AI

1. Introduction

1.1. Positioning of This Integrated Chapter

This chapter consolidates the open-source training framework ecosystem into a single study, covering four representative frameworks: Megatron-LM (NVIDIA), DeepSpeed (Microsoft), FSDP/torchtitan (PyTorch native/Meta), and Colossal-AI (HPC-AI Tech). They are the "parallel-orchestration layer" of large-model pretraining and post-training — determining the actual compute utilization of ten-thousand-GPU clusters.

Together with chapter 09 (inference serving), this chapter forms the two wings of the open-source AI Infra ecosystem: the training side determines model production cost, and the inference side determines model serving cost.

1.2. Basic Information Cards of the Four Frameworks

FrameworkOriginFirst ReleaseCore InnovationPositioning
Megatron-LM / Megatron-CoreNVIDIA2019 (paper)Complete industrial implementation of tensor parallelism; later Sequence/Context Parallelism, Zero-Bubble Pipeline, FP8Benchmark of the "model sharding" school; default for first-tier companies' pretraining
DeepSpeedMicrosoft2020ZeRO 1/2/3 progressive sharding + Offload/NVMeBenchmark of the "memory saving" school; accessible to small and mid-sized teams
FSDP / FSDP2 / torchtitanPyTorch native (Meta-led)FSDP evolved with PyTorchDTensor rewrite, communication-free sharded checkpoint, 4D parallel reference implementationNative route; default for the research community and mid-scale use
Colossal-AIHPC-AI Tech (Luchen)From 2021Unified parallelism interface (1D/2D/2.5D/3D tensor parallelism) + Gemini heterogeneous memory management + Booster auto-parallelismDomestic, easy-to-use school

1.3. Division of Labor with Chapter 03

This chapter overlaps with 03-huawei-ascend.md on MindSpeed (Ascend training acceleration library, exposing Megatron-style APIs) and MindSpore. Division of labor: the Ascend-side background of MindSpore/MindSpeed belongs to chapter 03; this chapter provides the complete description of the open-source training framework landscape, with cross-references in the form "see chapter 03 / 10". The MFU indicator system in section 4.2 of this chapter is aligned with chapter 03 (DeepSeek-V4-Pro post-training MFU above 30%) and chapter 05 (Kuae Dense MFU 60%, company-reported), forming a unified group-wide reference for training-efficiency metrics.

1.4. Position in the AI Harness System

Training frameworks are the "Harness of the training domain": parallelism strategy selection, pipeline scheduling, resumable training, and precision governance correspond respectively to L3 (orchestration), L4 (state), L5 (observability), and L6 (governance) of the six-layer Harness. The difference from the agent Harness is that the "task" of the training Harness is fixed (forward–backward–optimizer loop); the variability lies in how the model and data are sharded across thousands of GPUs — hence its L3 is a mathematical problem (parallel topology) rather than a planning problem. This is an analogy mapping; see the declaration in section 5.6.


2. Glossary

TermEnglish / AbbreviationDefinition
DPData ParallelismData parallelism: each GPU holds a full model replica and shards the data
TPTensor ParallelismTensor parallelism: shards a single layer's weight matrices across GPUs (originated in Megatron)
PPPipeline ParallelismPipeline parallelism: shards the model by layer, with micro-batch pipelining
EPExpert ParallelismExpert parallelism: shards MoE models across GPUs by expert dimension
SP / CPSequence / Context ParallelismSequence/context parallelism: shards long sequences across GPUs (long-context training)
ZeROZero Redundancy OptimizerDeepSpeed's core technology: progressive sharding of optimizer state/gradients/parameters, eliminating data-parallel redundancy
ZeRO-Offload / NVMeOffloads optimizer state/gradients to CPU memory/NVMe storage, enabling training 13B+ on a single GPU
FSDPFully Sharded Data ParallelismPyTorch-native fully sharded data parallelism (PyTorch's implementation of ZeRO-3)
DTensorDTensorPyTorch's distributed tensor abstraction; the foundation of FSDP2
1F1BOne Forward One BackwardPipeline parallelism scheduling strategy; interleaved 1F1B and Zero-Bubble are its evolutions
MFUModel FLOPs UtilizationModel FLOPs utilization — the core metric of training-cluster efficiency
Resumable trainingResumable TrainingThe ability to resume training from a checkpoint after a failure
Communication-free sharded checkpointCommunication-free CheckpointingAn FSDP2 feature: saving a checkpoint requires no extra communication to re-shard
BoosterBoosterColossal-AI's auto-parallelism injection interface
DualPipeDualPipeDeepSeek's open-source pipeline parallelism scheduling algorithm (HAI-LLM ecosystem)

3. Feature Description and Product Lines

3.1. Megatron-LM / Megatron-Core

  1. Origin and evolution: originated from the 2019 paper (complete industrial TP implementation); 2021 interleaved 1F1B → 2022 Sequence Parallelism → 2023 Megatron-Core became an independent embeddable library → 2024–2025 Zero-Bubble Pipeline, Context Parallelism, MoE, FP8, Mamba/SSM merged (A-grade paper series);
  2. Standing: the benchmark of the "model sharding" school among the "three parallelism philosophies"; industrial default for pretraining at first-tier companies (continuing the GPT-3/OPT/LLaMA era);
  3. Efficiency experience: empirical MFU of 45–55%+ for 70B-class Dense models (technical-community experiential range, not a benchmark conclusion, B-grade);
  4. Synergy: works with Transformer Engine and FlashAttention; NeMo is its productized packaging.

3.2. DeepSpeed and the ZeRO Series

  1. ZeRO 1/2/3: progressive sharding of optimizer state/gradients/parameters, cutting memory by 4/8× respectively with linear scaling;
  2. ZeRO-Offload / NVMe: trains 13B+ models on a single GPU — the accessible starting point for small and mid-sized teams training large models;
  3. Other capabilities: MoE, Ulysses long context, 1-bit Adam (5× less communication);
  4. Governance affiliation: joined the PyTorch Foundation alongside vLLM in 2025-05 (first cohort of the umbrella foundation);
  5. Momentum: some of its momentum is being caught up by FSDP2 (community-reported, B/C grade).

3.3. FSDP / FSDP2 / torchtitan

  1. FSDP2: rewritten on top of DTensor — deterministic memory management, communication-free sharded checkpoint; throughput about +1.5% vs. FSDP1; Llama2-7B on 128×A100 reaches 3700 tokens/s/GPU (official figures);
  2. torchtitan (accepted at ICLR 2025): production reference implementation of 4D parallelism (FSDP2 + TP + PP + CP); Llama 3.1 8B on 128 GPUs sped up 65%, 70B on 256 GPUs 12.6%, 405B on 512 GPUs 30% (official figures);
  3. Positioning: the PyTorch-native route, default for the research community and mid-scale training; Meta's in-house route.

3.4. Colossal-AI and the Hybrid Schools

  1. Colossal-AI: unified parallelism interface (1D/2D/2.5D/3D tensor parallelism) + Gemini heterogeneous memory management (trains 13B on a single consumer GPU) + Booster auto-parallelism injection; up to 2.76× training speedup (paper-reported); representative of the domestic easy-to-use school (HPC-AI Tech);
  2. Hybrid schools: the Megatron-DeepSpeed hybrid stack (mainstream in the BLOOM and GPT-NeoX era: Megatron for TP/PP + DeepSpeed ZeRO-1);
  3. Domestic in-house development: DeepSeek HAI-LLM (DualPipe already open-sourced), Shanghai AI Lab InternEvo, Baidu Kunlunjing/PaddleNLP (limited public details; see the information-gap declaration).

4. Platform Architecture

4.1. Parallelism Strategy Spectrum

Figure 10-1 | Parallelism strategy spectrum: DP / TP / PP / EP / SP (CP) and framework mapping

并行策略谱系与框架映射(4D 并行) 信息截止 2026-09-12 · 示意:基于本文分析绘制 五种并行维度(可组合为 4D 并行) DP 数据并行 切数据 · ZeRO/FSDP 消冗余 TP 张量并行 切权重矩阵 · Megatron PP 流水线并行 切层 · 1F1B/Zero-Bubble EP 专家并行 切 MoE 专家 · 大 EP SP/CP 序列并行 切长序列 框架对并行的承载方式 Megatron-Core TP/PP/SP/EP/CP 全谱系 Zero-Bubble · FP8 · MoE 70B 经验 MFU 45—55%+ DeepSpeed ZeRO 1/2/3 + Offload 单卡训 13B+ · Ulysses 长上下文 已入 PyTorch 基金会 FSDP2 / torchtitan DTensor · 4D 并行参考 无通信分片 checkpoint 405B@512 卡提速 30% Colossal-AI 1D~3D TP 统一接口 Gemini 异构内存 · Booster 国产易用派 选型阶梯(社区经验):<1B 用 DDP/FSDP2 → 10B—70B 主流 Megatron TP+PP+DP → >100B/MoE 用 Megatron-Core + 自研补丁或 DeepSpeed-MoE; 组合流派:Megatron-DeepSpeed 混合栈(TP/PP 用 Megatron + ZeRO-1 用 DeepSpeed,BLOOM/GPT-NeoX 时代主流); 国内自研:HAI-LLM(DualPipe 已开源)/ InternEvo / 昆仑镜;昇腾侧 MindSpeed 对接 Megatron 风格 API(详见 03 篇) 跨文档指标打通:训练 MFU 参照系——Megatron 45—55%+(经验值)· 夸娥集群 Dense 60%/MoE 40%(05 篇公司口径)· DeepSeek-V4-Pro 后训练超 30%(03 篇 B/C 级口径)——三者口径来源不同,比较须谨慎; 红框 Megatron-Core 为当前万卡预训练的事实标准编排层。 Data sources: NVIDIA Megatron paper series (2019–2024), arXiv survey (2025), Juejin technical column review (2026-04); the diagram is drawn based on this chapter's analysis, and all MFU values are experiential/company-reported.

4.2. MFU Experience Ranges and Indicator System

Empirical MFU ranges for 70B Dense models (technical-community experiential values; must be labeled as non-benchmark conclusions, B/C grade):

FrameworkEmpirical MFU Range
Megatron-Core45–55%+
torchtitan40–50%
FSDP235–45%
Colossal-AI35–45%
DeepSpeed30–40%

Supporting indicators: effective training time ratio (chapter 05, Kuae basis, 90%+), linear scaling efficiency (Kuae basis, 95%), resumable-training time — these four form a unified indicator system for training-cluster efficiency (aligned with the bases of chapters 03/05).


5. Harness Design

5.1. Overview of the Six-Layer Capabilities

The six-layer mapping between the training domain and the agent domain is an analogy mapping (see the declaration in section 5.6):

LayerTraining-Domain CounterpartMaturity
L1 Context EngineeringSequence/context parallelism (SP/CP), Ulysses long context — "what the model sees" = how the long sequence is shardedMedium-strong
L2 Tools and ExecutionFramework execution wrappers over hardware (FP8/Transformer Engine, operator fusion)Strong (NVIDIA stack)
L3 Orchestration and ControlParallelism strategy orchestration (TP/PP/DP/EP/SP combinations, Zero-Bubble scheduling)Strong
L4 Memory and StateCheckpoint system (distributed checkpoint, communication-free sharded checkpoint, resumable training)Strong
L5 Evaluation and ObservabilityMFU, effective training time ratio, linear scaling efficiency, loss-curve monitoringMedium-strong
L6 Governance and SecurityPrecision governance (FP8/quantization precision thresholds, quality-goal constraints of MLPerf training tasks)Medium

5.2. L3 Training Orchestration: Parallelism Strategy as Orchestration

The "Harness" on the training side is parallelism strategy orchestration: choosing the combination of TP/SP/PP/CP/DP, Zero-Bubble pipeline scheduling, and 1F1B/interleaved pipeline selection — essentially the training-domain counterpart of the "plan–execute–feedback" loop: plan (parallelism configuration) → execute (training steps across thousands of GPUs) → feedback (MFU/throughput observability) → re-plan (configuration tuning). Megatron-Core is currently the de facto standard for this layer.

5.3. L4 State Management: Checkpoint Evolution

  1. FSDP2 communication-free sharded checkpoint: saving requires no extra communication to re-shard, reducing checkpoint overhead on large clusters;
  2. Megatron distributed checkpoint conversion tool: migrates checkpoints across parallelism configurations;
  3. Resumable-training capability aligns with chapter 03 (ten-second-scale checkpoint recovery) and chapter 05 (effective training time 90%+) — state continuity is the decisive variable in the availability of ten-thousand-GPU training.

5.4. L5 Evaluation and Observability Layer

MFU, effective training time ratio, linear scaling efficiency, and resumable-training time form the standard indicator system; it must be emphasized that each framework's MFU is an experiential range rather than a unified benchmark — cross-framework/cross-hardware comparisons must verify model scale, precision (FP8/BF16), and cluster configuration.

5.5. L6 Governance and Security Layer

Precision governance is the core of L6 in the training domain: the quality thresholds for FP8/quantization precision (MLPerf training tasks must satisfy accuracy goals) define the compliance boundary of "low-precision training" — the tradeoff between compute efficiency and model quality is institutionalized.

5.6. Analogy Declaration

This section maps the mechanisms of training frameworks onto the six Harness layers; this is a structural analogy rather than a direct correspondence: the "task" in the training domain is a deterministic training loop, and "orchestration" is a mathematized parallel-topology problem, which differs in nature from open-ended task orchestration in the agent domain (planning, tool invocation, human interruption). When citing this section's conclusions, preserve the analogy qualification.


6. Practical Cases

6.1. Framework Adoption Landscape

FrameworkAdoption PracticeBasis
Megatron familyIndustrial default for GPT-3/OPT/LLaMA pretraining; NeMo is the productized packaging of Megatron-CoreB
DeepSpeedChatGLM fine-tuning, the broadest Hugging Face integration; ZeRO-Offload lets small and mid-sized teams train large modelsB
FSDP/torchtitanPyTorch-native, default for the research community and mid-scale training; Meta's in-house routeB
Colossal-AIRapidly rising in teaching, small/mid-sized team, and domestic self-reliance scenariosC (CSDN/DevPress basis)

6.2. Hybrid Schools and Domestic In-House Development

  1. Megatron-DeepSpeed hybrid stack: mainstream in the BLOOM and GPT-NeoX era — Megatron for TP/PP, DeepSpeed ZeRO-1;
  2. Domestic in-house development: DeepSeek HAI-LLM (DualPipe already open-sourced), Shanghai AI Lab InternEvo, Baidu Kunlunjing/PaddleNLP (closed-source/limited public info, summarized only);
  3. Domestic-hardware integration: Ascend MindSpeed exposes Megatron-style APIs (see chapter 03); Huawei CloudMatrix 384 trained stably for 40 days on the MindSpore/MindSpeed stack.

6.3. Selection Experience

Community selection ladder (B-grade review):

Model ScaleMainstream Choice
<1BDDP / FSDP2
10B–70BMegatron TP+PP+DP combination
>100B / MoEMegatron-Core + in-house patches, or DeepSpeed-MoE
Small/mid-sized team / single machineDeepSpeed ZeRO-Offload, Colossal-AI Gemini
Research and mid-scaleFSDP2 / torchtitan

7. Summary

Strengths (ecosystem consolidation):

  1. Maturity of evolution: from the 2019 Megatron paper to 2025 torchtitan 4D parallelism, the industrial practice of the parallel-orchestration layer has converged substantially;
  2. Governance neutralization: DeepSpeed joined the PyTorch Foundation in the same cohort as vLLM, forming neutral governance for open-source training infrastructure;
  3. Open indicator system: MFU/scaling efficiency/effective training time form a communicable efficiency language; domestic vendors (Kuae, Hetao) have adopted the same discourse.

Weaknesses:

  1. No unified benchmark: all MFU figures are experiential ranges or company-reported; cross-framework comparison relies on self-investigation and self-testing;
  2. Blackwell-generation data gap: official FP8/FP4 training MFU figures for each framework on GB200 are missing;
  3. Low public openness of domestic stacks: HAI-LLM/InternEvo details are limited, so ecosystem portability cannot be assessed.

Applicability boundary: ten-thousand-GPU pretraining → Megatron-Core; small/mid-sized teams and single-machine large models → DeepSpeed/Colossal-AI; research and mid-scale → FSDP2/torchtitan; Ascend clusters → MindSpeed (chapter 03).

Selection suggestion: follow the selection ladder by model scale, avoiding the obsession with "one framework for everything"; when deploying at ten-thousand-GPU scale, prioritize "effective training time ratio" and "resumable-training time" above peak MFU (stability loss is the number-one cost of ten-thousand-GPU training); FP8 training must establish a precision regression set (L6 precision governance) before scaling up.

信息缺口声明

  1. Official FP8/FP4 training MFU figures for each framework on Blackwell/GB200 are missing (NVIDIA has not separately published a Megatron-B200 MFU whitepaper);
  2. Customer and revenue data for Colossal-AI's commercialization (HPC-AI Tech) are missing;
  3. HAI-LLM/InternEvo details are closed-source/limited public, allowing only a summary;
  4. All MFU data in this chapter are experiential ranges or company-reported, not unified-benchmark measurements; citations must carry the basis qualification.

8. References

  1. [Large Model Infrastructure Engineering] 07: Megatron-LM and DeepSpeed — Juejin technical column, 2026-04. https://juejin.cn/post/7633318137166823487
  2. Model Parallelism — AI Wiki, 2025. https://aiwiki.ai/wiki/model_parallelism
  3. From Code Foundation Models to Agents and Applications (academic survey chapter on DeepSpeed/FSDP/TorchTitan/Colossal-AI) — arXiv, 2025. https://arxiv.org/pdf/2511.18538v1.pdf
  4. Panorama of Merging the Three Parallelism Approaches: A Practical Guide to Megatron × DeepSpeed × Colossal-AI Configuration Comparison — CSDN, 2025. https://blog.csdn.net/sinat_28461591/article/details/147168750
  5. Deep Learning Frameworks, Training Frameworks, and Inference Frameworks as of 2025 — DevPress/CSDN, 2025. https://devpress.csdn.net/awstech/6a9274d23bda720d4b371d5a.html
  6. Megatron-LM open-source repository — NVIDIA GitHub, 2025. https://github.com/NVIDIA/Megatron-LM
  7. DeepSpeed open-source repository — Microsoft GitHub, 2025. https://github.com/microsoft/DeepSpeed
  8. PyTorch FSDP official tutorial — PyTorch, 2025. https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html
  9. PyTorch Foundation Welcomes vLLM (first cohort of the umbrella foundation includes DeepSpeed as evidence) — PyTorch, 2025. https://pytorch.org/blog/pytorch-foundation-welcomes-vllm/