arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.13516cs.LGcs.AIcs.CL
收藏

ProSparse:在大型语言模型中引入并增强固有激活稀疏性

ProSparse: Introducing and Enhancing Intrinsic Activation Sparsity within Large Language Models

Tsinghua University(清华大学);Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);Tencent Machine Learning Platform(腾讯机器学习平台)

Chenyang Song, Xu Han, Zhengyan Zhang, Shengding Hu, Xiyu Shi, Kuai Li, Chen Chen, Zhiyuan Liu, Guangli Li, Tao Yang, Maosong Sun

AI总结:

针对 LLM 缺乏固有激活稀疏性且高稀疏与性能难以兼顾的问题,本文提出 ProSparse,通过 ReLU 替换和多阶段正弦渐进正则化,在多个 LLaMA2 与 MiniCPM 模型上实现最高 89.32% 稀疏率及 4.52 倍推理加速。

摘要:

激活稀疏性是指激活输出中存在大量贡献较弱的元素。作为使用 ReLU 激活函数的模型的普遍属性,激活稀疏性已被证明是提升模型推理效率的一种有前景的范式。然而,大多数大型语言模型(LLM)采用不具有固有激活稀疏性的激活函数(例如 GELU 和 Swish)。近期一些研究探索引入 ReLU 或其变体作为替代激活函数,以帮助 LLM 实现激活稀疏性和推理加速,但很少有方法能够同时获得高稀疏性和相当的模型性能。本文提出一种简单而有效的稀疏化方法,名为“ProSparse”,用于推动 LLM 获得更高的激活稀疏性,同时保持相当的性能。具体而言,在将 LLM 的激活函数替换为 ReLU 后,ProSparse 采用渐进式稀疏正则化,其因子沿多阶段正弦曲线平滑增加。这可以增强激活稀疏性,并通过避免激活分布的剧烈变化来缓解性能下降。借助 ProSparse,我们分别使 LLaMA2-7B 达到 89.32% 的高稀疏性,使 LLaMA2-13B 达到 88.80%,使端侧尺寸 MiniCPM-1B 达到 87.89%,并取得了与其原始 Swish 激活版本相当的性能。这些模型是开源 LLaMA 版本中激活最稀疏的模型,也是具有竞争力的端侧尺寸模型,大幅超过 ReluLLaMA-7B(66.98%)和 ReluLLaMA-13B(71.56%)。我们的推理加速实验进一步证明了具有更高激活稀疏性的 LLM 具有显著的实际加速潜力,最高可获得 4.52 倍的推理速度提升。

英文摘要:

Activation sparsity refers to the existence of considerable weakly-contributed elements among activation outputs. As a prevalent property of the models using the ReLU activation function, activation sparsity has been proven a promising paradigm to boost model inference efficiency. Nevertheless, most large language models (LLMs) adopt activation functions without intrinsic activation sparsity (e.g., GELU and Swish). Some recent efforts have explored introducing ReLU or its variants as the substitutive activation function to help LLMs achieve activation sparsity and inference acceleration, but few can simultaneously obtain high sparsity and comparable model performance. This paper introduces a simple and effective sparsification method named "ProSparse" to push LLMs for higher activation sparsity while maintaining comparable performance. Specifically, after substituting the activation function of LLMs with ReLU, ProSparse adopts progressive sparsity regularization with a factor smoothly increasing along the multi-stage sine curves. This can enhance activation sparsity and mitigate performance degradation by avoiding radical shifts in activation distributions. With ProSparse, we obtain high sparsity of 89.32% for LLaMA2-7B, 88.80% for LLaMA2-13B, and 87.89% for end-size MiniCPM-1B, respectively, achieving comparable performance to their original Swish-activated versions. These present the most sparsely activated models among open-source LLaMA versions and competitive end-size models, considerably surpassing ReluLLaMA-7B (66.98%) and ReluLLaMA-13B (71.56%). Our inference acceleration experiments further demonstrate the significant practical acceleration potential of LLMs with higher activation sparsity, obtaining up to 4.52$\times$ inference speedup.

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

↑