arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.07832cs.LGcs.AI
收藏

SHARP:通过共享相邻层与恢复参数加速语言模型推理

SHARP: Accelerating Language Model Inference by SHaring Adjacent layers with Recovery Parameters

University of Washington(华盛顿大学);University of California San Diego(加利福尼亚大学圣迭戈分校);Meta

Yiping Wang, Hanxian Huang, Yifang Chen, Jishen Zhao, Simon Shaolei Du, Yuandong Tian

AI总结:

针对LLM在资源受限设备部署的挑战,提出SHARP方法,通过相邻层参数共享+低秩恢复参数,结合SLW和SFT两阶段恢复,在仅需≤50k微调数据下恢复困惑度,减少MLP参数38%-65%,在移动设备上节省42.8%存储并缩短42.2%推理时间。

摘要:

尽管大型语言模型(LLMs)推动了自然语言处理任务的发展,但其不断增长的计算和内存需求使得在移动电话等资源受限设备上部署的挑战日益严峻。本文提出SHARP(SHaring Adjacent Layers with Recovery Parameters,基于恢复参数的相邻层共享),这是一种通过在相邻层间共享参数以加速LLM推理的新方法,旨在降低内存负载开销,同时引入低秩恢复参数以维持模型性能。受连续层输出相似这一观察的启发,SHARP采用两阶段恢复过程:单层预热(SLW)和监督微调(SFT)。SLW阶段利用L₂损失对齐共享层的输出,为后续SFT阶段进一步恢复模型性能提供良好初始化。大量实验表明,SHARP仅需不超过50k的微调数据即可恢复模型在各类分布内任务上的困惑度,同时将存储的MLP参数数量减少38%至65%。我们还对SHARP进行了多项消融研究,结果显示替换模型后半部分的层能更好地保留性能,且参数数量匹配时不同恢复参数化的表现相似。此外,与原始Llama2-7b模型相比,SHARP在移动设备上节省了42.8%的模型存储,并将总推理时间减少42.2%。我们的结果表明,SHARP是一种无需预训练级资源即可降低LLM部署推理成本的高效解决方案。

英文摘要:

While Large language models (LLMs) have advanced natural language processing tasks, their growing computational and memory demands make deployment on resource-constrained devices like mobile phones increasingly challenging. In this paper, we propose SHARP (SHaring Adjacent Layers with Recovery Parameters), a novel approach to accelerate LLM inference by sharing parameters across adjacent layers, thus reducing memory load overhead, while introducing low-rank recovery parameters to maintain performance. Inspired by observations that consecutive layers have similar outputs, SHARP employs a two-stage recovery process: Single Layer Warmup (SLW), and Supervised Fine-Tuning (SFT). The SLW stage aligns the outputs of the shared layers using L_2 loss, providing a good initialization for the following SFT stage to further restore the model performance. Extensive experiments demonstrate that SHARP can recover the model's perplexity on various in-distribution tasks using no more than 50k fine-tuning data while reducing the number of stored MLP parameters by 38% to 65%. We also conduct several ablation studies of SHARP and show that replacing layers towards the later parts of the model yields better performance retention, and that different recovery parameterizations perform similarly when parameter counts are matched. Furthermore, SHARP saves 42.8% in model storage and reduces the total inference time by 42.2% compared to the original Llama2-7b model on mobile devices. Our results highlight SHARP as an efficient solution for reducing inference costs in deploying LLMs without the need for pretraining-scale resources.

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

↑