Arctic Long Sequence Training: Scalable And Efficient Training For Multi-Million Token Sequences

Stas Bekman, Samyam Rajbhandari, Michael Wyatt, Jeff Rasley, Tunji Ruwase, Zhewei Yao, Aurick Qiao, Yuxiong HearXiv 2025 · DOI

Introduction

Snowflake AI Research has introduced Arctic Long Sequence Training (ALST), an open-source suite of optimizations designed to overcome the memory bottlenecks associated with training Large Language Models (LLMs) on multi-million token sequences. By integrating a refined version of Ulysses sequence parallelism with a novel "Sequence Tiling" approach, ALST enables a staggering 400x+ increase in supported sequence length. Notably, the system scales Llama-3-8B to 15 million tokens using only four compute nodes.

The Memory Bottleneck in Long-Context Training

While modern LLMs like Llama 3.1 and Qwen 2.5 are designed to support context windows of 1M to 10M tokens, training or fine-tuning at these lengths remains computationally prohibitive for most researchers. Standard training frameworks, such as those provided by Hugging Face, are not optimized for memory efficiency at this scale. On a high-end NVIDIA H100 (80GB), a standard Llama-8B model typically encounters Out-of-Memory (OOM) errors at just 32K tokens.

The challenges are primarily driven by three factors:

  1. Linear Activation Growth: Intermediate tensors (activations and logits) grow linearly with sequence length.
  2. Integration Complexity: Existing solutions like Ring Attention often require invasive modifications to model kernels, making them difficult to use with standard libraries.
  3. Framework Overheads: PyTorch exhibits hidden memory overheads and fragmentation issues that become critical at multi-million token scales.

Methodology

ALST introduces three primary pillars of optimization to provide "out-of-the-box" compatibility with the Hugging Face ecosystem:

1. Extended Ulysses Sequence Parallelism

Based on DeepSpeed-Ulysses, this technique shards the sequence across GPUs. ALST extends this implementation to support modern attention architectures such as Grouped-Query Attention (GQA) and Multi-Query Attention (MQA). Unlike Ring Attention, Ulysses is attention-agnostic; it reformats data before it reaches the attention block, facilitating easier integration with existing models.

Extended Ulysses sequence parallelism architecture sharding sequences across GPUs.

2. Sequence Tiling (TiledCompute & TiledMLP)

A key innovation of ALST is the realization that attention is not the only memory hog. The memory required for linear layers and loss calculation also grows linearly ($O(N)$). ALST introduces "Sequence Tiling," which breaks these computations into smaller tiles. This reduces the memory footprint of these operators from $O(N)$ to $O(1)$, materializing only the necessary intermediate values for one tile at a time.

3. Aggressive Memory Management

To further reduce peak memory usage, ALST employs several low-level optimizations:

  • Activation Offloading: The system "monkey-patches" PyTorch’s activation checkpointing to offload tensors to CPU memory. This flattens the memory usage "hill" that typically grows with model depth, making peak memory usage independent of the number of layers.
  • Fragmentation Mitigation: It utilizes PyTorch’s expandable_segments allocator to prevent memory fragmentation.
  • Leak Prevention: The authors identified and bypassed specific memory leaks in distributed barriers found in certain PyTorch versions.

Experimental Results

The performance of ALST was benchmarked using Meta-Llama-3.1 (8B and 70B) and Qwen-32B models. The results demonstrate near-perfect linear scalability and dramatic improvements over the Hugging Face + DeepSpeed ZeRO-3 baseline.

Comparison of maximum sequence length support between Arctic Long Sequence Training and Hugging Face baselines.

Key performance metrics include:

  • Single GPU (H100): Increased Llama-8B sequence length from 32K to 500K (16x improvement).
  • Single Node (8x H100): Increased support to 3.7M tokens (116x improvement).
  • Multi-Node (32x H100): Achieved a maximum sequence length of 15M tokens (469x improvement).

Despite these heavy memory optimizations, the system maintains high throughput, achieving approximately 590 TFLOPS for Llama-8B at the 15M token scale.

Discussion and Future Work

ALST proves that optimizing "non-attention" blocks via tiling is as critical as optimizing attention itself for long-context training. While the current release provides a massive leap in capability, some limitations remain. The degree of sequence parallelism is currently bounded by the number of attention heads, and the number of heads must be divisible by the parallelism degree. Future updates aim to remove these constraints, optimize CPU offloading with asynchronous CUDA streams, and integrate these features directly into Hugging Face Accelerate and Trainer for broader community access.

Summary updated

BibTeX
@misc{bekman2025arctic,
  author = {Stas Bekman and Samyam Rajbhandari and Michael Wyatt and Jeff Rasley and Tunji Ruwase and Zhewei Yao and Aurick Qiao and Yuxiong He},
  title = {{Arctic Long Sequence Training: Scalable And Efficient Training For Multi-Million Token Sequences}},
  year = {2025},
  eprint = {2506.13996},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.13996},
}
Figure