AB
AiBoss
project

MT-MegatronLM - Moore's Threads open-source hybrid parallel training framework

MT-MegatronLM is an open-source hybrid parallel training framework developed by Moore's Threads for full-featured GPUs, primarily used for efficiently training large-scale language models. It supports dense models, multimodal models, and MoE (Hybrid Experts)...

What is MT-MegatronLM?

MT-MegatronLM is an open-source hybrid parallel training framework developed by Moore's Threads for full-featured GPUs, primarily used for efficiently training large-scale language models. It supports training dense models, multimodal models, and MoE (Mixed Experts) models. Based on full-featured GPUs, the framework supports FP8 mixed-precision strategies, high-performance operator libraries, and ensemble communication libraries, significantly improving the computational utilization of GPU clusters. Through model parallelism, data parallelism, and pipelined parallelism, it achieves efficient distributed training and supports mixed-precision training to reduce memory usage and accelerate computation.

Main functions of MT-MegatronLM

  • Supports multiple model architectures
    • Dense ModelsIt supports traditional Transformer architectures, such as GPT and BERT.
    • Multimodal ModelsIt can handle models that contain multiple modalities of data, such as text and images.
    • Hybrid Expert Models (MoE Models)It supports hybrid expert architectures with sparse activation, improving the flexibility and efficiency of the model.
  • High-efficiency hybrid parallel training
    • Model ParallelismDistribute model parameters across multiple GPUs to overcome the memory limitations of a single GPU.
    • Data ParallelismAccelerate the training process by distributing data across multiple GPUs.
    • Pipeline ParallelismThe model is divided into multiple stages, and throughput is improved through a pipeline approach.
  • High performance optimizationSupports FP8 mixed-precision strategies, reducing memory usage and accelerating computation. Integrates high-performance operator libraries (such as muDNN) to improve computational efficiency. Uses optimized ensemble communication libraries (such as MCCL) to reduce communication overhead.
  • Flexible scalabilitySupports training models ranging from small to very large scale, adapting to different hardware configurations. Optimized for parallel training on multi-GPU clusters, improving cluster utilization.

Technical principles of MT-MegatronLM

  • Hybrid Parallel Strategy: Split model parameters by dimension and distribute them across multiple GPUs to reduce single-card memory usage. Divide the model into multiple stages and distribute them across different GPUs, using micro-batch delivery to improve throughput. Divide the dataset across different GPUs, execute the same model, and aggregate gradients using All-Reduce.
  • Mixed precision trainingUsing techniques such as AMP or BF16, low-precision calculations are used in forward and backward propagation, while high-precision calculations are used in the critical path to maintain numerical stability.
  • High-efficiency optimizers and gradient aggregationIt provides a fused Adam optimizer, combining techniques such as ZeRO or 1-bit Adam to reduce communication overhead and save GPU memory. It uses operations like All-Reduce to aggregate gradients, ensuring global gradient consistency.
  • High-performance operator libraryExamples include muDNN, which is optimized for GPUs to improve computational efficiency.
  • Collective communication libraryFor example, MCCL optimizes inter-GPU communication and reduces communication overhead.

Project address of MT-MegatronLM

Application scenarios of MT-MegatronLM

  • Large-scale language model pre-trainingReproduce and train ultra-large-scale language models such as GPT-3, BERT, and T5.
  • Multimodal model trainingIt supports joint training of multiple data types such as images and text, and is suitable for the development of generative AI models.
  • Customized super-large modelUsers can design and train custom language models based on their own needs and datasets.
  • Enterprise-grade AI platformIt integrates with frameworks such as NVIDIA NeMo to provide end-to-end cloud-native solutions.
  • Scientific research and academic exploration: Used to compare the impact of different parallel strategies, parallel communication schemes, and deep model structures on the efficiency of large-scale training.