arXiv:2410.10254cs.LGcs.AI2024-10ICLR被引 21

用低秩方法让大模型线性化,大幅降低资源消耗且保持性能。

LoLCATs: On Low-Rank Linearizing of Large Language Models

  • 先对齐注意力分布,再用低秩微调修复误差。
  • 在5次提示下MMLU得分提升超20点,70B/405B模型首次实现线性化。
  • 仅需0.2%参数和0.4%训练数据,适合资源有限者快速部署。

近期工作表明,可通过将Transformer架构大语言模型(LLM)中的二次注意力替换为亚二次形式(如线性注意力),实现大模型线性化,避免高昂的预训练成本。然而,现有方法常导致模型质量显著下降,仍需数十亿词元的训练,且仅适用于1.3B至7B规模模型。本文提出低秩注意力转换方法(LoLCATs),通过两步实现高效线性化:首先以输出均方误差损失训练线性注意力逼近原软最大值注意力(注意力迁移);随后利用低秩适配(LoRA)校正近似误差,恢复模型性能。该方法大幅提升线性化质量、训练效率与可扩展性。在Llama 3 8B和Mistral 7B v0.1上,使5次提示下MMLU得分提升超过20点,达到当前最优亚二次大模型水平;仅需过去方法0.2%的模型参数和0.4%的训练词元。进一步地,首次成功线性化70B和405B LLM(较之前扩大50倍)。在相同算力预算下,相较于以往方法,将线性化版本与原始Llama 3.1 70B及405B模型的差距缩小了77.8%和78.1%(5次提示下MMLU)。

原文摘要 · Abstract (English)

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.

大模型线性注意力低秩微调高效训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。