2025-03-04 · 专家 · 机器学习 · 自然语言处理

Liger: Linearizing Large Language Models to Gated Recurrent Structures

本文提出了一种名为Liger的新方法,通过线性化预训练的大语言模型(LLMs)为门控循环结构,从而实现高效的部署和性能恢复。

更新于 2025-03-04。作者:Disen Lan、Weigao Sun、Jiaxi Hu、Jusen Du、Yu Cheng。

中文摘要

线性循环建模的Transformer提供线性时间训练和常数内存推理。尽管它们展示了高效和良好的性能,但从零开始预训练这种非标准架构仍然成本高昂且风险较大。大型语言模型(LLMs)的线性化将预训练的标准模型转换为线性循环结构,从而实现更高效的部署。然而,当前的线性化方法通常引入额外的特征图模块,这些模块需要大量的微调,并且忽略了最先进的线性循环模型中使用的门控机制。为了解决这些问题,本文提出了Liger,即“将LLMs线性化至门控循环结构”。Liger是一种新颖的方法,可以将预训练的LLMs转换为门控线性循环模型,而无需添加额外的参数。它重新利用预训练的关键矩阵权重来构建各种门控机制,便于形成不同的门控循环结构,同时避免从头开始训练额外组件的需求。使用轻量级微调结合低秩自适应(LoRA),Liger将线性化后的门控循环模型性能恢复到与原始LLMs相匹配。此外,我们还引入了Liger Attention,这是一种层内混合注意力机制,在线性化过程中,它显著恢复了Transformer-based LLM的93%,在预训练标记为0.02%的情况下,在多个基准测试中实现了具有竞争力的结果,这已在从1B到8B参数的模型上得到验证。代码可在https://github.com/OpenSparseLLMs/Linearization获取。

英文摘要

Transformers with linear recurrent modeling offer linear-time training and constant-memory inference. Despite their demonstrated efficiency and performance, pretraining such non-standard architectures from scratch remains costly and risky. The linearization of large language models (LLMs) transforms pretrained standard models into linear recurrent structures, enabling more efficient deployment. However, current linearization methods typically introduce additional feature map modules that require extensive fine-tuning and overlook the gating mechanisms used in state-of-the-art linear recurrent models. To address these issues, this paper presents Liger, short for Linearizing LLMs to gated recurrent structures. Liger is a novel approach for converting pretrained LLMs into gated linear recurrent models without adding extra parameters. It repurposes the pretrained key matrix weights to construct diverse gating mechanisms, facilitating the formation of various gated recurrent structures while avoiding the need to train additional components from scratch. Using lightweight fine-tuning with Low-Rank Adaptation (LoRA), Liger restores the performance of the linearized gated recurrent models to match that of the original LLMs. Additionally, we introduce Liger Attention, an intra-layer hybrid attention mechanism, which significantly recovers 93\% of the Transformer-based LLM at 0.02\% pre-training tokens during the linearization process, achieving competitive results across multiple benchmarks, as validated on models ranging from 1B to 8B parameters. Code is available at https://github.com/OpenSparseLLMs/Linearization.

解读

一句话总结

本文提出了一种名为Liger的新方法,通过线性化预训练的大语言模型(LLMs)为门控循环结构,从而实现高效的部署和性能恢复。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源