arXiv:2502.07832cs.LGcs.AI2025-02

通过共享相邻层参数并用低秩恢复,大幅降低大模型推理内存占用。

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

  • 共享相邻层参数,减少存储开销。
  • 仅用5万条数据微调,即可恢复模型困惑度。
  • 适合移动端部署,节省42.8%存储和42.2%推理时间。

大型语言模型(LLMs)虽推动了自然语言处理的发展,但其日益增长的计算与内存需求使在手机等资源受限设备上的部署愈发困难。本文提出SHARP(共享相邻层并引入恢复参数),通过共享相邻层参数降低内存负载,同时引入低秩恢复参数以维持性能。受连续层输出相似性的启发,SHARP采用两阶段恢复:单层预热(SLW)与监督微调(SFT)。SLW阶段使用L_2损失对齐共享层输出,为SFT提供良好初始化,进一步恢复模型性能。大量实验表明,SHARP在仅使用不超过5万条微调数据的情况下,可恢复模型在各类分布内任务上的困惑度,同时将存储的MLP参数数量减少38%至65%。消融实验显示,替换模型后半部分层更利于性能保持,且不同恢复参数化方式在参数量相当时表现相近。此外,与原始Llama2-7b模型相比,SHARP在移动设备上节省42.8%模型存储,推理时间减少42.2%。结果表明,SHARP是一种无需预训练规模资源即可有效降低推理成本的解决方案。

原文摘要 · Abstract (English)

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.

大模型压缩推理加速参数共享移动端部署

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