arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2407.15892cs.LG
收藏

Mini-Sequence Transformer:优化长序列训练中的中间内存

Mini-Sequence Transformer: Optimizing Intermediate Memory for Long Sequences Training

California Institute of Technology(加州理工学院);Meta FAIR;Carnegie Mellon University(卡内基梅隆大学)

Cheng Luo, Jiawei Zhao, Zhuoming Chen, Beidi Chen, Anima Anandkumar

AI总结:

本文提出Mini-Sequence Transformer(MsT)方法,通过分区迭代处理输入序列并配合激活重计算,在不损失吞吐量和收敛性的前提下,显著降低长序列LLM训练的内存占用,并可将现有模型上下文长度扩展12-24倍。

摘要:

我们引入了Mini-Sequence Transformer(MsT),这是一种简单而有效的方法,用于高效且准确地进行极长序列的LLM训练。MsT对输入序列进行分区,并迭代处理小序列以减少中间内存的使用。与激活重计算相结合,它在前向和后向传播中都能显著节省内存。在使用Llama3-8B模型的实验中,与标准实现相比,即使序列长度延长12倍,MsT也没有导致吞吐量或收敛性的下降。MsT是完全通用的,与实现无关,并且只需对现有LLM训练框架进行极少的代码更改即可集成。与huggingface库集成后,MsT成功地将Qwen、Mistral和Gemma-2的最大上下文长度扩展了12-24倍。

英文摘要:

We introduce Mini-Sequence Transformer (MsT), a simple and effective methodology for highly efficient and accurate LLM training with extremely long sequences. MsT partitions input sequences and iteratively processes mini-sequences to reduce intermediate memory usage. Integrated with activation recomputation, it enables significant memory savings in both forward and backward passes. In experiments with the Llama3-8B model, with MsT, we measure no degradation in throughput or convergence even with 12x longer sequences than standard implementations. MsT is fully general, implementation-agnostic, and requires minimal code changes to integrate with existing LLM training frameworks. Integrated with the huggingface library, MsT successfully extends the maximum context length of Qwen, Mistral, and Gemma-2 by 12-24x.

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

↑