atlas

Research map / Architectures and efficiency / Attention and transformers

RingAttention with Blockwise Transformers for Near-Infinite Context

ICLR 2024 · Architectures and efficiency › Attention and transformers · approach: Sparse efficient transformers for long context · 14 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes Ring Attention, which distributes long sequences across devices in a ring and overlaps key-value block communication with blockwise attention/FFN computation, enabling context lengths scaling with device count without approximation.

Problem

Transformers' memory cost grows with sequence length, and even memory-efficient blockwise transformers must store each layer's output, limiting context length to what fits on a single device.

Approach

Distribute the outer loop of blockwise attention and FFN across a ring of hosts, rotating key-value blocks between neighbors while overlapping their transfer with blockwise computation, so per-device memory is independent of total sequence length and communication adds no overhead when block compute time exceeds transfer time.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use Ring Attention instead of memory-efficient attention and FFNLLaMA 3B on 8x A100 NVLink · maximum-context trainingmax context size (×1e3 tokens): 64 -> 512Helped
Use Ring Attention instead of memory-efficient attention and FFNLLaMA 7B on 32x A100 InfiniBand · maximum-context trainingmax context size (×1e3 tokens): 128 -> 4096Helped
Use Ring Attention instead of memory-efficient attention and FFNLLaMA 7B on TPUv3-512 · maximum-context trainingmax context size (×1e3 tokens): 8 -> 2048Helped
Use Ring Attention instead of memory-efficient attention and FFNLLaMA 3B on TPUv4-1024 · maximum-context trainingmax context size (×1e3 tokens): 32 -> 16384Helped
Use Ring Attention instead of memory-efficient attention and FFNLLaMA 3B on TPUv5e-256 · maximum-context trainingmax context size (×1e3 tokens): 32 -> 4096Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Walker Standcumulative return: 95.45 -> 98.23Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Walker Runcumulative return: 105.88 -> 110.45Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Walker Walkcumulative return: 78.56 -> 78.95Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Cheetah Runcumulative return: 178.75 -> 181.34Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Jaco Reachcumulative return: 87.56 -> 89.51Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Cartpole Swingupcumulative return: 120.56 -> 123.45Helped
Increase trajectories from 32 to 128 and use Ring Attention instead of BPTAT on ExoRL · Total Averagecumulative return: 111.13 -> 113.66Helped

Surprising findings

Limitations

Experimental setup

Datasets: ShareGPT ExoRL

Benchmarks: ExoRL line retrieval

Metrics: maximum context size (tokens) model flops utilization cumulative return retrieval accuracy interconnect bandwidth utilization

Baselines: vanilla Transformer memory efficient attention blockwise parallel transformers BC Decision Transformer Algorithm Distillation GPT-3.5-turbo-16K Claude-2-100K Vicuna-16K

Builds on: blockwise parallel transformers memory efficient attention FSDP Algorithm Distillation LLaMA

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy