arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2412.20501cs.DC
收藏

TokenRing:一种通过双向通信实现无限上下文大语言模型的高效并行框架

TokenRing: An Efficient Parallelism Framework for Infinite-Context LLMs via Bidirectional Communication

Zongwu Wang, Fangxin Liu, Mingshuai Li, Li Jiang

AI总结:

本文提出 TokenRing 并行框架,通过双向 P2P 通信与网状拓扑重叠计算和传输,缓解长序列大语言模型注意力机制中的通信瓶颈,提升分布式推理与训练效率。

摘要:

对长序列大语言模型(LLMs)进行高效并行化至关重要,但由于其巨大的计算和内存需求,尤其是注意力机制中的通信瓶颈,这一任务充满挑战。虽然序列并行(SP)已被提出作为一种潜在解决方案,但现有方法往往存在可扩展性有限或效率低下的问题,从而削弱了其有效性。Ring-Attention 展示了扩展序列处理的潜力,但由于其依赖点对点(P2P)通信以及对网络资源利用效率低下,面临显著限制。随着 SP 程度的增加,每步计算时间的二次方下降与通信量的线性减少形成鲜明对比,进一步加剧了通信瓶颈。为了解决这些挑战,我们提出了 TokenRing,这是一个细粒度并行框架,利用双向 P2P 通信有效地重叠计算与数据传输。通过在完全连接的网状拓扑中划分注意力块并同时传输 Query 和块输出(即 $block\_out$ 和 $block\_lse$),TokenRing 显著降低了通信开销并实现了更好的负载均衡。这些创新提升了分布式 Transformer 模型的可扩展性和效率,特别是对于长上下文序列。实验结果表明,TokenRing 提高了吞吐量并降低了通信延迟。此外,其设计能够无缝适配多种多 GPU 互连方案,例如华为昇腾(Huawei Ascend),确保了分布式 LLM 推理和训练的广泛兼容性与成本效益。代码可在以下地址获取:\url{https://github.com/ACA-Lab-SJTU/token-ring}。

英文摘要:

Efficient parallelization of Large Language Models (LLMs) with long sequences is essential but challenging due to their significant computational and memory demands, particularly stemming from communication bottlenecks in attention mechanisms. While sequence parallelism (SP) has been introduced as a potential solution, existing methods often suffer from limited scalability or inefficiency, rendering their effectiveness. Ring-Attention demonstrates the potential for scaling sequence processing but faces significant limitations due to its reliance on peer-to-peer (P2P) communication and inefficient utilization of network resources. As the degree of SP increases, the quadratic decrease in computation time per step contrasts sharply with the linear reduction in communication volume, exacerbating communication bottlenecks. To address these challenges, we propose TokenRing, a fine-grained parallel framework that leverages bidirectional P2P communication to effectively overlap computation and data transmission. By partitioning the attention block and concurrently transmitting Query and block outputs (i.e., $block\_out$ and $block\_lse$) within a fully connected mesh topology, TokenRing achieves significant reductions in communication overhead and better load balancing. These innovations improve the scalability and efficiency of distributed Transformer models, particularly for long-context sequences. Experimental results demonstrate that TokenRing enhances throughput and reduces communication latency. Moreover, its design adapts seamlessly to various multi-GPU interconnect solutions, such as Huawei Ascend, ensuring broad compatibility and cost-effectiveness for distributed LLM inference and training. The code is available at: \url{https://github.com/ACA-Lab-SJTU/token-ring}.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑