[Paper Review] DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models
DeepSpeed-Ulysses introduces a novel sequence parallelism method that partitions input sequences across GPUs and uses efficient all-to-all communication to enable training of Transformer models with extreme sequence lengths—up to 1M tokens—achieving 2.5x faster training and over 10x communication reduction compared to prior systems, while maintaining high throughput and compatibility with FlashAttention and ZeRO-3.
Computation in a typical Transformer-based large language model (LLM) can be characterized by batch size, hidden dimension, number of layers, and sequence length. Until now, system works for accelerating LLM training have focused on the first three dimensions: data parallelism for batch size, tensor parallelism for hidden size and pipeline parallelism for model depth or layers. These widely studied forms of parallelism are not targeted or optimized for long sequence Transformer models. Given practical application needs for long sequence LLM, renewed attentions are being drawn to sequence parallelism. However, existing works in sequence parallelism are constrained by memory-communication inefficiency, limiting their scalability to long sequence large models. In this work, we introduce DeepSpeed-Ulysses, a novel, portable and effective methodology for enabling highly efficient and scalable LLM training with extremely long sequence length. DeepSpeed-Ulysses at its core partitions input data along the sequence dimension and employs an efficient all-to-all collective communication for attention computation. Theoretical communication analysis shows that whereas other methods incur communication overhead as sequence length increases, DeepSpeed-Ulysses maintains constant communication volume when sequence length and compute devices are increased proportionally. Furthermore, experimental evaluations show that DeepSpeed-Ulysses trains 2.5x faster with 4x longer sequence length than the existing method SOTA baseline.
Motivation & Objective
- To address the scalability limitations of existing parallelism techniques—data, tensor, and pipeline parallelism—in handling extremely long sequence lengths in Transformer models.
- To overcome memory-communication inefficiencies in existing sequence parallelism approaches that hinder scalability for long sequences.
- To design a general, portable, and minimal-code-change system optimization that enables efficient and scalable training of long sequence LLMs across diverse hardware and attention mechanisms.
- To achieve high compute utilization (over 54% of peak) and support both dense and sparse attention with minimal performance degradation.
Proposed method
- Partitions input sequences along the sequence dimension across multiple GPUs, enabling parallel processing of non-overlapping sequence segments.
- Employs an all-to-all communication primitive before and after attention computation to redistribute queries, keys, and values across attention heads, ensuring each GPU computes for a unique subset of heads.
- Uses a two-phase all-to-all communication: first to reconfigure data so each GPU receives full sequences for its assigned attention heads, and second to gather results while re-partitioning along the sequence dimension.
- Integrates seamlessly with ZeRO-3 for model parallelism and memory optimization, enabling training of both large model sizes and long sequence lengths.
- Supports efficient attention mechanisms including FlashAttention v2 and sparse attention (e.g., blocked sparse), maintaining low communication overhead.
- Designs the system to be implementation-agnostic, requiring minimal code changes to existing training frameworks.

Experimental results
Research questions
- RQ1Can sequence parallelism be made communication-efficient at scale, especially as sequence length increases?
- RQ2How can all-to-all communication be leveraged to maintain constant communication volume despite increasing sequence length and device count?
- RQ3Can a system-level optimization like DeepSpeed-Ulysses achieve high throughput and strong scaling for long sequence training without requiring intrusive code refactoring?
- RQ4To what extent does the method outperform existing sequence parallelism approaches like Megatron-LM in terms of throughput, memory efficiency, and scalability?
- RQ5How does the integration of DeepSpeed-Ulysses with ZeRO-3 and FlashAttention impact training efficiency and model size scalability?
Key findings
- DeepSpeed-Ulysses enables training of models with sequence lengths up to 1 million tokens, 4x longer than existing systems.
- The method achieves 2.5x higher training throughput compared to the SOTA baseline (Megatron-LM) on both 7B and 30B parameter models with dense attention.
- Communication volume remains constant as sequence length and GPU count increase proportionally, unlike other methods that suffer from increasing communication overhead.
- The system sustains over 175 TFlops/GPU, achieving more than 54% of hardware peak performance across experiments.
- Memory savings from ZeRO-3 integration allow for 4x longer sequence lengths than Megatron-LM, even with identical hardware.
- The method shows strong weak scaling: throughput remains high even when sequence length and GPU count increase proportionally, with only minor performance degradation due to communication overhead.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.