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

基于神经块线性化的高效大语言模型推理

Efficient Large Language Model Inference with Neural Block Linearization

Laboratory for Information and Inference Systems(信息与推断系统实验室)

Mete Erdogan, Francesco Tonin, Volkan Cevher

AI总结:

针对大语言模型自注意力推理开销高的问题,提出 NBL 框架,依据典型相关分析得到的线性近似误差上界选择并替换层,无需微调即可显著提速且准确率损失极小。

摘要:

基于 Transformer 的大语言模型(LLM)具有很高的推理需求,这给其部署带来了重大挑战。为此,我们提出 Neural Block Linearization(NBL,神经块线性化),这是一种通过用源自线性最小均方误差估计器的线性近似替换自注意力层来加速 Transformer 模型推理的新颖框架。NBL 利用典型相关分析计算近似误差的理论上界。随后,我们将该界用作替换准则,选择线性化误差最低的 LLM 层。NBL 可高效应用于预训练 LLM,无需进行微调。在实验中,NBL 在多个推理基准上保持具有竞争力的准确率的同时,实现了显著的计算加速。例如,将 NBL 应用于 DeepSeek-R1-Distill-Llama-8B 中的 12 个自注意力层,可使推理速度提升 32%,而准确率损失不到 1%,这使其成为提升 LLM 推理效率的一种灵活且富有前景的解决方案。实现代码可在 https://github.com/LIONS-EPFL/NBL 获取。

英文摘要:

The high inference demands of transformer-based Large Language Models (LLMs) pose substantial challenges in their deployment. To this end, we introduce Neural Block Linearization (NBL), a novel framework for accelerating transformer model inference by replacing self-attention layers with linear approximations derived from Linear Minimum Mean Squared Error estimators. NBL leverages Canonical Correlation Analysis to compute a theoretical upper bound on the approximation error. Then, we use this bound as a criterion for substitution, selecting the LLM layers with the lowest linearization error. NBL can be efficiently applied to pre-trained LLMs without the need for fine-tuning. In experiments, NBL achieves notable computational speed-ups while preserving competitive accuracy on multiple reasoning benchmarks. For instance, applying NBL to 12 self-attention layers in DeepSeek-R1-Distill-Llama-8B increases the inference speed by 32% with less than 1% accuracy trade-off, making it a flexible and promising solution to improve the inference efficiency of LLMs. The implementation is available at: https://github.com/LIONS-EPFL/NBL.

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

↑