ZeCO: Zero-Communication Overhead Sequence Parallelism for Linear Attention

Yuhong Chou, Zehao Liu, Rui-Jie Zhu, Xinyi Wan, Tianjian Li, Congying Chu, Qian Liu, Jibin Wu, Zejun Ma

Abstract

As Large Language Models (LLMs) evolve toward processing "infinite context," the quadratic computational complexity of standard self-attention ($O(L^2)$) has become a primary bottleneck. While linear attention models reduce this complexity to $O(L)$, scaling them across multiple GPUs via Sequence Parallelism (SP) has historically introduced significant communication overheads. This paper introduces ZeCO (Zero Communication Overhead), a novel SP strategy that utilizes a new communication primitive called All-Scan. By pipelining state transfers and overlapping communication with computation, ZeCO enables training on sequences up to 8 million tokens with near-linear scalability, effectively eliminating the bottlenecks inherent in previous distributed linear attention methods.

Introduction

The demand for ultra-long context windows in LLMs—reaching into the millions of tokens—requires distributing sequence data across multiple processing units. However, existing Sequence Parallelism (SP) methods for linear attention often struggle with efficiency. Methods like LASP-1 impose a serial dependency where GPUs must wait for their predecessors to finish, while methods like LASP-2 rely on massive "All-Gather" operations that saturate network bandwidth. These overheads frequently negate the theoretical efficiency gains of linear attention. ZeCO addresses these challenges by reimagining the communication requirements of linear attention as a distributed prefix sum problem.

The ZeCO Framework

ZeCO centers on the All-Scan collective communication operator, designed to minimize latency and maximize throughput during the forward and backward passes of linear attention training.

1. The All-Scan Primitive

Unlike standard All-Gather operations that collect all states from all GPUs, All-Scan implements a "receive-scan-send" pattern. Each GPU receives a partial state from its predecessor, updates it with local data (the "scan" operation), and immediately passes the updated state to the next GPU in the sequence. This approach ensures that each device only transmits the absolute minimum amount of data required to maintain state consistency.

2. Pipelining and Chunking

To break the strict serial dependency of traditional recurrent operations, ZeCO splits state tensors into smaller blocks. This allows for fine-grained pipelining: as soon as a GPU processes the first block of its local sequence, it transmits the resulting state to the next rank. This allows subsequent GPUs to begin their computations while the preceding GPUs are still working on later blocks, significantly reducing idle time across the cluster.

3. Communication-Computation Overlap

ZeCO is architected to hide communication latency by running the All-Scan operator in parallel with local diagonal attention computations. By the time the local computation is complete, the necessary state information from preceding ranks is often already available, leading to what the authors describe as near-zero communication overhead.

4. Mathematical Optimality

The authors demonstrate that ZeCO achieves the theoretical lower bound for communication volume in sequence parallelism, defined by the state size ($d_k \times d_v$). This efficiency ensures that the method remains viable even as sequence lengths and cluster sizes scale.

Experimental Evaluation

The effectiveness of ZeCO was evaluated using a 1-billion parameter Gated Linear Attention (1B-GLA) model within the Lingua training framework. Benchmarking was conducted on a cluster of 256 NVIDIA H100 (80GB) GPUs using synthetic sequences ranging from 16k to 8 million tokens.

Key Results

  • Throughput Gains: ZeCO achieved a 60% throughput speedup over the previous state-of-the-art (LASP-2) when training 8M-token sequences on 256 GPUs.
  • Communication Efficiency: The All-Scan primitive proved to be up to 3.9x faster than standard All-Gather methods. Furthermore, the "runtime extra cost"—the time spent on SP-specific logic rather than core training—was reduced by 9.3x compared to existing SOTA methods.
  • Near-Perfect Weak Scaling: A significant highlight of the results is ZeCO's ability to maintain performance parity across scales; training a 1M-token sequence across 64 devices took approximately the same time as training a 16k sequence on a single device, representing near-linear scaling.

Discussion and Future Work

ZeCO represents a significant step forward in making ultra-long context training practical. By treating linear attention as a distributed prefix sum, it resolves the tension between sequence length and hardware utilization.

Currently, the implementation is optimized for Gated Linear Attention (GLA) with diagonal decay. Future research may focus on generalizing the All-Scan primitive to other linear transform structures and exploring non-linear communication topologies (such as tree-based structures) to further reduce latency in massive-scale clusters. Additionally, while the backward pass is supported, further algorithmic refinements could optimize the gradient calculation phase to match the efficiency of the forward pass.

Summary updated

BibTeX
@inproceedings{chou2025zeco,
  author = {Yuhong Chou and Zehao Liu and Rui-Jie Zhu and Xinyi Wan and Tianjian Li and Congying Chu and Qian Liu and Jibin Wu and Zejun MA},
  title = {{ZeCO: Zero-Communication Overhead Sequence Parallelism for Linear Attention}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=eHRFb3DSZS},
}
Figure