arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.10254cs.LGcs.AIcs.CLstat.ML
收藏

LoLCATs:关于大型语言模型的低秩线性化

LoLCATs: On Low-Rank Linearizing of Large Language Models

Stanford University(斯坦福大学);Together AI;California Institute of Technology(加州理工学院);Massachusetts Institute of Technology(麻省理工学院)

Michael Zhang, Simran Arora, Rahul Chalamala, Alan Wu, Benjamin Spector, Aaryan Singhal, Krithik Ramesh, Christopher Ré

AI总结:

提出LoLCATs方法,通过注意力转移和低秩适应(LoRA),以极低的内存与计算成本将大型语言模型线性化,显著缩小质量差距并首次实现70B和405B规模模型的线性化。

摘要:

最近的研究表明,我们可以对大型语言模型(LLMs)进行线性化——将基于流行Transformer的LLMs的二次复杂度注意力替换为次二次复杂度的类似物,例如线性注意力——从而避免高昂的预训练成本。然而,线性化LLMs通常会显著降低模型质量,仍然需要在数十亿个token上进行训练,并且仅限于较小的1.3B到7B规模的LLMs。因此,我们提出了通过注意力转移进行低秩线性转换(LoLCATs),这是一种简单的两步方法,能够以数量级更少的内存和计算量提升LLM线性化质量。这两个步骤基于两项发现。首先,我们可以用高度近似的线性注意力替换LLM的softmax注意力,只需通过训练线性注意力以输出MSE损失匹配其softmax对应项(即“注意力转移”)。接着,这使得仅通过低秩适应(LoRA)即可调整近似误差并恢复LLM质量。LoLCATs显著提升了线性化质量、训练效率和可扩展性。我们大幅缩小了线性化质量差距,并基于Llama 3 8B和Mistral 7B v0.1生成了最先进的次二次复杂度LLMs,在5-shot MMLU上带来了20+分的提升。此外,LoLCATS仅使用以往方法0.2%的模型参数和0.4%的训练token便实现了这一目标。最后,我们应用LoLCATs创建了首批线性化的70B和405B LLMs(比先前工作大50倍)。在相同计算预算下与先前方法相比,LoLCATs显著提升了线性化质量,在5-shot MMLU上将线性化与原始Llama 3.1 70B和405B LLMs之间的差距缩小了77.8%和78.1%。

英文摘要:

Recent works show we can linearize large language models (LLMs) -- swapping the quadratic attentions of popular Transformer-based LLMs with subquadratic analogs, such as linear attention -- avoiding the expensive pretraining costs. However, linearizing LLMs often significantly degrades model quality, still requires training over billions of tokens, and remains limited to smaller 1.3B to 7B LLMs. We thus propose Low-rank Linear Conversion via Attention Transfer (LoLCATs), a simple two-step method that improves LLM linearizing quality with orders of magnitudes less memory and compute. We base these steps on two findings. First, we can replace an LLM's softmax attentions with closely-approximating linear attentions, simply by training the linear attentions to match their softmax counterparts with an output MSE loss ("attention transfer"). Then, this enables adjusting for approximation errors and recovering LLM quality simply with low-rank adaptation (LoRA). LoLCATs significantly improves linearizing quality, training efficiency, and scalability. We significantly reduce the linearizing quality gap and produce state-of-the-art subquadratic LLMs from Llama 3 8B and Mistral 7B v0.1, leading to 20+ points of improvement on 5-shot MMLU. Furthermore, LoLCATs does so with only 0.2% of past methods' model parameters and 0.4% of their training tokens. Finally, we apply LoLCATs to create the first linearized 70B and 405B LLMs (50x larger than prior work). When compared with prior approaches under the same compute budgets, LoLCATs significantly improves linearizing quality, closing the gap between linearized and original Llama 3.1 70B and 405B LLMs by 77.8% and 78.1% on 5-shot MMLU.

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

↑