提出二维并行自注意力机制,显著提升分布式训练效率。
ATTENTION2D: Communication Efficient Distributed Self-Attention Mechanism
- 通过查询与键/值的双维度并行,实现计算高效分布。
- 在64张A100卡上比环形注意力快5倍,在64张H100卡上快9.4倍。
- 无需近似或额外开销,可随设备增加持续扩展。
基于Transformer的模型已成为自然语言处理、文本生成和图像生成任务的主流架构。自注意力机制是其核心,能捕捉数据内部复杂依赖关系,但对长序列带来显著的计算与内存开销。本文提出ATTENTION2D,一种利用查询与键/值两个维度并行性的新方法,实现跨多设备的高效计算分发与并行化。该方法在不依赖近似或引入额外计算与内存开销的前提下,实现了渐进式更快的训练与推理速度。相比现有技术,本方法在处理更多计算单元时仍具可扩展性。实验表明,使用64张NVIDIA A100 GPU分布在16个节点上的GPT-3类模型中,性能最高提升5倍;在64张NVIDIA H100 GPU分布在64个节点上时,性能最高提升9.4倍。
原文摘要 · Abstract (English)
Transformer-based models have emerged as a leading architecture for natural language processing, natural language generation, and image generation tasks. A fundamental element of the transformer architecture is self-attention, which allows the model to capture intricate dependencies within the data. However, the self-attention mechanism also incurs significant computational and memory costs, particularly for long sequences. In this paper, we introduce ATTENTION2D, a novel approach that exploits parallelism along two dimensions - query and key/value - of the self-attention operation. This method enables efficient distribution and parallelization of computations across multiple devices. Our approach facilitates asymptotically faster training and inference phases compared to previous methods, without relying on approximations or incurring additional computational or memory overheads. Furthermore, unlike existing techniques that struggle to scale with an increasing number of processing units, our approach effectively scales with additional processing units. Our experimental results confirm the effectiveness of our method in improving communication efficiency and scalability. Compared to Ring Attention, our approach demonstrated up to a 5x performance boost on a GPT-3-like model using 64 NVIDIA A100 GPUs across 16 nodes, and up to a 9.4x performance boost on 64 NVIDIA H100 GPUs across 64 nodes.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。