Untied Ulysses: Memory-Efficient Context Parallelism via Headwise Chunking

Ravi Ghadia, Maksim Abraham, Sergei Vorobyov, Max Ryabinin

Introduction

As artificial intelligence advances toward "long-context" applications—such as analyzing entire codebases, generating long-form video, or processing massive document corpora—the standard Transformer architecture hits a physical wall: activation memory. Efficiently processing these long sequences usually requires splitting computations across accelerators via context parallelism. However, dominant approaches like Ring Attention or DeepSpeed Ulysses (DS-Ulysses) scale over the context dimension without optimizing memory efficiency, limiting the maximum sequence lengths they can support.

To break this "activation memory barrier," researchers introduce UPipe (Untied Ulysses). UPipe is a novel context parallelism technique that processes attention heads in small, sequential chunks. By "untying" the attention layer, UPipe reduces intermediate memory usage by up to 87.5% for large models, enabling training with context lengths of up to 5 million tokens on a single 8×H100 node—a 25% improvement over previous state-of-the-art methods—without sacrificing training speed.

The Problem: The Activation Memory Wall

While existing context parallelism techniques allow long sequences to be split across multiple GPUs, the memory required for intermediate tensors (such as the Query, Key, and Value buffers) still scales linearly with sequence length. At multi-million token scales, these buffers become so large that they exceed the GPU's High Bandwidth Memory (HBM), leading to Out of Memory (OOM) errors.

Previous solutions either accepted this hard limit or attempted to offload data to the CPU (e.g., Fully Pipelined Distributed Transformer, or FPDT). Unfortunately, offloading significantly slows down training due to the bottleneck of moving data back and forth across the PCIe bus. The authors sought a method that achieves the memory efficiency of offloading while maintaining the high-speed throughput of pure GPU-based parallelism.

UPipe: Headwise Chunking and Memory Reuse

UPipe builds directly upon the DS-Ulysses framework. In standard DS-Ulysses, all attention heads are processed simultaneously, requiring massive buffers to hold the $Q, K,$ and $V$ tensors for every head during the "all-to-all" communication phase.

UPipe's core innovation is Headwise Chunking, which operates on three main principles:

  1. Stage-based Execution: Instead of processing all $H$ heads at once, UPipe breaks the attention layer into multiple stages, processing only a small subset ($U$) of heads per stage.
  2. Memory Reuse: During long-context attention, the GPU is typically "compute-bound" (limited by math execution speed rather than data access). Processing just a few heads is often enough to keep the hardware fully utilized. UPipe reuses the same memory buffers for each stage, meaning the peak memory footprint is determined by the chunk size ($U$) rather than the total number of heads ($H$). When the chunk size matches the number of GPUs, UPipe’s peak activation memory becomes independent of the total head count.
  3. GQA Scheduling: Modern models utilize Grouped-Query Attention (GQA), where multiple query heads share a single KV head. UPipe includes a specialized scheduler that processes heads out-of-order. This ensures that unique KV heads are communicated only once and then reused across stages, preventing redundant data transfers.

Furthermore, UPipe is highly orthogonal. It can be seamlessly combined with activation checkpointing, CPU offloading, or Ring Attention (creating a hybrid "Ulysses + Ring" setup) to push context limits even further.

Experimental Results

The researchers evaluated UPipe using two primary model architectures: Llama 3-8B (for single-node and multi-node scaling tests) and Qwen3-32B (to demonstrate memory savings on head-heavy models). A subset of the C4 dataset was used to verify training loss convergence, ensuring that chunked processing does not introduce numerical errors.

  • Context Scaling: On a single 8×H100 node, UPipe successfully trained Llama 3-8B with a 5 million token context. By comparison, standard Ulysses runs out of memory at 3 million tokens, and FPDT fails after 4 million. On a 16×H100 setup, UPipe supported up to 8 million tokens, outperforming the USP-Hybrid baseline by 33% in maximum context length.
  • Memory Efficiency: UPipe drastically lowers peak activation memory usage. For 70B Transformers, it reduces peak activation memory by as much as 82.5%. For the Qwen3-32B model, UPipe reduced the memory overhead of self-attention activations by 87.5% compared to standard DS-Ulysses.
  • Throughput: Unlike offloading methods that suffer a 20-30% speed penalty, UPipe matches the throughput of DS-Ulysses at long sequence lengths.

Limitations and Future Directions

While UPipe excels in the extreme long-context regime, it does introduce kernel overhead at shorter context lengths (e.g., 128k tokens). The overhead of launching multiple stages makes it slightly slower than standard Ulysses for these shorter sequences, though this overhead amortizes as sequence length grows.

Additionally, while UPipe solves the GPU memory bottleneck, at 5 million+ tokens, the CPU memory used for offloaded activations (from activation checkpointing) becomes the next limiting factor.

Future work will explore "SM-free communication" to overlap communication with computation more aggressively, further improving throughput. Ultimately, UPipe serves as a foundational building block for training future multi-modal models that naturally demand massive context windows.

Summary updated

BibTeX
@inproceedings{ghadia2026untied,
  author = {Ravi Ghadia and Maksim Abraham and Sergei Vorobyov and Max Ryabinin},
  title = {{Untied Ulysses: Memory-Efficient Context Parallelism via Headwise Chunking}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=726Wto4meA},
}
Figure