arXiv:2503.01496cs.CLcs.AI2025-03ICML被引 28

将预训练大模型线性化为门控循环结构,实现高效部署且无需新增参数。

Liger: Linearizing Large Language Models to Gated Recurrent Structures

  • 用预训练权重重构门控机制,不加新参数直接转换模型结构。
  • 仅用0.02%预训练数据量,恢复93%原始Transformer性能。
  • 适合追求推理效率的模型部署场景,尤其适配资源受限环境。

具有线性递归建模的Transformer可实现线性时间训练和常数内存推理。尽管其效率与性能表现优异,但从头预训练此类非标准架构仍成本高昂且风险大。对大型语言模型(LLMs)进行线性化,可将预训练的标准模型转换为线性递归结构,从而提升部署效率。然而,现有线性化方法通常引入额外特征映射模块,需大量微调,并忽视了先进线性递归模型中的门控机制。为此,本文提出Liger(Linearizing LLMs to gated recurrent structures),一种无需添加额外参数即可将预训练LLM转化为门控线性递归模型的新方法。Liger复用预训练键矩阵权重构建多样化的门控机制,形成多种门控递归结构,避免从零训练新组件。结合轻量级微调(LoRA),Liger使线性化后的门控递归模型性能恢复至原模型水平。此外,我们引入Liger Attention,一种层内混合注意力机制,在线性化过程中仅使用0.02%预训练标记,即恢复93%的Transformer基线性能,在1B至8B参数模型上多个基准测试中表现优异。代码已开源:https://github.com/OpenSparseLLMs/Linearization。

原文摘要 · Abstract (English)

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.

线性化门控循环LLM部署LoRA

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