cs.DCFeb 25, 2026

Efficient Scaling of LLM Training with Flexible Context Parallelism

Authors: Yifan Niu, Han Xiao, Dongyi Liu, Wei Zhou, Jia Li

Organizations: The Hong Kong University of Science and Technology (Guangzhou) · Huawei Technologies Co., Ltd. · The Hong Kong University of Science and Technology

Abstract

Scaling long-context capabilities is crucial for Large Language Models (LLMs). However, real-world data contain a large number of sequences with heterogeneous lengths. Existing training libraries for LLMs rely on static parallelism strategies, which suffer from severe load imbalance, redundant communication, and suboptimal hardware utilization under data heterogeneity. In this work, we propose Flexible Context Parallelism (FCP), an efficient parallelism strategy that adaptively reconfigures communication groups and context parallelism degrees during LLM training. We generalize more flexible non-power-of-two parallelism degrees and develop a polynomial-time algorithm to generate near-optimal parallelism strategies with only millisecond-level overhead per training batch. FCP is able to maintain high hardware efficiency even under extreme data heterogeneity. Experimental results demonstrate that FCP significantly outperforms Megatron-LM and DeepSpeed in both LLM and MLLM training, achieving up to 1.46x speedup in average throughput while maintaining near-linear scaling efficiency across large-scale clusters. For extremely unbalanced batches, FCP even achieves 2.24x speedup.

Figures & tables

Appendix figures & tables3 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. FlashCP: Load-Balanced Communication-Efficient Context Parallelism for LLM Training

    Jun 7, 2026Zheng Wang, Eric Liu, Linan Jiang +5Communication-Efficient Distributed TrainingLong-Context Language Modeling

  2. Concertina: Data-Centric Adaptive Pipeline Parallelism for Efficient Heterogeneous Long-Context LLM Training

    Sep 25, 2025Shiju Wang, Yujie Wang, Fangcheng Fu +6Long-Context Language ModelingEfficient Language Model Training

  3. AutoSP: Unlocking Long-Context LLM Training Via Compiler-Based Sequence Parallelism

    Apr 29, 2026Ahan Gupta, Zhihao Wang, Neel Dani +3Efficient Language Model TrainingLLM Training