ReLU$^2$ 胜出:发现稀疏大语言模型的高效激活函数
ReLU$^2$ Wins: Discovering Efficient Activation Functions for Sparse LLMs
AI总结:
本文提出通用稀疏激活定义与系统评估框架,发现ReLU$^2$在稀疏性-性能权衡、可预测性和硬件亲和性上全面优于ReLU等激活函数,适用于稀疏LLM推理。
摘要:
稀疏计算通过在推理过程中动态跳过非活跃神经元的计算,为低资源场景下的大语言模型(LLM)推理提供了一种引人注目的解决方案。传统方法主要关注基于 ReLU 的 LLM,利用激活值中的零值,而我们则将稀疏 LLM 的范围扩展到零激活值之外。我们提出了一种通用方法,通过神经元输出幅度和量身定制的幅度阈值来定义神经元激活,证明非 ReLU 的 LLM 也表现出稀疏激活。为了找到最适用于稀疏计算的高效激活函数,我们提出了一个系统框架,从三个方面考察 LLM 的稀疏性:稀疏性与性能之间的权衡、稀疏性的可预测性以及硬件亲和性。我们对采用不同激活函数(包括 ReLU、SwiGLU、ReGLU 和 ReLU$^2$)的 LLM 进行了全面实验。结果表明,采用 ReLU$^2$ 的模型在所有三个评估方面均表现出色,凸显了其作为稀疏 LLM 高效激活函数的潜力。我们将发布代码以促进未来的研究。
英文摘要:
Sparse computation offers a compelling solution for the inference of Large Language Models (LLMs) in low-resource scenarios by dynamically skipping the computation of inactive neurons. While traditional approaches focus on ReLU-based LLMs, leveraging zeros in activation values, we broaden the scope of sparse LLMs beyond zero activation values. We introduce a general method that defines neuron activation through neuron output magnitudes and a tailored magnitude threshold, demonstrating that non-ReLU LLMs also exhibit sparse activation. To find the most efficient activation function for sparse computation, we propose a systematic framework to examine the sparsity of LLMs from three aspects: the trade-off between sparsity and performance, the predictivity of sparsity, and the hardware affinity. We conduct thorough experiments on LLMs utilizing different activation functions, including ReLU, SwiGLU, ReGLU, and ReLU$^2$. The results indicate that models employing ReLU$^2$ excel across all three evaluation aspects, highlighting its potential as an efficient activation function for sparse LLMs. We will release the code to facilitate future research.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。