Reproduce “Striped Attention: Faster Ring Attention for Causal Transformers” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

William Brandon, Aniruddha Nrusimha, Kevin Qian, Zachary Ankner, Tian Jin, Zhiye Song, Jonathan Ragan-Kelley

Striped Attention enhances Ring Attention for causal transformer models by addressing a workload imbalance, leading to more efficient training of large language models with very long sequence contexts. The method achieves up to 1.65x end-to-end throughput improvements for training models with sequence lengths up to 786k tokens.

Key insights

  • Ring Attention's contiguous sharding for causal attention leads to a workload imbalance where some devices are idle or compute only masked data while others process full workloads, limiting overall throughput to the slowest device.
  • Permuting the input sequence into 'stripes' across devices effectively balances the causal attention workload, ensuring all devices process a proportional amount of necessary (unmasked) computations.
  • By correctly applying the causal mask relative to the original sequence indices, Striped Attention can achieve a balanced, triangular workload on each device throughout all attention iterations.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.