about
ReLU Strikes Back: Exploiting Activation Sparsity in Large Language Models(2023) (arxiv.org)
2 points by martinloretz on Feb 20, 2025 | hide | past | pdf | 1 comment on HN

In plain words: Swapping the usual smooth activation for ReLU makes most neurons output zero, so the model can skip them when generating each new word. This cut inference computation up to three times with barely any drop in quality.

Abstract · ReLU Strikes Back: Exploiting Activation Sparsity in Large Language Models

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.

Iman Mirzadeh, Keivan Alizadeh, Sachin Mehta, Carlo C Del Mundo, Oncel Tuzel, Golnoosh Samei, Mohammad Rastegari, Mehrdad Farajtabar
arXiv:2310.04564 · cs.LG, cs.AI · submitted Oct 6, 2023
abstract · pdf · html · preprint

add comment on HN

I think this paper is the key to the next speedup in local LLM inference. By making the model sparse (using the ReLU activation), we can save around 80% of memory accesses and computations of the Feed Forward Layers. ReLU sets the output of a layer to 0 when it's negative, and since any number multiplied by zero is zero, the next layer doesn't need to load the rows of the weight matrix that would be zero after the multiplication.

Unfortunately there aren't a lot of models currently trained with ReLU activation.