一句话:提出 oFFN,通过行列重排 FFN 权重同时利用激活离群值与冷热神经元,实现快速准确的稀疏 LLM 推理。
大模型推理可借助 ReLU 化 LLM 的输出激活稀疏性跳过整块内存访问与计算,但前提是快速且准确地预测输出稀疏性。现有工作或单独处理激活离群值,或单独处理热/冷神经元,未将二者结构化整合。本文指出这两种现象密切相关,并提出 oFFN:在行、列两个维度重排 FFN 权重,在考虑离群值的同时高效准确地预测输出稀疏性,并分离热、冷神经元分别以各自最优的算子计算;即使 batch size 动态变化,也能为每个神经元选择最优计算路径。实验显示,相比稠密推理端到端最高提速 2.01×,ReLU 化 LLM 自回归解码下 FFN 层最高提速 5.46×,精度损失可忽略,且快于已有稀疏预测方法。
With the advent of large-scale language models (LLMs), various optimization techniques have been proposed to enable efficient inference. Among these, methods that aggressively exploit output activation sparsity have attracted significant attention, which leverage ReLU-fied LLMs and skip the entire memory accesses as well as the computation for the output element if it was predicted as sparse. Achieving fast and accurate prediction of output activation sparsity is crucial to enhancing inference efficiency. However, in practice, phenomena such as activation outliers and hot and cold neurons, which significantly affect the exploitation of sparsity during LLM inference, have either been addressed individually or not structurally integrated in existing work. In this paper, we reveal that these two phenomena are closely related and propose a novel FFN architecture called oFFN (Outlier-aware Structured FFN) that effectively exploits them simultaneously. The proposed method rearranges the FFN weights in both row and column dimensions to enable efficient and accurate prediction of output sparsity, considering outliers, and to enable separation of hot and cold neurons, computing them with respective optimal operations. The proposed method allows for the optimal computation path for each neuron, even when the batch size dynamically changes. Compared to existing sparsity prediction techniques, our method achieves the fastest speed with negligible accuracy loss. Experimental results show that it delivers up to 2.01× faster end-to-end inference speed compared to dense inference, and up to 5.46× acceleration in FFN layers under autoregressive decoding in ReLU-fied LLMs.