# Megatron-LM
NVIDIA による SOTA の OSS LLM 訓練フレームワーク。3D parallelism(data + tensor + pipeline)を統合しハードウェア資源を活用する。tensor parallelism と interleaved 1F1B pipeline scheduling を提供する。(Source: [[@2024__NSDI__MegaScale - Scaling Large Language Model Training to More Than 10,000 GPUs]], §2, §6.1)
- リポジトリ: github.com/NVIDIA/Megatron-LM
- [[MegaScale]] はこの上に構築され、本番ベンチマークの比較対象となる。MegaScale は 175B・12,288 GPU で Megatron-LM 比 1.34× MFU(55.2% vs 41.2%)。
- [[ByteDance]] の社内 Megatron-LM 実装は、オンライン SDC(Silent Data Corruption)検知システム AEGIS の実装基盤にもなっている。(Source: [[@2026__OSDI__Safeguarding LLM Training at Scale - Online SDC Detection and Insights from 35 Million GPU Hours]])
- **原典論文**: [[Mohammad Shoeybi]] ほか NVIDIA による arXiv:1909.08053(2019)。Transformer の MLP(列-行分割)と多頭注意(ヘッド単位分割)へのレイヤー内テンソル並列を提案し、カスタムコンパイラ不要で PyTorch 数行で実装。512 GPU・8.3B パラメータで 76% スケーリング効率・15.1 PetaFLOPS を達成した。BERT Pre-LayerNorm という副次的発見も含む。(Source: [[@2019__arXiv__Megatron-LM Training Multi-Billion Parameter Language Models Using Model Parallelism]])
- 並列化戦略の文献では tensor parallelism の 1-D 分割の代表として参照される([[並列化戦略]])。
- Fixstars 社内で NVIDIA H100 16GPU 向けにメモリ消費量を極端に抑えて作られた Llama3 70B 事前学習スクリプトの実装基盤として使われ、これを NVIDIA H200 へ移植する事例で、最適化器変更・ハイパーパラメータ変更により損失半減時間を 36 時間→4 時間(9 倍速)に短縮した。(Source: [[@2026__技術評論社__実践的パフォーマンスエンジニアリングによるAI高速化 - Chapter 6 実践3:LLM事前学習]])
- ストラグラー分析論文(OSDI 2025)はカスタマイズ版の Megatron-LM を学習基盤として用いている。(Source: [[@2025__OSDI__Understanding Stragglers in Large Model Training Using What-if Analysis]])
- Mycroft(SOSP 2025)は集合通信層の信頼性デバッグの関連実体として Megatron-LM を挙げる。(Source: [[@2025__SOSP__Mycroft - Tracing Dependencies in Collective Communication Towards Reliable LLM Training]])
- [[NCCLX]]([[@2025__arXiv__Collective Communication for 100k+ GPUs]])では、Llama 訓練の TP が Megatron-LM 類似であると参照され、[[CTran]] の RMA Put による細粒度オーバーラップの説明文脈で用いられる。(Source: [[@2025__arXiv__Collective Communication for 100k+ GPUs]], §5.2)
- SPPO([[@2026__ICS__SPPO - Making Million-Token LLM Training Practical on Modest GPU Clusters]])は Megatron-LM を主要ベースラインとして比較し、部分系列単位の適応的オフロード・パイプラインスケジューリングにより GPT-65B で最大 3.38 倍のスループット改善を報告した。Megatron-LM(チューニング版含む)は長系列(GPT-7B で 896K トークン超)で OOM に陥る限界が指摘された。(Source: [[@2026__ICS__SPPO - Making Million-Token LLM Training Practical on Modest GPU Clusters]])
- GPUPerf([[@2025__arXiv__Efficient Fine-Grained GPU Performance Modeling for Distributed Deep Learning of LLM]])は [[DeepSpeed]] と Megatron-LM を統合した [[GPT-NeoX]] を実装フレームワークとし、その演算をオペレータ単位に分解して性能モデリングする。(Source: [[@2025__arXiv__Efficient Fine-Grained GPU Performance Modeling for Distributed Deep Learning of LLM]])
- [[XPUTimer]](Flare、[[@2025__arXiv__XPUTimer - Anomaly Diagnostics for Divergent LLM Training in GPU Clusters of Thousand-Plus Scale]])は Megatron を含む 4 バックエンドを非侵入計装の対象とし、Megatron timer の誤有効化による不要同期を新規メトリクスで検知するケーススタディを報告する。(Source: [[@2025__arXiv__XPUTimer - Anomaly Diagnostics for Divergent LLM Training in GPU Clusters of Thousand-Plus Scale]])
- [[PrismLLM]]([[@2026__arXiv__A Few GPUs, A Whole Lotta Scale]])はオープンソース Megatron-LM 実装による Qwen3 MoE 事前学習を評価対象とし、2,048-GPU テストベッド上で最大 1.01T パラメータモデルの訓練を無改変で少数 GPU にエミュレートする。反復時間・ピークメモリの両方でベースライン(Megatron-LM 直接実行)との誤差をそれぞれ 0.58%・0.01% 未満に抑える。(Source: [[@2026__arXiv__A Few GPUs, A Whole Lotta Scale]])
- [[@2023__MLSys__Reducing Activation Recomputation in Large Transformer Models]](Korthikanti+ MLSys2023)では Megatron-LM のテンソル並列化を前提に [[シーケンス並列化]] と [[選択的活性化再計算]] を提案・実装した。530B MT-NLG モデルで 29% 高速化(MFU 42.1% → 54.2%)を実証。[[Vijay Korthikanti]] 筆頭・[[Bryan Catanzaro]] 責任著者。(Source: [[@2023__MLSys__Reducing Activation Recomputation in Large Transformer Models]])
- [[MEGATRACE]]([[@2026__ICDCS__MEGATRACE - Troubleshooting Hang and Slowdown in Large-scale LLM Training Clusters]], ICDCS 2026)は Megatron-LM mcorev0.7 をワークロードに用いる。Megatron-LM では集合通信 API 呼び出しの種類がわずか 6 種類(Broadcast・AllReduce・AllGather・ReduceScatter・Send・Recv)であることを「計算の narrow waist」と位置づけ、TP グループの AllReduce/AllGather/ReduceScatter、PP グループの対になった Send/Recv、DP グループの反復末尾 AllGather&ReduceScatter という呼び出しパターンからハング・スローダウンを診断する。(Source: [[@2026__ICDCS__MEGATRACE - Troubleshooting Hang and Slowdown in Large-scale LLM Training Clusters]])
[[CCL-Bench]]([[@2026__arXiv__CCL-Bench 1.0 - A Trace-Based Benchmark for LLM Infrastructure]])は、[[CCL-Search]](LLMエージェントによる構成自動探索)を用いてLlama-3.1-8B(16 Perlmutter GPU)上でMegatron-LMと[[TorchTitan]]をそれぞれ15イテレーション探索し、Megatron-LMの最良構成(TP=4, DP=1, PP=4、step time 0.44s)がTorchTitanの最良構成(TP=1, DP=4, PP=4、1.50s)より3.4倍高速であるという、フレームワーク間で構成の最適点が転移しないことを実証した。TorchTitanの最適構成をMegatron-LMへ適用すると1.3sとなり、Megatron-LM自身の最適比で3倍遅い。(Source: [[@2026__arXiv__CCL-Bench 1.0 - A Trace-Based Benchmark for LLM Infrastructure]])
Wan+ のサーベイ([[@2024__TMLR__Efficient Large Language Models - A Survey - Chapter 4 LLM Frameworks]], Table 2)は、Megatron(Megatron-LM)を DeepSpeed と並ぶ学習・微調整・推論すべて対応のフレームワークとして位置づける。3D Parallelism・Sequence Parallelism・Expert Parallelism・FasterTransformer による推論最適化・FlashAttention・Selective Activation Recomputation を主要機能に挙げ、量子化や RLHF といった機能を持つ DeepSpeed・Colossal-AI と比べ、テンソル演算分割そのものの最適化(NVIDIA GPU 向けのハードウェア協調設計)に機能セットが絞られている点を特徴とする。(Source: [[@2024__TMLR__Efficient Large Language Models - A Survey - Chapter 4 LLM Frameworks]])
## 関連
- ソース: [[@2019__arXiv__Megatron-LM Training Multi-Billion Parameter Language Models Using Model Parallelism]] / [[@2024__NSDI__MegaScale - Scaling Large Language Model Training to More Than 10,000 GPUs]] / [[@2025__OSDI__Understanding Stragglers in Large Model Training Using What-if Analysis]] / [[@2025__SOSP__Mycroft - Tracing Dependencies in Collective Communication Towards Reliable LLM Training]] / [[@2025__arXiv__Collective Communication for 100k+ GPUs]] / [[@2025__arXiv__Efficient Fine-Grained GPU Performance Modeling for Distributed Deep Learning of LLM]] / [[@2025__arXiv__XPUTimer - Anomaly Diagnostics for Divergent LLM Training in GPU Clusters of Thousand-Plus Scale]] / [[@2023__MLSys__Reducing Activation Recomputation in Large Transformer Models]] / [[@2026__arXiv__A Few GPUs, A Whole Lotta Scale]] / [[@2026__技術評論社__実践的パフォーマンスエンジニアリングによるAI高速化 - Chapter 6 実践3:LLM事前学習]] / [[@2026__ICDCS__MEGATRACE - Troubleshooting Hang and Slowdown in Large-scale LLM Training Clusters]] / [[@2026__arXiv__CCL-Bench 1.0 - A Trace-Based Benchmark for LLM Infrastructure]] / [[@2024__TMLR__Efficient Large Language Models - A Survey - Chapter 4 LLM Frameworks]] / [[@2026__TACO__BridgedRing - A Cost-Effective Hardware-Software Co-Design to Overcome the UPI Bottleneck in GPU Servers]]
- エンティティ: [[MegaScale]] / [[ByteDance]] / [[NCCLX]] / [[GPT-NeoX]] / [[DeepSpeed]] / [[XPUTimer]] / [[Vijay Korthikanti]] / [[Bryan Catanzaro]] / [[Mohammad Shoeybi]] / [[MEGATRACE]] / [[TorchTitan]] / [[CCL-Search]] / [[CCL-Bench]] / [[Colossal-AI]]
- 概念: [[並列化戦略]] / [[LLM分散学習]] / [[シーケンス並列化]] / [[選択的活性化再計算]]
## 出典
- [[@2026__TACO__BridgedRing - A Cost-Effective Hardware-Software Co-Design to Overcome the UPI Bottleneck in GPU Servers]](GPT-6.7B/GPT-13B学習でBridgedRingの評価に使用)