FlashFlex: Accommodating Large Language Model Training over Heterogeneous Environment

Ran Yan, Youhe Jiang, Wangcheng Tao, Xiaonan Nie, Bin Cui, Binhang Yuan · DOI

Introduction

Training state-of-the-art Large Language Models (LLMs) like Llama-3 or GPT-4 typically necessitates massive clusters of identical, high-performance GPUs. This "homogeneity requirement" stems from the design of current training frameworks, such as Megatron-LM and DeepSpeed, which rely on fully symmetric partitioning. In these systems, every parallel group must handle an identical workload.

When researchers attempt to mix hardware—for instance, pairing an NVIDIA A100 with a consumer-grade 3090—traditional systems default to the speed of the slowest device. This leaves high-end hardware significantly underutilized. Furthermore, varying network speeds across NVLink, PCIe, and standard Ethernet create communication bottlenecks that rigid frameworks cannot navigate. HexiScale (the system implementation of the FlashFlex approach) addresses these challenges by breaking the requirement for symmetry in LLM training.

Fully Asymmetric Parallelism

The core innovation of HexiScale is its departure from symmetric partitioning. Unlike traditional systems that force uniform configurations, HexiScale allows for "mismatched" setups across the cluster. Different pipelines can operate with different batch sizes, varying numbers of transformer layers per stage, and even distinct degrees of Tensor Parallelism (TP).

Figure 1: Comparison between Homogeneous and Heterogeneous Training Paradigms. HexiScale allows for asymmetric layer distribution and microbatch counts to balance the load across mismatched hardware.

By allowing a faster GPU to take on more layers or a larger microbatch than its slower neighbor, the system balances the "time-per-iteration" across the entire cluster. This bandwidth-first allocation prioritizes high-speed links (like NVLink) for communication-intensive Tensor Parallelism, while relegating slower links to Pipeline Parallelism, where communication volumes are lower.

Two-Phase Hierarchical Scheduling

Optimizing a model's split across hundreds of mismatched GPUs is an NP-hard problem. HexiScale employs a two-phase hierarchical scheduling algorithm to find near-optimal plans efficiently:

  1. Global Partitioning: The GPU cluster is modeled as a graph where edges represent interconnect bandwidth. A multi-level graph partitioning algorithm groups GPUs into "pipeline" units, ensuring that devices with high-speed connections remain together to minimize data-parallel communication costs.
  2. Pipeline Layout: For each pipeline group, the system searches for the best internal strategy (layers per GPU) and uses a greedy search to determine the execution order of stages, effectively minimizing idle time or "bubbles."

This scheduling approach is highly scalable; it can generate a training plan for a 320-GPU cluster in less than two minutes, a task that would take traditional MILP solvers hours or days.

Experimental Results

HexiScale was evaluated using Llama-2 (7B, 13B) and Llama (30B) models across three distinct heterogeneous environments. These settings included mixtures of NVIDIA A800, 4090, 3090, and 3080Ti GPUs connected via a combination of NVLink, PCIe, and 1 Gb/s Ethernet.

Figure 5: Model FLOPS Utilization (MFU) comparison across different hardware settings for Llama2-7B and 13B. HexiScale consistently maintains high MFU in heterogeneous environments where traditional frameworks like Megatron and FSDP suffer or fail (OOM).

The results demonstrate that HexiScale effectively closes the performance gap between heterogeneous and homogeneous clusters. It achieved Model FLOPS Utilization (MFU) comparable to theoretical homogeneous benchmarks, with an average performance gap of only 3.5%. Notably, HexiScale outperformed Metis (a recent competitor) by up to 1.9x and significantly surpassed Galvatron by reducing pipeline bubbles and communication overhead. In several heterogeneous scenarios where standard frameworks like FSDP or Megatron-LM encountered Out-of-Memory (OOM) errors, HexiScale continued to operate efficiently.

Conclusion and Future Work

HexiScale demonstrates that the homogeneity requirement is not a fundamental necessity for LLM training but rather a limitation of current software frameworks. By embracing asymmetry and hierarchical scheduling, it makes large-scale model training more accessible to organizations with fragmented hardware resources.

Future research will focus on dynamic re-scheduling to handle "straggler" nodes that may join or leave a cluster during long training runs. Additionally, the team aims to extend HexiScale to support Mixture-of-Experts (MoE) models, which present even more complex communication patterns than the dense transformer models evaluated here.

Summary updated

BibTeX
@misc{yan2024flashflex,
  author = {Ran Yan and Youhe Jiang and Wangcheng Tao and Xiaonan Nie and Bin Cui and Binhang Yuan},
  title = {{FlashFlex: Accommodating Large Language Model Training over Heterogeneous Environment}},
  year = {2024},
  eprint = {2409.01143},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.01143},
}
Figure