MoFa: A Unified Performance Modeling Framework for LLM Pretraining

Lu Zhao, Rong Shi, Shaoqing Zhang, Shangchao Su, Ziqing Yin, Zhiyan Cui, Hongfeng Sun, Baoguo He, Yueqiang Chen, Liang Dong, Xiyuan Li, Lingbin Wang, Lijun Ma, Qiang Huang, Ting Liu, Chong Wang, Can WeiarXiv 2025 · DOI

Abstract

Large language model (LLM) pretraining at scale involves complex orchestration of parallel strategies and hardware reliability challenges. We present MoFa, a unified performance modeling framework that predicts training efficiency with over 97% accuracy. By integrating multi-dimensional software optimizations and real-world cluster fault data, MoFa enables engineers to identify optimal training configurations without costly trial-and-error on thousands of GPUs.

Introduction

Training a trillion-parameter model is a massive orchestration challenge. Engineers must select from a "combinatorial explosion" of parallel strategies—including Data, Tensor, Pipeline, Sequence, Expert, and Context parallelism—alongside various memory optimizations. Existing performance models typically fall short in two critical areas:

  1. Computation-Communication Overlap: They fail to accurately account for the technique of overlapping GPU mathematical operations with network data transfers.
  2. Real-world Reliability: They treat training as a continuous process, ignoring the massive overhead of fault tolerance. In a cluster of 16,000 GPUs, hardware failures occur frequently, necessitating regular checkpoints and recovery procedures.

Methods

The MoFa framework consists of three primary pillars designed to address these complexities:

1. Base Cost Model ($CostModel_{base}$)

This "white-box" simulation decomposes a transformer layer into its fundamental mathematical operations (FLOPs) and communication requirements. It provides the baseline for performance estimation before accounting for advanced optimizations.

2. Optimization-Aware Modeling ($CostModel_{Mo}$)

MoFa introduces specific scaling factors to model advanced features such as TP/CP/EP overlap, activation recomputation strategies, and CPU optimizer offloading. This allows the framework to capture the nuances of modern training stacks.

GPU memory trend and pipeline execution showing computation-communication overlap.

3. Fault Tolerance Modeling ($CostModel_{Fa}$)

Instead of assuming 100% uptime, MoFa utilizes historical reliability data from large-scale clusters to model the Effective Pretraining Time Ratio (ETTR). It accounts for three levels of failures—process, pod, and job level—and calculates the optimal checkpointing frequency to balance safety and performance.

The multi-level fault perception and recovery process modeled in MoFa.

Key Results and Insights

The framework was evaluated using configurations from LLaMA2-70B, LLaMA3-405B, and DeepSeek-V3-671B.

  • High Accuracy: MoFa achieved 99.6% accuracy for LLaMA2-70B on 128 GPUs and maintained 97.65% accuracy when scaled to 1024 GPUs.
  • The "More Chunks" Fallacy: In Pipeline Parallelism (PP), increasing micro-batches (chunks) to reduce idle "bubble" time eventually hits a point of diminishing returns due to communication overhead. For LLaMA3-405B, 8 chunks were found to be more efficient than 16.
  • CPU Offloading Efficiency: For massive models, offloading optimizer states to the CPU can be more efficient than distributed optimizers, as the freed GPU memory allows for parallel strategies with lower communication overhead.
  • Scaling Limits: Increasing "supernode" size (GPUs with ultra-fast interconnects) beyond a certain point yields marginal gains. The performance difference between 32 and 256 GPUs in a supernode was less than 4%.

Conclusion

MoFa provides a robust tool for optimizing LLM pretraining at scale. By accurately modeling both software optimizations and hardware reliability, it allows for the rapid identification of efficient training configurations. Future work will focus on creating "digital twins" of training clusters and developing automated hardware recommendations to further streamline the pretraining process.

Summary updated

BibTeX
@misc{zhao2025mofa,
  author = {Lu Zhao and Rong Shi and Shaoqing Zhang and Shangchao Su and Ziqing Yin and Zhiyan Cui and Hongfeng Sun and Baoguo He and Yueqiang Chen and Liang Dong and Xiyuan Li and Lingbin Wang and Lijun Ma and Qiang Huang and Ting Liu and Chong Wang and Can Wei},
  title = {{MoFa: A Unified Performance Modeling Framework for LLM Pretraining}},
  year = {2025},
  eprint = {2511.09837},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.09837},
}
Figure