训练框架与调度
1. 介绍
1.1. 背景
训练框架与调度是 AI Infra 的软件中枢:硬件决定上限,框架决定逼近上限的程度。两条工程主线定义了这个方向:
其一,并行效率。Megatron-LM、DeepSpeed、FSDP 三大流派分别以"硬编码优化""低侵入 Offload""PyTorch 原生组合"为路线,万卡级系统(如 MegaScale 的 12,288 GPU)则证明框架级定制可以把 MFU 推到 55.2%(A级,arXiv 2402.15627)。
其二,持续运行。万卡以上规模故障成为常态:Llama 3 训练的 54 天快照中发生 419 次意外中断,约每 3 小时一次(A级,官方技术报告)。此时框架的核心价值不再是峰值 MFU,而是有效训练时间——检查点、故障检测、隔离与恢复的编排能力。
1.2. 定义与范围
训练框架与调度方向在运行侧覆盖:
| 环节 | 内容 | 典型对象 |
|---|---|---|
| 并行框架 | 通用训练框架与并行策略 | Megatron-LM、DeepSpeed、FSDP2、torchtitan |
| 自研训练栈 | 大厂定制系统 | MegaScale(字节)、HAI-LLM(DeepSeek)、InternEvo(上海 AI Lab)、昆仑镜(百度) |
| 作业调度 | Slurm/K8s 资源编排 | 队列、抢占、拓扑感知调度 |
| 容错机制 | checkpoint 与故障恢复 | 异步 checkpoint、热备节点、组级隔离 |
| 效率评估 | 统一基准与指标 | MFU、ETTR、有效训练时长占比、MLPerf |
边界说明:推理侧 serving 框架见 05-inference-framework.md;容错运维的完整 SOP 与监控体系见 06-ops.md(本文写训练视角,运维篇写运维视角,素材有交叉但视角不同)。
1.3. 在 AI Harness 体系中的定位
训练框架是 Harness 六层模型中 L3 编排与控制层的调度中枢,同时深度覆盖 L4 与 L5:
| Harness 层 | 本方向的具体承载物 |
|---|---|
| L1 上下文工程 | 数据管线(数据加载、预处理流水线) |
| L3 编排与控制 | 瓶颈层:并行策略 = 计划,checkpoint/弹性恢复 = 中断与恢复,故障检测 = 异常检测 |
| L4 记忆与状态 | 异步 checkpoint 是"工件与检查点"的典范实现 |
| L5 评估与观测 | MFU/ETTR/有效训练时长占比是核心指标;MLPerf 是行业统一的 L5 回归集 |
| L6 治理与安全 | 配额与作业优先级 |
瓶颈层判断:本方向的重心在 L3 编排(并行策略与容错恢复)与 L5 评估(有效训练时间)。这与设计侧文档(详见 02-行业赋能/04-硬件研发组/05-ai-infra.md)的结论一致并沿用:MFU、ETTR、有效训练时长占比是本方向唯一值得作为目标的可量化指标。
1.4. 发展现状
1.4.1. 三大流派与选型经验(经验区间,非官方基准)
| 流派 | 核心机制 | MFU 经验区间(H100 bf16,稠密 LLaMA 类) | 适用 |
|---|---|---|---|
| Megatron-LM | TP+PP+SP+CP 硬编码优化,Transformer Engine 通信重叠、Zero-Bubble 流水线 | 45-55%+ | 10B-70B;大于 100B/MoE 用 Megatron-Core + 自研 |
| DeepSpeed | ZeRO 1/2/3 + CPU/NVMe Offload,低侵入 | 30-40% | 显存吃紧、NVMe Offload 场景 |
| FSDP2 | DTensor per-parameter sharding,PyTorch 原生组合 | 35-45% | 小于 1B 与中规模;PyTorch 生态 |
上表为技术社区汇总的经验区间(C 级,非官方基准,引用必须标注);MoE 模型各流派约再降 10 个百分点。选型经验法则(同源 C 级):TP 不跨 NVLink 域(跨机走 IB 时 TP all-reduce 掉速 20-40%);PP 需 128 卡以上才有意义;小于 1B 用 DDP/FSDP2。
演进趋势:Megatron-Core 内置分布式优化器后,"Megatron-DeepSpeed 组合"被替代;FSDP2/PyTorch TP/PP 基于 DTensor 统一收敛;torchtitan 成为官方参考实现。国内自研栈:DeepSeek HAI-LLM(DualPipe 已开源)、上海 AI Lab InternEvo、百度 PaddleNLP/昆仑镜(C 级汇总口径)。
1.4.2. 消融与优化手段(MegaScale 拆解,A级)
MegaScale 相对 Megatron-LM 的 55.2% vs 41.2%(1.34 倍)来自可复用的工程拆解:并行 Transformer 块 + 滑动窗口注意力 +5.6%、3D 并行通信重叠 +6.2%、高效算子 +1.7%、数据管线 +1.1%、LAMB 大批量 +3.0%。其中通信重叠(Megatron 的 --tp-comm-overlap 把 All-Reduce 拆为 Reduce-Scatter + All-Gather 并与 GEMM 重叠)是各流派通用的最大单项。
图 4-1|Llama 3 训练 54 天故障画像与有效训练时间
数据来源:Meta《The Llama 3 Herd of Models》官方技术报告(A级);Epoch AI 的 checkpoint 开销估算为 C 级模型估算。条形宽度按比例示意(第 2 条以 466 次中断全量为基准;第 3、4 条为相对意外中断条的子份额)。
2. Glossary
| Term | English / Abbreviation | Definition |
|---|---|---|
| Model FLOPs Utilization | Model FLOPs Utilization, MFU | The ratio of actual effective compute to theoretical peak compute; the primary metric of training frameworks |
| Effective Training Time Ratio | Effective Training Time Ratio, ETTR | The ratio of effective training time to total occupied time; the core metric of fault tolerance |
| Effective training time ratio | — | The proportion of time actually advancing training; same origin as ETTR but the metric may differ |
| Tensor Parallelism | Tensor Parallelism, TP | Splitting single-layer weights across multiple GPUs; most sensitive to Scale-up bandwidth |
| Pipeline Parallelism | Pipeline Parallelism, PP | Splitting the model by layers; only pays off at 128+ GPU scale |
| Data Parallelism | Data Parallelism, DP | Splitting data while each holds a full replica; the basic granularity of elastic recovery |
| Sequence Parallelism | Sequence Parallelism, SP | Splitting along the sequence dimension; combined with TP to reduce activation memory |
| Context Parallelism | Context Parallelism, CP | Splitting along the dimension of long-context sequences |
| Expert Parallelism | Expert Parallelism, EP | Distributing MoE experts across multiple GPUs/nodes |
| Zero Redundancy Optimizer | ZeRO | DeepSpeed's optimizer-state sharding technique (three levels 1/2/3) |
| Fully Sharded Data Parallel | Fully Sharded Data Parallel, FSDP | PyTorch-native full-sharding approach; FSDP2 is based on DTensor |
| Tensor compute overlap | tp-comm-overlap | Megatron's switch that overlaps communication with GEMM; one of the largest single sources of MFU |
| Bidirectional pipeline | DualPipe | The bidirectional pipeline scheduling technique open-sourced by DeepSeek HAI-LLM |
| Checkpoint | Checkpoint | Periodic persistence of training state; the two-phase async approach writes to host memory first, then to disk |
| Flight recorder | NCCL Flight Recorder | Records recent collective-communication metadata and stack backtraces to speed up root-cause analysis |
| Straggler | Straggler | A node that drags down the overall pace; roughly 0.5% of the cluster by MegaScale's metric |
| Silent Data Corruption | Silent Data Corruption, SDC | Compute errors with no warning; attributed to 6 cases in the Llama 3 snapshot |
| Weak Scaling Efficiency | Weak Scaling Efficiency | How well efficiency is maintained when scale and data grow together; MegaScale 2240→11200 GPUs is near-linear |
| MLPerf Training | — | MLCommons' industry training benchmark; the current unified metric is v5.0 (2025-06) |
| Regression Job Set | Regression Job Set | A fixed set of jobs used for regression validation after Harness/framework changes |
3. 案例
3.1. ByteDance MegaScale:万卡训练的效率与容错
证据级别:A(官方论文,arXiv 2402.15627)
3.1.1. 背景
12,288 GPU 规模训练 175B 模型时,开源框架的默认配置无法同时满足 MFU 与稳定性:通信开销、数据管线瓶颈与故障恢复都在规模放大后成为主要损耗。
3.1.2. 方案
- 效率:并行 Transformer 块 + 滑动窗口注意力(+5.6% MFU)、3D 并行通信重叠(+6.2%)、高效算子(+1.7%)、数据管线优化(+1.1%)、LAMB 大批量(+3.0%),合计把 MFU 从 Megatron-LM 基线的 41.2% 提升到 55.2%。
- 稳定性工程:Driver-Executor 架构 + 心跳监控(含训练日志、RDMA 流量指标);异常时全集群暂停 → 轻量自检(环回带宽、RNIC 连通性、NCCL 通信测试)→ 隔离故障节点 → K8s 补充健康节点 → 从最近 checkpoint 恢复。
- 两阶段异步 checkpoint:阶段一 GPU 状态写主机内存(PCIe 数秒)后继续训练;阶段二后台异步写 HDFS;恢复时同一 DP 组单 worker 读取再广播,线性降低存储带宽压力。
- 可观测:CUDA Event 低开销剖析工具,热力图定位计算掉队节点(约占集群 0.5%);3D 并行可视化定位通信阻塞。
3.1.3. 效果
- MFU 55.2%(12,288 GPU,175B),对比 Megatron-LM 41.2%,1.34 倍。
- 弱扩展:2,240 → 11,200 GPU 保持近线性,MFU 稳定约 54%。
- Harness 解读:MegaScale 的"检测-诊断-隔离-替换-恢复"流水线是 L3 容错编排的教科书实现;两阶段异步 checkpoint 是 L4"工件与检查点"的典范——它把 checkpoint 从"暂停训练的代价"变成"与训练并行的后台任务",直接抬升有效训练时间。
3.2. Meta Llama 3 405B:54 天故障画像与有效训练时间
证据级别:A(官方技术报告 The Llama 3 Herd of Models);个别转述为 B
3.2.1. 背景
16,384 H100 训练 405B 模型(TP=8、PP=16、DP=8~128),全程约 39.3M H100 GPU-hours。该规模下故障数据的公开度前所未有,是行业故障画像的事实参照系。
3.2.2. 方案
- 容错组合:大幅异步化 checkpoint + 热备节点 + 启动健康检查。
- 诊断工具链:PyTorch NCCL flight recorder(记录最后 N 条集合通信元数据与栈回溯)加速根因分析;NCCLX 深度集成实现 NVLink/RoCE 故障检测与通信停滞自动超时;straggler 检测工具优先排查问题通信。
- SDC 治理三件套:FleetScanner(周期性全舰队测试)、Ripple(同置测试)、Hardware Sentinel(遥测 + 分析识别故障)。
- checkpoint 权衡:频率 vs 写带宽 vs 恢复损失三方权衡(Epoch AI 估算最优间隔约 4 分钟,C 级模型估算)。
3.2.3. 效果
- 故障画像(54 天快照):466 次中断 = 47 次计划 + 419 次意外(约每 3 小时一次);意外中断中 GPU 相关 58.7%(GPU 故障 148 次/30.1%,含 NVLink;HBM3 内存 72 次/17.2%);网络交换机/线缆 35 次(8.4%);54 天仅 2 次 CPU 故障;6 次归为 GPU SDC。
- 有效性:有效训练时间占比大于 90%;仅 3 次需要重大人工干预,其余自动化处理。
- Harness 解读:这份画像把 L5 观测的优先级排序给了硬件域——GPU 相关故障占近六成,意味着 L5 的硬件遥测(ECC、NVLink、HBM)比应用层日志更值得投入;"仅 3 次人工干预"则是 L6 治理层"自动化分级"的量化标杆。
3.3. MLPerf Training v5.0:行业统一基准口径
证据级别:A(MLCommons 口径,媒体转述为 B)
3.3.1. 背景
训练框架的跨系统比较需要统一基准。MLPerf Training v5.0(2025-06-04 发布)是截至信息截止日训练侧的最新确认口径。
3.3.2. 方案
- 20 个提交机构、201 项结果,创历史纪录。
- 首次引入 Llama 3.1 405B 预训练基准(替代 GPT-3 基准),提交量超过历轮 GPT-3 基准。
- 联想提交首组功耗基准,把能耗纳入性能对比维度。
- 标杆提交:CoreWeave + NVIDIA + IBM 用 2,496 颗 GB200 超级芯片(MLPerf 史上最大 GB200 NVL72 集群,较此前云厂商提交大 34 倍),27.3 分钟完成 405B 训练项,同类规模集群对比快 2 倍以上。
3.3.3. 效果
- GB200 每 GPU 训练吞吐最高达等效 Hopper 的 2.6 倍(O'Reilly 图书转述交叉口径,B/C 级)。
- MLPerf Inference v5.0 每 GPU 推理吞吐约 3.4 倍(同源转述口径)。
- Harness 解读:MLPerf 是行业统一的 L5 回归集——本组 AGENTS.md 要求性能数字标注口径时,"MLPerf"是与"官方发布/第三方实测/厂商宣称"并列的一级口径;框架选型时,MLPerf 结果作为同代硬件的上界参照,实际项目仍须建立自己的基准作业集。
- 口径边界:截至 2026-09-12 未检索到 MLPerf v5.1 之后训练侧新版结果的确认信息,标注为缺口。
4. 实践标准
性质声明:以下为基于行业公开实践(MegaScale、Llama 3、MLPerf 等)提炼的建议稿,非官方行业标准原文。组级上位规范见同目录 AGENTS.md;以下为训练框架与调度方向的裁剪版。
4.1. AGENTS.md 规范
4.1.1. AGENTS.md(AI Infra 组 · 训练框架与调度方向)
# AGENTS.md —— AI Infra 组 · 训练框架与调度方向
> 本文为基于行业实践提炼的建议稿,非官方行业标准原文。
> 上位规范:01-AI-Infra组/AGENTS.md(不可逆动作禁止清单、变更窗口、可观测要求)。
## 角色与边界
- 角色:训练框架与调度智能体,负责并行策略设计、框架选型与版本管理、
checkpoint 策略、故障检测与恢复编排、MFU/ETTR 诊断。
- 不负责:调度器全局策略修改(属禁止清单)、配额最终分配、
硬件采购与机房改造。
- 判定器为监控与基准:所有 MFU/ETTR/有效训练时长占比结论必须来自
真实监控数据或固定基准作业集回归。
## 环境假设
执行前必须显式声明:
- 加速器型号/数量/代际、Scale-up 域边界、Scale-out 网络与跨机带宽。
- 框架与版本(Megatron-LM / DeepSpeed / FSDP2 / 自研栈)、
调度器(Slurm/K8s)版本与分区拓扑。
- 模型结构(稠密/MoE、专家数)、目标并行策略、批量与序列长度。
- checkpoint 存储与写入带宽实测值、热备池容量。
- 未声明框架版本与并行策略时,禁止产出 MFU/扩展性结论。
## 上下文加载顺序(Context Budget)
1. 作业配置:并行策略、批量、checkpoint 频率、恢复策略。
2. 集群与拓扑:域边界、跨机带宽、分区。
3. 监控摘要:MFU、吞吐、通信占比、straggler、中断记录。
4. 框架变更记录与已知问题清单。
## 工具契约
- 框架与调度器通过封装接口访问;返回值含退出码、日志路径、关键数值、
作业标识、版本。
- 消融实验必须单变量:每次只改一个并行/优化开关,记录前后 MFU。
- 调度策略变更必须可回滚并先在影子队列验证。
## 任务执行流程(SOP)
- S1 需求解析:目标模型 → 并行约束(TP 不跨域、EP 带宽需求)。
- S2 基线建立:默认配置 MFU、中断频率、恢复耗时。
- S3 消融设计:参照 MegaScale 拆解(通信重叠、算子、数据管线、批量),
按预期收益排序。
- S4 受控验证:小规模复现消融,再灰度到目标规模。
- S5 容错验证:注入式故障演练(杀节点、拔线模拟),测检测时延/
隔离粒度/恢复耗时。
- S6 证据打包:与基线差值 + 中断原因分布 + 待人工确认项。
## 验证与证据要求
- MFU 结论注明模型、硬件代际、并行配置、精度格式;经验区间须标
"经验区间,非官方基准"。
- 容错结论三项齐备:故障检测时延、隔离粒度、恢复耗时。
- 消融各项收益与 MegaScale 类公开拆解对比时注明来源与规模差异。
- 跨规模比较使用弱扩展效率而非绝对吞吐。
## 失败与升级策略
- 有效训练时长占比连续下降 → 升级人工,附中断原因四分类
(硬件/网络/软件/数据)分布。
- 消融在小规模有效但规模放大后失效 → 停止灰度,回滚并记录。
- 疑似 SDC → 触发周期性全舰队测试与同置测试,升级硬件排查。
- checkpoint 写入耗时逼近故障平均间隔 → 调整为两阶段异步方案。
## 安全与合规红线
- 多租户配额与优先级变更走人工审批。
- 框架版本升级遵循兼容矩阵,禁止跨版本强升(属禁止清单)。
- 训练数据与 checkpoint 访问按租户隔离。
- 禁止残留非标准占位符。
## 输出格式
- 首行:可判定结论 + 阻塞项。
- 消融表:每项开关、MFU 变化、规模条件、来源。
- 容错报告:检测时延、隔离粒度、恢复耗时 + 中断原因分布。
- 调度变更:影响面、影子队列验证结果、回滚命令。
- 数值规范:参数带单位;范围用 ~ 连接;百分比数值与 % 之间不留空格。
## 评估与自检
- MFU 是否注明模型/代际/并行配置?
- 经验区间是否标注非官方基准?
- 容错三项是否齐备?
- 消融是否单变量?
- 是否残留非标准占位符? 4.2. SKILL.md 规范
4.2.1. SKILL.md(AI Infra 组 · 训练效率消融与容错编排)
---
name: training-efficiency-ablation-and-fault-sop
description: AI Infra 组训练框架方向标准技能——MFU 消融诊断、并行策略设计、
checkpoint 与故障恢复编排。当需要提升 MFU、设计 TP/PP/DP/EP 组合、
优化 checkpoint、验证容错流水线、对标 MLPerf 口径时使用。
触发词:MFU、并行策略、Megatron、DeepSpeed、FSDP、checkpoint、ETTR、MLPerf。
version: 1.0
created: 2026-09-12
---
# AI Infra 组 · 训练效率消融与容错编排
> 本文为基于行业实践提炼的建议稿,非官方行业标准原文。
> 上位规范:01-AI-Infra组/AGENTS.md。
## 适用场景
- MFU 低于经验区间,需定位计算/通信/数据加载/调度碎片瓶颈。
- 并行策略(TP/PP/DP/EP/SP/CP)组合设计与跨域约束校验。
- checkpoint 策略设计与两阶段异步改造。
- 容错流水线(检测-诊断-隔离-替换-恢复)建设与演练。
- 框架选型(Megatron-LM / DeepSpeed / FSDP2 / 自研栈)与版本升级评估。
- MLPerf 口径对标与固定基准作业集建设。
## 前置条件
- 已声明框架版本、并行策略、模型结构、checkpoint 带宽、热备池。
- 存在基线 MFU 与中断记录;固定基准作业集可用。
- 影子队列或非生产分区可用于消融与演练。
## 输入
| 输入项 | 说明 | 必需 |
|---|---|---|
| 作业配置 | 并行策略、批量、序列长度、checkpoint 频率 | 是 |
| 集群拓扑 | Scale-up 域边界、跨机带宽、分区 | 是 |
| 基线指标 | MFU、吞吐、中断频率、恢复耗时 | 是 |
| 监控数据 | 通信占比、straggler、心跳/日志路径 | 是 |
| 框架变更记录 | 版本升级、开关变更历史 | 否 |
## 输出
| 输出项 | 说明 | 必需 |
|---|---|---|
| 可判定结论 | 通过 / 不通过 / 部分通过 + 阻塞项 | 是 |
| 消融报告 | 每项开关的 MFU 变化、规模条件、来源对照 | 是 |
| 并行策略方案 | TP/PP/DP/EP 映射与跨域校验结论 | 是 |
| 容错报告 | 检测时延、隔离粒度、恢复耗时 + 演练记录 | 是 |
| checkpoint 方案 | 频率/异步化设计 + 写带宽占用评估 | 条件必需 |
| 证据表 | 工具、版本、命令、日志路径、数值、时间窗口 | 是 |
## 执行步骤
1. 环境校验:框架版本、拓扑、checkpoint 带宽、影子队列可用性。
2. 基线确认:默认配置 MFU、通信占比、中断频率、恢复耗时。
3. 瓶颈分解:计算/通信/数据加载/调度碎片四类(CUDA Event 类低开销
剖析 + 3D 并行可视化)。
4. 消融设计:按预期收益排序(通信重叠 → 算子 → 数据管线 → 批量),
单变量执行,小规模复现后灰度放大。
5. 并行校验:TP 不跨 Scale-up 域、EP 带宽需求测算、PP 规模适用性。
6. 容错演练:注入故障(杀节点、断链模拟),测量检测时延、隔离粒度、
恢复耗时;验证两阶段异步 checkpoint。
7. 对标:与公开拆解(MegaScale 各项收益)与 MLPerf 同代结果对照,
注明规模与代际差异。
8. 交付:消融表 + 容错报告 + 回滚方案 + 待人工确认项。
## 质量标准(DoD)
- MFU 结论注明模型/硬件代际/并行配置/精度格式。
- 消融单变量;经验区间标注"非官方基准"。
- 容错三项齐备且有演练记录支撑。
- checkpoint 方案给出写带宽占用与恢复损失测算。
- 参照口径(不得直接套用):MegaScale 12,288 GPU MFU 55.2% vs
Megatron-LM 41.2%(A级);Llama 3 有效训练时间占比 >90%、419 次
意外中断、GPU 相关 58.7%(A级);MLPerf Training v5.0 = 20 机构
201 项、首设 Llama 3.1 405B 基准(A/B 级)。
## 常见失败与处理
| 失败模式 | 现象 | 处理 |
|---|---|---|
| TP 跨域 | 跨机 TP 使 all-reduce 掉速 20-40% | 重排并行映射,跨机改 PP/DP/EP |
| 消融多变量 | 同时改多个开关无法归因 | 强制单变量,逐项回退 |
| checkpoint 拖慢 | 写入耗时逼近故障平均间隔 | 两阶段异步化或调频率 |
| 规模放大失效 | 小规模收益在万卡消失 | 停止灰度,检查通信拓扑假设 |
| 疑似 SDC | 收敛异常无告警 | 全舰队测试 + 同置测试,升级人工 |
| 恢复慢 | 恢复耗时占比高 | 单 worker 读取再广播;检查热备池 |
## 示例
任务:某 8,000 卡作业 MFU 42%,目标提升至 50% 以上。
1. 环境校验:Megatron-Core 版本、TP/PP/DP 配置、checkpoint 带宽。
2. 基线:MFU 42%,通信占比 26%,数据管线等待 6%。
3. 瓶颈分解:通信重叠缺失为主因。
4. 消融:tp-comm-overlap 单项在 512 卡复现 +5.8%,灰度至 8,000 卡
+6.1%;Zero-Bubble 流水线 +2.2%;数据管线预取 +0.9%。
5. 并行校验:TP=8 限制在 Scale-up 域内,PP=16 确认规模适用。
6. 容错演练:杀节点场景检测时延 40 秒内、DP 组级隔离、恢复 8 分钟;
异步 checkpoint 写带宽占用达标。
7. 对标:拆解结构与 MegaScale 公开数据一致(规模不同,标注差异)。
8. 交付:通过——MFU 提升至 51.2%;消融表、容错报告、回滚方案齐备。
(示例数值为演示用假设值,非实测数据;方法论参照 MegaScale 与 Llama 3
公开实践。) 4.3. 落地检查清单
| 序号 | 检查项 | 判定标准 | 必需 |
|---|---|---|---|
| 1 | 环境声明 | 框架版本、并行策略、checkpoint 带宽已声明 | 是 |
| 2 | 基线数据 | MFU、通信占比、中断频率、恢复耗时已记录 | 是 |
| 3 | 四类分解 | 计算/通信/数据加载/调度碎片分解完成 | 是 |
| 4 | 单变量消融 | 每次只改一个开关并记录 | 是 |
| 5 | 口径标注 | MFU 注明模型/代际/配置;经验区间标注 | 是 |
| 6 | 跨域校验 | TP 不跨 Scale-up 域已验证 | 是 |
| 7 | 容错三项 | 检测时延、隔离粒度、恢复耗时齐备 | 是 |
| 8 | checkpoint 评估 | 写带宽占用与恢复损失已测算 | 是 |
| 9 | 演练记录 | 注入式故障演练有记录 | 是 |
| 10 | 基准作业集 | 固定基准作业集回归完成 | 是 |
| 11 | 回滚方案 | 框架/调度变更可回滚 | 是 |
| 12 | 占位符清理 | 无 XX、___ 等非标准占位符 | 是 |
5. 总结
训练框架与调度方向在 Harness 六层模型中的重心是 L3 编排(并行策略与容错恢复)与 L5 评估(有效训练时间)。三条结论:
- MFU 的提升是可拆解的工程问题。 MegaScale 把 41.2% 提到 55.2% 的每一项收益都公开可复用,其中通信重叠是最大单项;框架选型应从"哪个框架更好"转向"哪些开关在我的规模与拓扑下有效",并以单变量消融验证。
- 万卡之后,容错编排比峰值 MFU 更重要。 Llama 3 的 419 次意外中断与"仅 3 次人工干预"共同说明:有效训练时间大于 90% 的目标,靠的是异步 checkpoint、热备节点、flight recorder 与 SDC 治理三件套的系统性组合,而不是任何单点优化。
- 统一基准是跨系统对话的前提。 MLPerf Training v5.0(首设 Llama 3.1 405B 基准)与 MFU/ETTR/有效训练时长占比构成"行业口径 + 项目口径"的双层评估体系;框架或 Harness 变更后必须在固定基准作业集上回归。
信息缺口声明
以下条目未获 A/B 级来源确认,已在正文标注 :
- 三大流派 MFU 经验区间(Megatron 45-55%+ / FSDP2 35-45% / DeepSpeed 30-40%)与选型经验法则(TP 跨域掉速 20-40%、PP 128 卡阈值)为技术社区汇总,C 级,经验区间非官方基准。
- DeepSeek-V3 工程优化(256 专家分 16 通信组、双向流水线重叠率 98%、自适应梯度压缩节省 40% 带宽)为转述口径,C 级 ,建议引 DeepSeek-V3 技术报告原文。
- Epoch AI 的 checkpoint 开销 2.1% 与最优间隔 4 分钟为模型估算,C 级。
- 国内自研栈盘点(HAI-LLM、InternEvo、昆仑镜)为社区汇总口径,C 级。
- MLPerf v5.1 之后训练侧新版结果截至 2026-09-12 未获确认;GB200 对 Hopper 的 2.6 倍/3.4 倍交叉口径为 B/C 级转述。
- 未检索到本方向公开 AGENTS.md/SKILL.md 标准范本,本文为建议稿。
6. 参考资料
- MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs — ByteDance,arXiv 2402.15627,2024。https://arxiv.org/abs/2402.15627
- The Llama 3 Herd of Models — Meta,2024。https://arxiv.org/abs/2407.21783
- MLPerf Training v5.0 结果发布 — MLCommons/PR Newswire,2025-06-04。https://prn.to/3Zlln3j
- Megatron-LM — NVIDIA GitHub。https://github.com/NVIDIA/Megatron-LM
- DeepSpeed — Microsoft GitHub。https://github.com/microsoft/DeepSpeed
- torchtitan / FSDP 参考实现 — PyTorch 官方。https://github.com/pytorch/torchtitan
- NCCL(含 flight recorder 与 2.27 特性)— NVIDIA GitHub。https://github.com/NVIDIA/nccl
- AI Infra(设计侧,MFU/ETTR 指标体系交叉引用)— 02-行业赋能/04-硬件研发组/05-ai-infra.md,2026-09-12。
- MLCommons 官网(基准口径)— MLCommons。https://mlcommons.org/
- DualPipe / HAI-LLM 相关开源 — DeepSeek GitHub。https://github.com/deepseek-ai
Training Frameworks and Scheduling
1. Introduction
1.1. Background
Training frameworks and scheduling form the software core of AI Infra: hardware sets the ceiling, while frameworks determine how close you can get to it. Two engineering mainlines define this direction:
First, parallel efficiency. The three major schools — Megatron-LM, DeepSpeed, and FSDP — follow the paths of "hard-coded optimization," "low-intrusion Offload," and "PyTorch-native composition" respectively, while ten-thousand-GPU systems (e.g., MegaScale's 12,288 GPUs) prove that framework-level customization can push MFU to 55.2% (Level A, arXiv 2402.15627).
Second, sustained operation. At scales above ten thousand GPUs, failures become the norm: the 54-day snapshot of Llama 3 training saw 419 unexpected interruptions, about one every 3 hours (Level A, official technical report). At this point the framework's core value is no longer peak MFU but effective training time — the ability to orchestrate checkpoints, fault detection, isolation, and recovery.
1.2. Definition and Scope
The training frameworks and scheduling direction covers, on the runtime side:
| Stage | Content | Typical Objects |
|---|---|---|
| Parallel frameworks | General training frameworks and parallel strategies | Megatron-LM, DeepSpeed, FSDP2, torchtitan |
| In-house training stacks | Custom systems from major companies | MegaScale (ByteDance), HAI-LLM (DeepSeek), InternEvo (Shanghai AI Lab), KunlunMirror (Baidu) |
| Job scheduling | Slurm/K8s resource orchestration | Queues, preemption, topology-aware scheduling |
| Fault tolerance | Checkpoints and failure recovery | Asynchronous checkpoints, hot-standby nodes, group-level isolation |
| Efficiency evaluation | Unified benchmarks and metrics | MFU, ETTR, effective training time ratio, MLPerf |
Boundary notes: for inference-side serving frameworks, see 05-inference-framework.md; for the complete SOP and monitoring system of fault-tolerant operations, see 06-ops.md (this document is written from the training perspective, the ops document from the operations perspective — the material overlaps but the perspectives differ).
1.3. Position in the AI Harness System
Training frameworks are the scheduling hub of the L3 orchestration-and-control layer in the Harness six-layer model, while also deeply covering L4 and L5:
| Harness Layer | Concrete Carrier in This Direction |
|---|---|
| L1 Context Engineering | Data pipeline (data loading, preprocessing pipeline) |
| L3 Orchestration & Control | Bottleneck layer: parallel strategies = planning, checkpoint/elastic recovery = interruption and recovery, fault detection = anomaly detection |
| L4 Memory & State | Asynchronous checkpoints are the exemplary implementation of "artifacts and checkpoints" |
| L5 Evaluation & Observation | MFU/ETTR/effective training time ratio are core metrics; MLPerf is the industry-standard L5 regression set |
| L6 Governance & Security | Quotas and job priorities |
Bottleneck-layer judgment: this direction's focus is on L3 orchestration (parallel strategies and fault-tolerant recovery) and L5 evaluation (effective training time). This is consistent with and continues the conclusions of the design-side documents (see 02-行业赋能/04-硬件研发组/05-ai-infra.md): MFU, ETTR, and effective training time ratio are the only quantifiable metrics in this direction worth targeting.
1.4. Current State of Development
1.4.1. The Three Major Schools and Selection Experience (Empirical Range, Not an Official Benchmark)
| School | Core Mechanism | MFU Empirical Range (H100 bf16, dense LLaMA-class) | Suitable For |
|---|---|---|---|
| Megatron-LM | Hard-coded TP+PP+SP+CP optimization, Transformer Engine communication overlap, Zero-Bubble pipeline | 45-55%+ | 10B-70B; above 100B/MoE use Megatron-Core + in-house |
| DeepSpeed | ZeRO 1/2/3 + CPU/NVMe Offload, low intrusion | 30-40% | Tight VRAM, NVMe Offload scenarios |
| FSDP2 | DTensor per-parameter sharding, PyTorch-native composition | 35-45% | Below 1B and mid-scale; PyTorch ecosystem |
The table above is the empirical range compiled by the technical community (Level C, not an official benchmark; cite it when referencing). For MoE models, each school drops roughly another 10 percentage points. Selection rule of thumb (same-source Level C): TP must not span NVLink domains (when crossing machines over IB, TP all-reduce slows down 20-40%); PP is only worthwhile at 128+ GPUs; below 1B use DDP/FSDP2.
Trends: after Megatron-Core built in a distributed optimizer, the "Megatron-DeepSpeed combination" was replaced; FSDP2/PyTorch TP/PP converge uniformly based on DTensor; torchtitan became the official reference implementation. Domestic in-house stacks: DeepSeek HAI-LLM (DualPipe open-sourced), Shanghai AI Lab InternEvo, Baidu PaddleNLP/KunlunMirror (Level C compiled).
1.4.2. Ablation and Optimization Methods (MegaScale Breakdown, Level A)
MegaScale's 55.2% vs. Megatron-LM's 41.2% (1.34x) comes from a reusable engineering breakdown: parallel Transformer blocks + sliding-window attention +5.6%, 3D parallel communication overlap +6.2%, efficient operators +1.7%, data pipeline +1.1%, LAMB large batch +3.0%. Among these, communication overlap (Megatron's --tp-comm-overlap splits All-Reduce into Reduce-Scatter + All-Gather and overlaps them with GEMM) is the largest single item common to all schools.
Figure 4-1|Llama 3's 54-Day Training Failure Profile and Effective Training Time
Data source: Meta's "The Llama 3 Herd of Models" official technical report (Level A); Epoch AI's checkpoint overhead estimate is a Level C model estimate. Bar widths are drawn proportionally for illustration (the second bar uses the full 466 interruptions as its base; bars 3 and 4 are sub-shares relative to the unexpected-interruption bar).
2. Glossary
| 术语 | 英文 / 缩写 | 释义 |
|---|---|---|
| 模型算力利用率 | Model FLOPs Utilization,MFU | 实际有效算力与理论峰值算力之比,训练框架的第一指标 |
| 有效训练时间比率 | Effective Training Time Ratio,ETTR | 有效训练时间占总占用时间的比例,容错能力核心指标 |
| 有效训练时长占比 | —— | 实际推进训练的时间占比,与 ETTR 同源但口径可能不同 |
| 张量并行 | Tensor Parallelism,TP | 单层权重切分到多卡,对 Scale-up 带宽最敏感 |
| 流水线并行 | Pipeline Parallelism,PP | 模型按层切分,需 128 卡以上规模才有收益 |
| 数据并行 | Data Parallelism,DP | 数据切分、各持完整副本,弹性恢复的基本粒度 |
| 序列并行 | Sequence Parallelism,SP | 序列维度切分,与 TP 配合降低激活显存 |
| 上下文并行 | Context Parallelism,CP | 长上下文序列的维度切分 |
| 专家并行 | Expert Parallelism,EP | MoE 专家分布到多卡/多节点 |
| 零冗余优化器 | ZeRO | DeepSpeed 的优化器状态分片技术(1/2/3 三级) |
| 全分片数据并行 | Fully Sharded Data Parallel,FSDP | PyTorch 原生全分片方案,FSDP2 基于 DTensor |
| 张量计算重叠 | tp-comm-overlap | Megatron 把通信与 GEMM 重叠的开关,MFU 最大单项来源之一 |
| 双向流水线 | DualPipe | DeepSeek HAI-LLM 开源的双向流水线调度技术 |
| 检查点 | Checkpoint | 训练状态周期性持久化;两阶段异步方案先写主机内存再落盘 |
| 飞行记录器 | NCCL Flight Recorder | 记录最近集合通信元数据与栈回溯,加速根因分析 |
| 计算掉队节点 | Straggler | 拖慢整体步调的节点,MegaScale 口径约占集群 0.5% |
| 静默数据损坏 | Silent Data Corruption,SDC | 无告警的计算错误,Llama 3 快照中归因 6 次 |
| 弱扩展效率 | Weak Scaling Efficiency | 规模与数据同步放大时效率的保持度,MegaScale 2240→11200 GPU 近线性 |
| MLPerf Training | —— | MLCommons 行业训练基准,当前统一口径为 v5.0(2025-06) |
| 有效训练基准作业集 | Regression Job Set | Harness/框架变更后用于回归验证的固定作业集合 |
3. Case Studies
3.1. ByteDance MegaScale: Efficiency and Fault Tolerance in Ten-Thousand-GPU Training
Evidence level: A (official paper, arXiv 2402.15627)
3.1.1. Background
When training a 175B model at 12,288-GPU scale, the default configuration of open-source frameworks cannot simultaneously meet MFU and stability: communication overhead, data-pipeline bottlenecks, and failure recovery all become major losses once scale is amplified.
3.1.2. Approach
- Efficiency: parallel Transformer blocks + sliding-window attention (+5.6% MFU), 3D parallel communication overlap (+6.2%), efficient operators (+1.7%), data-pipeline optimization (+1.1%), LAMB large batch (+3.0%), together raising MFU from Megatron-LM's baseline 41.2% to 55.2%.
- Stability engineering: Driver-Executor architecture + heartbeat monitoring (including training logs, RDMA traffic metrics); on anomalies, pause the whole cluster → lightweight self-check (loopback bandwidth, RNIC connectivity, NCCL communication tests) → isolate the faulty node → K8s provisions a healthy node → recover from the most recent checkpoint.
- Two-phase asynchronous checkpoint: Phase one writes GPU state to host memory (PCIe, a few seconds) and resumes training; phase two writes to HDFS asynchronously in the background; on recovery, a single worker in the same DP group reads and broadcasts, linearly reducing storage-bandwidth pressure.
- Observability: CUDA Event low-overhead profiling tools, with heatmaps locating compute stragglers (roughly 0.5% of the cluster); 3D parallel visualization for locating communication bottlenecks.
3.1.3. Results
- MFU 55.2% (12,288 GPUs, 175B), vs. Megatron-LM 41.2%, a 1.34x improvement.
- Weak scaling: 2,240 → 11,200 GPUs stays near-linear, MFU stable at about 54%.
- Harness reading: MegaScale's "detect-diagnose-isolate-replace-recover" pipeline is a textbook implementation of L3 fault-tolerant orchestration; its two-phase asynchronous checkpoint is an exemplary L4 "artifact-and-checkpoint" — it turns checkpoints from "the cost of pausing training" into "a background task running in parallel with training," directly lifting effective training time.
3.2. Meta Llama 3 405B: The 54-Day Failure Profile and Effective Training Time
Evidence level: A (official technical report "The Llama 3 Herd of Models"); some restatements are Level B
3.2.1. Background
Training the 405B model on 16,384 H100s (TP=8, PP=16, DP=8~128) used about 39.3M H100 GPU-hours in total. At this scale, the failure data was made public to an unprecedented degree, making it the de facto reference for the industry's failure profile.
3.2.2. Approach
- Fault-tolerance combination: heavily asynchronous checkpoints + hot-standby nodes + startup health checks.
- Diagnostic toolchain: PyTorch NCCL flight recorder (records the last N collective-communication metadata entries and stack backtraces) to speed up root-cause analysis; deep NCCLX integration for NVLink/RoCE fault detection and automatic timeout of stalled communication; straggler detection tools that prioritize troubleshooting problem traffic.
- SDC governance triad: FleetScanner (periodic fleet-wide testing), Ripple (co-located testing), Hardware Sentinel (telemetry + analysis to identify faults).
- Checkpoint trade-off: a three-way trade-off between frequency vs. write bandwidth vs. recovery loss (Epoch AI estimates the optimal interval at about 4 minutes; a Level C model estimate).
3.2.3. Results
- Failure profile (54-day snapshot): 466 interruptions = 47 planned + 419 unexpected (about one every 3 hours); among unexpected interruptions, GPU-related 58.7% (GPU faults 148 cases/30.1%, including NVLink; HBM3 memory 72 cases/17.2%); network switch/cable 35 cases (8.4%); only 2 CPU faults in 54 days; 6 cases attributed to GPU SDC.
- Effectiveness: effective training time ratio above 90%; only 3 cases needed major manual intervention, the rest were handled automatically.
- Harness reading: this profile ranks L5 observation priorities toward the hardware domain — GPU-related faults account for nearly 60%, meaning L5 hardware telemetry (ECC, NVLink, HBM) is more worth investing in than application-layer logs; "only 3 manual interventions" is the quantified benchmark for "automated escalation" at the L6 governance layer.
3.3. MLPerf Training v5.0: The Industry-Unified Benchmark Metric
Evidence level: A (MLCommons figures; media restatements are Level B)
3.3.1. Background
Cross-system comparison of training frameworks needs a unified benchmark. MLPerf Training v5.0 (released 2025-06-04) is the latest confirmed training-side figure as of the information cutoff date.
3.3.2. Approach
- 20 submitting organizations, 201 results — an all-time record.
- First-time introduction of a Llama 3.1 405B pretraining benchmark (replacing the GPT-3 benchmark), with submission volume exceeding that of every prior GPT-3 round.
- Lenovo submitted the first power benchmark set, bringing energy consumption into the performance comparison dimension.
- Flagship submission: CoreWeave + NVIDIA + IBM used 2,496 GB200 superchips (the largest GB200 NVL72 cluster in MLPerf history, 34x larger than previous cloud-vendor submissions), completing the 405B training task in 27.3 minutes — over 2x faster than comparable-scale clusters.
3.3.3. Results
- GB200 per-GPU training throughput reaches up to 2.6x equivalent Hopper (cross-cited via O'Reilly books, Level B/C).
- MLPerf Inference v5.0 per-GPU inference throughput is about 3.4x (same-source restatement).
- Harness reading: MLPerf is the industry-standard L5 regression set — when this group's AGENTS.md requires performance figures to state their source, "MLPerf" is a first-class source alongside "official releases/third-party measurements/vendor claims"; when selecting frameworks, MLPerf results serve as the upper-bound reference for same-generation hardware, but real projects must still build their own regression job sets.
- Metric boundary: as of 2026-09-12, no confirmation of new training-side results after MLPerf v5.1 was found; this is flagged as a gap.
4. Practical Standards
Nature statement: the following is a proposed draft distilled from public industry practices (MegaScale, Llama 3, MLPerf, etc.), not the text of an official industry standard. The group-level higher-level norms are in AGENTS.md in the same directory; below is a trimmed version for the training frameworks and scheduling direction.
4.1. AGENTS.md Specification
4.1.1. AGENTS.md (AI Infra Group · Training Frameworks and Scheduling Direction)
# AGENTS.md —— AI Infra 组 · 训练框架与调度方向
> 本文为基于行业实践提炼的建议稿,非官方行业标准原文。
> 上位规范:01-AI-Infra组/AGENTS.md(不可逆动作禁止清单、变更窗口、可观测要求)。
## 角色与边界
- 角色:训练框架与调度智能体,负责并行策略设计、框架选型与版本管理、
checkpoint 策略、故障检测与恢复编排、MFU/ETTR 诊断。
- 不负责:调度器全局策略修改(属禁止清单)、配额最终分配、
硬件采购与机房改造。
- 判定器为监控与基准:所有 MFU/ETTR/有效训练时长占比结论必须来自
真实监控数据或固定基准作业集回归。
## 环境假设
执行前必须显式声明:
- 加速器型号/数量/代际、Scale-up 域边界、Scale-out 网络与跨机带宽。
- 框架与版本(Megatron-LM / DeepSpeed / FSDP2 / 自研栈)、
调度器(Slurm/K8s)版本与分区拓扑。
- 模型结构(稠密/MoE、专家数)、目标并行策略、批量与序列长度。
- checkpoint 存储与写入带宽实测值、热备池容量。
- 未声明框架版本与并行策略时,禁止产出 MFU/扩展性结论。
## 上下文加载顺序(Context Budget)
1. 作业配置:并行策略、批量、checkpoint 频率、恢复策略。
2. 集群与拓扑:域边界、跨机带宽、分区。
3. 监控摘要:MFU、吞吐、通信占比、straggler、中断记录。
4. 框架变更记录与已知问题清单。
## 工具契约
- 框架与调度器通过封装接口访问;返回值含退出码、日志路径、关键数值、
作业标识、版本。
- 消融实验必须单变量:每次只改一个并行/优化开关,记录前后 MFU。
- 调度策略变更必须可回滚并先在影子队列验证。
## 任务执行流程(SOP)
- S1 需求解析:目标模型 → 并行约束(TP 不跨域、EP 带宽需求)。
- S2 基线建立:默认配置 MFU、中断频率、恢复耗时。
- S3 消融设计:参照 MegaScale 拆解(通信重叠、算子、数据管线、批量),
按预期收益排序。
- S4 受控验证:小规模复现消融,再灰度到目标规模。
- S5 容错验证:注入式故障演练(杀节点、拔线模拟),测检测时延/
隔离粒度/恢复耗时。
- S6 证据打包:与基线差值 + 中断原因分布 + 待人工确认项。
## 验证与证据要求
- MFU 结论注明模型、硬件代际、并行配置、精度格式;经验区间须标
"经验区间,非官方基准"。
- 容错结论三项齐备:故障检测时延、隔离粒度、恢复耗时。
- 消融各项收益与 MegaScale 类公开拆解对比时注明来源与规模差异。
- 跨规模比较使用弱扩展效率而非绝对吞吐。
## 失败与升级策略
- 有效训练时长占比连续下降 → 升级人工,附中断原因四分类
(硬件/网络/软件/数据)分布。
- 消融在小规模有效但规模放大后失效 → 停止灰度,回滚并记录。
- 疑似 SDC → 触发周期性全舰队测试与同置测试,升级硬件排查。
- checkpoint 写入耗时逼近故障平均间隔 → 调整为两阶段异步方案。
## 安全与合规红线
- 多租户配额与优先级变更走人工审批。
- 框架版本升级遵循兼容矩阵,禁止跨版本强升(属禁止清单)。
- 训练数据与 checkpoint 访问按租户隔离。
- 禁止残留非标准占位符。
## 输出格式
- 首行:可判定结论 + 阻塞项。
- 消融表:每项开关、MFU 变化、规模条件、来源。
- 容错报告:检测时延、隔离粒度、恢复耗时 + 中断原因分布。
- 调度变更:影响面、影子队列验证结果、回滚命令。
- 数值规范:参数带单位;范围用 ~ 连接;百分比数值与 % 之间不留空格。
## 评估与自检
- MFU 是否注明模型/代际/并行配置?
- 经验区间是否标注非官方基准?
- 容错三项是否齐备?
- 消融是否单变量?
- 是否残留非标准占位符? 4.2. SKILL.md Specification
4.2.1. SKILL.md (AI Infra Group · Training Efficiency Ablation and Fault Orchestration)
---
name: training-efficiency-ablation-and-fault-sop
description: AI Infra 组训练框架方向标准技能——MFU 消融诊断、并行策略设计、
checkpoint 与故障恢复编排。当需要提升 MFU、设计 TP/PP/DP/EP 组合、
优化 checkpoint、验证容错流水线、对标 MLPerf 口径时使用。
触发词:MFU、并行策略、Megatron、DeepSpeed、FSDP、checkpoint、ETTR、MLPerf。
version: 1.0
created: 2026-09-12
---
# AI Infra 组 · 训练效率消融与容错编排
> 本文为基于行业实践提炼的建议稿,非官方行业标准原文。
> 上位规范:01-AI-Infra组/AGENTS.md。
## 适用场景
- MFU 低于经验区间,需定位计算/通信/数据加载/调度碎片瓶颈。
- 并行策略(TP/PP/DP/EP/SP/CP)组合设计与跨域约束校验。
- checkpoint 策略设计与两阶段异步改造。
- 容错流水线(检测-诊断-隔离-替换-恢复)建设与演练。
- 框架选型(Megatron-LM / DeepSpeed / FSDP2 / 自研栈)与版本升级评估。
- MLPerf 口径对标与固定基准作业集建设。
## 前置条件
- 已声明框架版本、并行策略、模型结构、checkpoint 带宽、热备池。
- 存在基线 MFU 与中断记录;固定基准作业集可用。
- 影子队列或非生产分区可用于消融与演练。
## 输入
| 输入项 | 说明 | 必需 |
|---|---|---|
| 作业配置 | 并行策略、批量、序列长度、checkpoint 频率 | 是 |
| 集群拓扑 | Scale-up 域边界、跨机带宽、分区 | 是 |
| 基线指标 | MFU、吞吐、中断频率、恢复耗时 | 是 |
| 监控数据 | 通信占比、straggler、心跳/日志路径 | 是 |
| 框架变更记录 | 版本升级、开关变更历史 | 否 |
## 输出
| 输出项 | 说明 | 必需 |
|---|---|---|
| 可判定结论 | 通过 / 不通过 / 部分通过 + 阻塞项 | 是 |
| 消融报告 | 每项开关的 MFU 变化、规模条件、来源对照 | 是 |
| 并行策略方案 | TP/PP/DP/EP 映射与跨域校验结论 | 是 |
| 容错报告 | 检测时延、隔离粒度、恢复耗时 + 演练记录 | 是 |
| checkpoint 方案 | 频率/异步化设计 + 写带宽占用评估 | 条件必需 |
| 证据表 | 工具、版本、命令、日志路径、数值、时间窗口 | 是 |
## 执行步骤
1. 环境校验:框架版本、拓扑、checkpoint 带宽、影子队列可用性。
2. 基线确认:默认配置 MFU、通信占比、中断频率、恢复耗时。
3. 瓶颈分解:计算/通信/数据加载/调度碎片四类(CUDA Event 类低开销
剖析 + 3D 并行可视化)。
4. 消融设计:按预期收益排序(通信重叠 → 算子 → 数据管线 → 批量),
单变量执行,小规模复现后灰度放大。
5. 并行校验:TP 不跨 Scale-up 域、EP 带宽需求测算、PP 规模适用性。
6. 容错演练:注入故障(杀节点、断链模拟),测量检测时延、隔离粒度、
恢复耗时;验证两阶段异步 checkpoint。
7. 对标:与公开拆解(MegaScale 各项收益)与 MLPerf 同代结果对照,
注明规模与代际差异。
8. 交付:消融表 + 容错报告 + 回滚方案 + 待人工确认项。
## 质量标准(DoD)
- MFU 结论注明模型/硬件代际/并行配置/精度格式。
- 消融单变量;经验区间标注"非官方基准"。
- 容错三项齐备且有演练记录支撑。
- checkpoint 方案给出写带宽占用与恢复损失测算。
- 参照口径(不得直接套用):MegaScale 12,288 GPU MFU 55.2% vs
Megatron-LM 41.2%(A级);Llama 3 有效训练时间占比 >90%、419 次
意外中断、GPU 相关 58.7%(A级);MLPerf Training v5.0 = 20 机构
201 项、首设 Llama 3.1 405B 基准(A/B 级)。
## 常见失败与处理
| 失败模式 | 现象 | 处理 |
|---|---|---|
| TP 跨域 | 跨机 TP 使 all-reduce 掉速 20-40% | 重排并行映射,跨机改 PP/DP/EP |
| 消融多变量 | 同时改多个开关无法归因 | 强制单变量,逐项回退 |
| checkpoint 拖慢 | 写入耗时逼近故障平均间隔 | 两阶段异步化或调频率 |
| 规模放大失效 | 小规模收益在万卡消失 | 停止灰度,检查通信拓扑假设 |
| 疑似 SDC | 收敛异常无告警 | 全舰队测试 + 同置测试,升级人工 |
| 恢复慢 | 恢复耗时占比高 | 单 worker 读取再广播;检查热备池 |
## 示例
任务:某 8,000 卡作业 MFU 42%,目标提升至 50% 以上。
1. 环境校验:Megatron-Core 版本、TP/PP/DP 配置、checkpoint 带宽。
2. 基线:MFU 42%,通信占比 26%,数据管线等待 6%。
3. 瓶颈分解:通信重叠缺失为主因。
4. 消融:tp-comm-overlap 单项在 512 卡复现 +5.8%,灰度至 8,000 卡
+6.1%;Zero-Bubble 流水线 +2.2%;数据管线预取 +0.9%。
5. 并行校验:TP=8 限制在 Scale-up 域内,PP=16 确认规模适用。
6. 容错演练:杀节点场景检测时延 40 秒内、DP 组级隔离、恢复 8 分钟;
异步 checkpoint 写带宽占用达标。
7. 对标:拆解结构与 MegaScale 公开数据一致(规模不同,标注差异)。
8. 交付:通过——MFU 提升至 51.2%;消融表、容错报告、回滚方案齐备。
(示例数值为演示用假设值,非实测数据;方法论参照 MegaScale 与 Llama 3
公开实践。) 4.3. Implementation Checklist
| No. | Check Item | Acceptance Criterion | Required |
|---|---|---|---|
| 1 | Environment declaration | Framework version, parallelism strategy, checkpoint bandwidth declared | Yes |
| 2 | Baseline data | MFU, communication ratio, interruption frequency, recovery time recorded | Yes |
| 3 | Four-category breakdown | Compute/communication/data-loading/scheduling-fragment breakdown completed | Yes |
| 4 | Single-variable ablation | Change only one switch at a time and record it | Yes |
| 5 | Metric labeling | MFU states model/generation/config; empirical ranges labeled | Yes |
| 6 | Cross-domain validation | TP verified not to span Scale-up domains | Yes |
| 7 | Fault-tolerance triad | Detection latency, isolation granularity, recovery time all present | Yes |
| 8 | Checkpoint assessment | Write-bandwidth usage and recovery loss estimated | Yes |
| 9 | Drill records | Injected-fault drills have records | Yes |
| 10 | Regression job set | Fixed regression job set regression completed | Yes |
| 11 | Rollback plan | Framework/scheduling changes rollback-able | Yes |
| 12 | Placeholder cleanup | No non-standard placeholders such as XX, ___ | Yes |
5. Summary
In the Harness six-layer model, this direction's focus is L3 orchestration (parallel strategies and fault-tolerant recovery) and L5 evaluation (effective training time). Three conclusions:
- Improving MFU is a decomposable engineering problem. Every gain that took MegaScale from 41.2% to 55.2% is publicly reusable, with communication overlap the largest single item; framework selection should shift from "which framework is better" to "which switches work at my scale and topology," verified through single-variable ablations.
- Beyond ten thousand GPUs, fault-tolerant orchestration matters more than peak MFU. Llama 3's 419 unexpected interruptions and "only 3 manual interventions" together show that hitting an effective training time above 90% depends on a systematic combination of asynchronous checkpoints, hot-standby nodes, the flight recorder, and the SDC-governance triad — not on any single-point optimization.
- A unified benchmark is the prerequisite for cross-system dialogue. MLPerf Training v5.0 (which first introduced a Llama 3.1 405B benchmark) together with MFU/ETTR/effective-training-time-ratio forms a two-tier evaluation system of "industry metric + project metric"; after any framework or Harness change, regression must be run on a fixed regression job set.
Information-Gap Statement
The following items have not been confirmed by Level A/B sources and are marked [To be verified] in the main text:
- The MFU empirical ranges of the three major schools (Megatron 45-55%+ / FSDP2 35-45% / DeepSpeed 30-40%) and the selection rules of thumb (TP cross-domain slowdown 20-40%, PP 128-GPU threshold) are technical-community compilations, Level C, empirical ranges, not official benchmarks.
- The DeepSeek-V3 engineering optimizations (256 experts split into 16 communication groups, bidirectional pipeline overlap rate 98%, adaptive gradient compression saving 40% bandwidth) are restated figures, Level C; citing the DeepSeek-V3 technical report directly is recommended.
- Epoch AI's checkpoint overhead of 2.1% and optimal interval of 4 minutes are model estimates, Level C.
- The inventory of domestic in-house stacks (HAI-LLM, InternEvo, KunlunMirror) is a community-compiled figure, Level C.
- No new training-side results after MLPerf v5.1 have been confirmed as of 2026-09-12; the GB200-to-Hopper 2.6x/3.4x cross-cited figures are Level B/C restatements.
- No public AGENTS.md/SKILL.md standard template in this direction was found; this document is a proposed draft.
6. References
- MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs — ByteDance, arXiv 2402.15627, 2024. https://arxiv.org/abs/2402.15627
- The Llama 3 Herd of Models — Meta, 2024. https://arxiv.org/abs/2407.21783
- MLPerf Training v5.0 results release — MLCommons/PR Newswire, 2025-06-04. https://prn.to/3Zlln3j
- Megatron-LM — NVIDIA GitHub. https://github.com/NVIDIA/Megatron-LM
- DeepSpeed — Microsoft GitHub. https://github.com/microsoft/DeepSpeed
- torchtitan / FSDP reference implementation — PyTorch official. https://github.com/pytorch/torchtitan
- NCCL (including the flight recorder and 2.27 features) — NVIDIA GitHub. https://github.com/NVIDIA/nccl
- AI Infra (design side, cross-reference for the MFU/ETTR metric system) — 02-行业赋能/04-硬件研发组/05-ai-infra.md, 2026-09-12.
- MLCommons official site (benchmark metric) — MLCommons. https://mlcommons.org/
- DualPipe / HAI-LLM related open source — DeepSeek GitHub. https://github.com/deepseek-ai