DeepSpeed Ulysses: 極端に長いシーケンスのTransformerモデル訓練を可能にするためのシステム最適化
DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models
September 25, 2023
著者: Sam Ade Jacobs, Masahiro Tanaka, Chengming Zhang, Minjia Zhang, Leon Song, Samyam Rajbhandari, Yuxiong He
cs.AI
要旨
典型的なTransformerベースの大規模言語モデル(LLM)における計算は、バッチサイズ、隠れ層の次元数、層数、およびシーケンス長によって特徴づけられます。これまで、LLMの学習を加速するためのシステム研究は、最初の3つの次元に焦点を当ててきました。具体的には、バッチサイズに対するデータ並列処理、隠れ層の次元数に対するテンソル並列処理、およびモデルの深さ(層数)に対するパイプライン並列処理です。これらの広く研究されてきた並列処理手法は、長いシーケンスを持つTransformerモデルに特化または最適化されていません。長いシーケンスを扱うLLMの実用的なニーズを考慮し、シーケンス並列処理に対する新たな注目が集まっています。しかし、既存のシーケンス並列処理の研究は、メモリと通信の非効率性に制約されており、長いシーケンスを持つ大規模モデルへの拡張性が限られています。本研究では、極めて長いシーケンス長でのLLM学習を可能にする、新規で移植性が高く効果的な手法であるDeepSpeed-Ulyssesを紹介します。DeepSpeed-Ulyssesは、その核心において入力データをシーケンス次元に沿って分割し、アテンション計算のために効率的な全対全集団通信を採用します。理論的な通信分析によると、他の手法ではシーケンス長が増加するにつれて通信オーバーヘッドが発生するのに対し、DeepSpeed-Ulyssesはシーケンス長と計算デバイスが比例して増加する場合でも通信量を一定に保ちます。さらに、実験的評価では、DeepSpeed-Ulyssesが既存のSOTAベースラインと比較して、4倍長いシーケンス長で2.5倍高速に学習することが示されています。
English
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.