ByteScale: Efficient Scaling of LLM Training with a 2048K Context Length on More Than 12,000 GPUs

Hao Ge, Junda Feng, Qi Huang, Fangcheng Fu, Xiaonan Nie, Lei Zuo, Haibin Lin, Bin Cui, Xin Liu · DOI · OpenReview

Abstract: Scaling long-context ability is essential for Large Language Models (LLMs). To amortize the memory consumption across multiple devices in long-context training, inter-data partitioning (Data Parallelism) and intra-data partitioning (Context Parallelism) are commonly used. Current training frameworks predominantly treat the two techniques as orthogonal, establishing static communication groups as a fixed mesh. However, the mismatch between data heterogeneity and static mesh causes redundant communication and imbalanced computation. We introduce ByteScale, an efficient, flexible, and scalable LLM training framework. The core is Hybrid Data Parallelism (HDP), which unifies partitioning with a dynamic mesh design. ByteScale includes a communication optimizer to eliminate redundant transfers and a balance scheduler to mitigate computation imbalance. Evaluated on over 12,000 GPUs with models up to 141B parameters, ByteScale outperforms state-of-the-art systems by up to 7.89x.

The Long-Context Frontier

As Large Language Models (LLMs) evolve toward "long-context" capabilities—with windows reaching millions of tokens—traditional training infrastructures are hitting a wall. The memory and computation requirements for self-attention grow quadratically ($O(S^2)$) with sequence length ($S$). While techniques like Context Parallelism (CP) shard a single long sequence across multiple GPUs, current frameworks typically use a "static mesh" approach that assumes all sequences in a batch are of uniform length.

The Heterogeneity Bottleneck

In practice, real-world training data is highly heterogeneous. A single batch might contain thousands of short 4K-token documents alongside a few massive 2M-token sequences. Traditional frameworks often rely on padding to equalize sequence lengths, which wastes significant compute, or packing, which requires complex masking to prevent cross-sequence interference.

Data handling techniques: (b) padding results in wasted cycles, whereas (c) packing and (d) attention masking enable more efficient processing of mixed-length sequences.

This heterogeneity creates a fundamental mismatch with static GPU meshes. When a short sequence is sharded across a large group of GPUs designed for the longest sequences, it creates unnecessary network overhead. Furthermore, because long sequences require exponentially more computation, GPUs handling shorter data sit idle—creating "bubbles"—while waiting for the long-context GPUs to finish.

Hybrid Data Parallelism (HDP)

ByteScale introduces Hybrid Data Parallelism (HDP) to break the static mesh bottleneck. HDP unifies Data Parallelism (inter-sequence) and Context Parallelism (intra-sequence) into a single, flexible framework. Instead of a fixed grid, HDP treats tokens as the fundamental unit of distribution, allowing the system to build dynamic communication groups on the fly.

Challenges in static parallelism: (b) redundant peer-to-peer communication and (c) computational bubbles caused by sequence length imbalance.

As illustrated above, static parallelism suffers from two primary inefficiencies that ByteScale addresses:

  1. Redundant Communication: HDP uses data-aware sharding to ensure short sequences are processed by the minimum number of GPUs required, eliminating redundant cross-device talk.
  2. Imbalanced Computation: ByteScale employs a Balance Scheduler that "bucketizes" sequences by their computational weight (FLOPs). It then assigns more micro-batches to GPUs handling lighter workloads, ensuring all ranks synchronize gradients simultaneously.

Key Innovations and Results

Beyond HDP, ByteScale introduces Selective Activation Offloading. For extremely long sequences, the framework offloads activations to CPU memory. Because the computation is $O(S^2)$ while the data size is $O(S)$, the computation time for long sequences is sufficient to "perfectly mask" the slower PCIe transfer to the CPU.

The system was tested on a production cluster with over 12,000 GPUs, using models ranging from 7B to 141B parameters. Key results include:

  • Massive Speedups: ByteScale outperformed the baseline (MegaScale/Megatron-LM) by up to 7.89x on heterogeneous datasets.
  • Throughput Stability: Throughput remained remarkably stable as context length scaled, dropping by only ~8% when moving from 256K to 2M tokens.
  • Hardware Efficiency: Tensor Core utilization increased from ~10% in communication-bound baseline scenarios to a consistent 40%.

Conclusion

ByteScale demonstrates that moving away from rigid, static parallelism is essential for the next generation of LLM training. By embracing heterogeneity through Hybrid Data Parallelism and dynamic scheduling, ByteScale enables efficient scaling to million-token contexts on the world's largest GPU clusters. Future work will explore more advanced optimization algorithms to further refine data assignment and reduce heuristic dependency.

Summary updated

BibTeX
@inproceedings{ge2025bytescale,
  author = {Hao Ge and Junda Feng and Qi Huang and Fangcheng Fu and Xiaonan Nie and Lei Zuo and Haibin Lin and Bin Cui and Xin Liu},
  title = {{ByteScale: Efficient Scaling of LLM Training with a 2048K Context Length on More Than 12,000 GPUs}},
  booktitle = {SIGCOMM},
  year = {2025},
  doi = {10.1145/3718958.3754352},
}
Figure