arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.10652cs.PFcs.DCcs.LG
收藏

AutoChunk:面向内存高效的长序列推理的自动化激活分块

AutoChunk: Automated Activation Chunk for Memory-Efficient Long Sequence Inference

National University of Singapore(新加坡国立大学);HPC-AI Technology Inc.(HPC-AI科技公司)

Xuanlei Zhao, Shenggan Cheng, Guangyang Lu, Jiarui Fang, Haotian Zhou, Bin Jia, Ziming Liu, Yang You

AI总结:

针对长序列推理中激活内存随序列长度指数增长的问题,提出自动化自适应编译器系统AutoChunk,通过多阶段搜索选择的分块策略与代码生成,在控制速度损失的同时大幅降低激活内存、拓展最大序列长度,性能优于现有最优方法。

摘要:

大型深度学习模型已在各类应用中取得了亮眼的性能表现,但它们庞大的内存需求(包括参数内存与激活内存)已成为实际部署服务的重大挑战。现有方法主要解决参数内存问题,却忽视了激活内存的重要性。尤其对于长输入序列,激活内存会随序列长度增长呈现显著的指数级上升。本文提出AutoChunk,这是一套自动化自适应的编译器系统,通过分块策略高效降低长序列推理的激活内存开销。该系统经多阶段优化生成分块方案:每个阶段中,分块搜索流程遍历所有可能的分块候选,分块选择流程则筛选出最优方案。运行时,AutoChunk借助代码生成自动应用分块策略。实验表明,AutoChunk可减少80%以上的激活内存,同时将速度损失控制在10%以内,将最大序列长度拓展3.2倍至11.7倍,且性能大幅优于现有最优方法。

英文摘要:

Large deep learning models have achieved impressive performance across a range of applications. However, their large memory requirements, including parameter memory and activation memory, have become a significant challenge for their practical serving. While existing methods mainly address parameter memory, the importance of activation memory has been overlooked. Especially for long input sequences, activation memory is expected to experience a significant exponential growth as the length of sequences increases. In this approach, we propose AutoChunk, an automatic and adaptive compiler system that efficiently reduces activation memory for long sequence inference by chunk strategies. The proposed system generates chunk plans by optimizing through multiple stages. In each stage, the chunk search pass explores all possible chunk candidates and the chunk selection pass identifies the optimal one. At runtime, AutoChunk employs code generation to automatically apply chunk strategies. The experiments demonstrate that AutoChunk can reduce over 80\% of activation memory while maintaining speed loss within 10%, extend max sequence length by 3.2x to 11.7x, and outperform state-of-the-art methods by a large margin.

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

↑