ByteScale: Communication-Efficient Scaling of LLM Training with a 2048K Context Length on 16384 GPUs

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

TL;DR

ByteScale introduces Hybrid Data Parallelism (HDP), a novel training framework that breaks the rigid, static constraints of traditional Data and Context Parallelism. By dynamically adapting to highly variable sequence lengths, ByteScale eliminates redundant communication and balances workloads across massive clusters, achieving up to a 7.89× training speedup on over 12,000 GPUs with context lengths up to 2,048K.

What Problem Does This Paper Address?

To train Large Language Models (LLMs) with massive context windows (e.g., 128K to 2M tokens), engineering teams typically rely on a combination of Data Parallelism (DP) to distribute different sequences across devices, and Context Parallelism (CP) to shard individual ultra-long sequences across multiple GPUs. Existing frameworks treat DP and CP as individual, orthogonal strategies, organizing GPUs into a rigid, static 2D mesh.

However, real-world data is highly heterogeneous. Sequence lengths are heavily skewed; a single batch might contain thousands of short conversations alongside a few massive documents.

Sample and token distribution across datasets showing extreme length heterogeneity.

This mismatch between data heterogeneity and static system design creates two major inefficiencies:

  1. Redundant Communication: Shorter sequences packed together are forced through the same massive CP communication ring as long sequences, wasting network bandwidth.
  2. Imbalanced Computation: Because self-attention computation scales quadratically ($O(S^2)$) with sequence length, packing sequences to equalize token counts does not equalize computational effort. GPUs processing longer sequences take significantly more time, leaving other GPUs idling during synchronization.

Methods

ByteScale tackles these challenges by replacing the traditional DP $\times$ CP mesh with Hybrid Data Parallelism (HDP) and pairing it with two key system components:

  • Hybrid Data Parallelism (HDP): HDP unifies inter- and intra-data partitioning by focusing on evenly distributing tokens rather than sequences across devices. Crucially, it allows heterogeneous behavior among GPU ranks, meaning different communication groups can form dynamically based on the specific requirements of the sequences they hold.
  • Communication Optimizer:
  • Data-Aware Sharding: Dynamically constructs communication groups so that short sequences are processed by the minimum required number of devices, avoiding unnecessary cross-device overhead.
  • Selective Offloading: For ultra-long sequences, it selectively offloads activation tensors to CPU memory.
  • Balance Scheduler: A heuristic algorithm that mitigates computational imbalance. It breaks the traditional constraint that all ranks must execute the same number of micro-batches. Instead, it groups sequences into buckets based on FLOP requirements and assigns more micro-batches to ranks processing shorter sequences, ensuring all GPUs finish at the same time.

Datasets

The framework was evaluated using two datasets exhibiting realistic sequence length distributions:

  • GitHub: An open-source dataset used to represent typical code/text distributions.
  • Byted: A production-grade long-context training dataset where ultra-long sequences ($\ge$ 2M tokens) make up just 0.05% of the samples but contribute 12.1% of the total tokens.

Key Insights and Ideas

  • Tokens as First-Class Citizens: Shifting the parallelization strategy from sequence-level partitioning to token-level allocation allows the system mesh to be fluid rather than static.
  • Exploiting Asymptotic Complexity for Offloading: The authors realized that because attention computation scales quadratically ($O(S^2)$) while activation memory scales linearly ($O(S)$), ultra-long sequences provide a unique opportunity. The massive compute time completely masks the PCIe transfer time ($O(S)$) required to offload activations to the CPU via DMA engines, saving GPU memory without sacrificing throughput.
  • Rethinking Gradient Accumulation Constraints: Traditional systems mandate an identical number of micro-batches per rank to ensure clean gradient synchronization. ByteScale proves that ranks can process different numbers of micro-batches within a step while maintaining perfect mathematical equivalence for the global gradient update.

Key Results

ByteScale was evaluated on a production cluster of more than 12,000 GPUs, scaling model sizes from 7B to 141B parameters (including dense LLaMA models and Mistral Mixture-of-Experts models) with context lengths up to 2,048K.

Throughput comparisons demonstrating ByteScale's performance gains over the baseline.
  • Up to 7.89× Speedup: On the GitHub dataset with a 2M context length, ByteScale outperformed MegaScale (a state-of-the-art baseline) by up to 7.89×. On the denser Byted dataset, it achieved up to a 4.26× speedup.
  • Hardware Efficiency: The framework stabilized GPU Tensor Core utilization at a consistent ~40% (up from ~10% in communication-bound baselines) and cut peak RDMA network traffic in half by eliminating redundant communications.

Limitations and Future Work

  • Pipeline Parallelism Complexity: The authors noted that balancing workloads when Pipeline Parallelism (PP) is active is significantly more challenging than with Data Parallelism alone. The "PP-Balance" strategy yielded lower overall speedups (3.42×–4.28×) compared to the "DP-Balance" strategy (6.21×–7.89×) due to the strict sequential dependencies between pipeline stages.
  • Hidden Hardware Details: Due to commercial confidentiality, specific details regarding the GPU models and cluster interconnect topology were omitted from the paper.

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: Communication-Efficient Scaling of LLM Training with a 2048K Context Length on 16384 GPUs}},
  booktitle = {SIGCOMM},
  year = {2025},
  doi = {10.1145/3718958.3754352},
}
Figure