ReLU Strikes Back: Exploiting Activation Sparsity in Large Language Models
Iman Mirzadeh, Keivan Alizadeh, Sachin Mehta, Carlo C Del Mundo, Oncel Tuzel, Golnoosh Samei, Mohammad Rastegari, Mehrdad Farajtabar
TL;DR
Big language models incur heavy inference costs from dense activations. The authors re-evaluate ReLU activations, showing highly sparse FFN activations (>90%) and substantial inference and memory savings across OPT, Llama, and Falcon, including up to about threefold FLOPS reductions through Relufication. They introduce Stage 1 FFN replacement and Stage 2 post-normalization ReLU insertions to boost sparsity with minimal accuracy loss, and they explore applications such as aggregated sparsity for token generation, speculative decoding improvements, and shifted ReLU to further enhance sparsity. Overall, activation sparsity via ReLU presents a practical, hardware-friendly path to more efficient LLM deployment, with strong empirical support and clear avenues for future optimization.
Abstract
Large Language Models (LLMs) with billions of parameters have drastically transformed AI applications. However, their demanding computation during inference has raised significant challenges for deployment on resource-constrained devices. Despite recent trends favoring alternative activation functions such as GELU or SiLU, known for increased computation, this study strongly advocates for reinstating ReLU activation in LLMs. We demonstrate that using the ReLU activation function has a negligible impact on convergence and performance while significantly reducing computation and weight transfer. This reduction is particularly valuable during the memory-bound inference step, where efficiency is paramount. Exploring sparsity patterns in ReLU-based LLMs, we unveil the reutilization of activated neurons for generating new tokens and leveraging these insights, we propose practical strategies to substantially reduce LLM inference computation up to three times, using ReLU activations with minimal performance trade-offs.
