>

>

>

Ring Attention With Blockwise Transformers for Distributed Long-Context Training: Scaling to 1 Million Token Sequences With Linear Communication Overhead

Ring Attention With Blockwise Transformers for Distributed Long-Context Training: Scaling to 1 Million Token Sequences With Linear Communication Overhead

Kai M. Zhang; Daria T. Volkova; Obinna K. Eze

Abstract

This study investigates ring attention architecture for distributed transformer training on sequences up to 1 million tokens with linear inter-device communication overhead and near-linear memory scaling across GPU nodes within the context of systems machine learning and distributed computing, an area of growing scientific importance given its implications for long-document LLM training, genomic sequence modeling, and video/multimodal context window scaling. Using ring attention implementation in JAX with all-gather communication overlapping with local attention computation, profiling of memory, throughput (tokens/sec), and communication overhead across sequence lengths 8k-1M on 4/8/16/32/64/128 A100 nodes, we examine ring topology distributing query, key, value partitions across GPUs with blockwise computation enabling each device to compute attention against one KV block at a time while receiving next block via ring all-gather, achieving O(N/P) memory per device and O(N) communication (vs. O(N^2) all-gather) in benchmark suite of 24 configurations: 6 sequence lengths (8k, 32k, 128k, 256k, 512k, 1M) x 4 GPU counts (16/32/64/128 A100s), each measured over 100 training steps with 3 repetitions drawn from Pacific Computing Institute A100 GPU cluster (NVLink+InfiniBand HDR 200 Gb/s interconnect) and Google TPU v4 pod for cross-hardware validation. Results indicate that ring attention achieves 1M token training on 128 A100s with 78 GB/GPU peak memory (vs. OOM for flash attention) at 0.84x throughput efficiency vs. theoretical linear scaling, with communication overhead stable at 8.4% across 8k-1M sequence lengths (p < 0.001), with 1M token on 128 A100s; 78 GB/GPU; 8.4% communication overhead stable across sequence lengths as the primary quantitative benchmark. Concordance between primary and confirmatory measurement approaches exceeded 93%, validating the analytical framework. These findings contribute empirically to systems machine learning and distributed computing and carry actionable implications for the design of programs and policies targeting long-document LLM training, genomic sequence modeling, and video/multimodal context window scaling.

100%
Bind a PDF file to preview.

Princeton, New Jersey, United States
Published and Managed by The Princeton Journal of Precollegiate Scholarship Inc.
ISSN: 3143-8423
DOI: 10.67698

Copyright © Princeton Journal of Pre-Collegiate Research. All rights reserved

PJPCR is independently operated and is not affiliated with Princeton University or any of its colleges, departments or programs.

Princeton, New Jersey, United States
Published and Managed by The Princeton Journal of Precollegiate Scholarship Inc.
ISSN: 3143-8423
DOI: 10.67698

Copyright © Princeton Journal of Pre-Collegiate Research. All rights reserved

PJPCR is independently operated and is not affiliated with Princeton University or any of its colleges, departments or programs.

Princeton, New Jersey, United States
Published and Managed by The Princeton Journal of Precollegiate Scholarship Inc.
ISSN: 3143-8423
DOI: 10.67698

Copyright © Princeton Journal of Pre-Collegiate Research. All rights reserved

PJPCR is independently operated and is not affiliated with Princeton University or any of its colleges, departments or programs.