arXiv:2410.20672cs.CLcs.LG2024-10ICLR被引 63

通过分层LoRA让大模型层层共享参数,大幅压缩体积且性能损失小。

Relaxed Recursive Transformers: Effective Parameter Sharing with Layer-wise LoRA

  • 用分层低秩适配(LoRA)放松层间参数绑定,实现高效参数共享。
  • 递归版Gemma 1B在性能上超越同类小型模型,接近原版Gemma 2B水平。
  • 适合资源受限场景下的模型部署,尤其适合需要高吞吐推理的应用。

大型语言模型(LLMs)部署成本高昂。参数共享为降低模型规模与成本提供了可能,但在现代LLMs中效果有限。本文重新审视Transformer中的“层绑定”作为参数共享策略,提出将现有LLMs转化为更紧凑的“递归Transformer”,通过重复使用单一独特层块实现跨层参数共享,初始化来自标准预训练模型。进一步引入“松弛递归Transformer”,通过深度方向的低秩适配(LoRA)模块增加灵活性,同时保持模型紧凑性。实验表明,递归模型(如递归Gemma 1B)在性能上优于相同规模的普通预训练模型(如TinyLlama 1.1B、Pythia 1B)及知识蒸馏基线,并能恢复原版“全尺寸”模型(如Gemma 2B)大部分性能。最后,提出连续深度批处理(Continuous Depth-wise Batching),结合早期退出机制,理论上可实现2-3倍的推理吞吐提升。

原文摘要 · Abstract (English)

Large language models (LLMs) are expensive to deploy. Parameter sharing offers a possible path towards reducing their size and cost, but its effectiveness in modern LLMs remains fairly limited. In this work, we revisit "layer tying" as form of parameter sharing in Transformers, and introduce novel methods for converting existing LLMs into smaller "Recursive Transformers" that share parameters across layers, with minimal loss of performance. Here, our Recursive Transformers are efficiently initialized from standard pretrained Transformers, but only use a single block of unique layers that is then repeated multiple times in a loop. We further improve performance by introducing Relaxed Recursive Transformers that add flexibility to the layer tying constraint via depth-wise low-rank adaptation (LoRA) modules, yet still preserve the compactness of the overall model. We show that our recursive models (e.g., recursive Gemma 1B) outperform both similar-sized vanilla pretrained models (such as TinyLlama 1.1B and Pythia 1B) and knowledge distillation baselines -- and can even recover most of the performance of the original "full-size" model (e.g., Gemma 2B with no shared parameters). Finally, we propose Continuous Depth-wise Batching, a promising new inference paradigm enabled by the Recursive Transformer when paired with early exiting. In a theoretical analysis, we show that this has the potential to lead to significant (2-3x) gains in inference throughput.

参数共享LoRA模型压缩推理优化

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