Skip to main content
QUICK REVIEW

[Paper Review] ReLU$^2$ Wins: Discovering Efficient Activation Functions for Sparse LLMs

Zhengyan Zhang, Yixin Song|arXiv (Cornell University)|Feb 6, 2024
Natural Language Processing TechniquesComputer Science3 citations
TL;DR

This paper proposes ReLU² as a superior activation function for sparse inference in large language models (LLMs), redefining neuron activation based on output magnitude thresholds rather than zero values. Through systematic evaluation across sparsity-performance trade-offs, sparsity predictivity, and hardware efficiency, ReLU² achieves up to 90% sparsity with under 0.1% performance loss and reduces I/O overhead by 92%, outperforming ReLU, SwiGLU, and ReGLU in all metrics.

ABSTRACT

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.

Motivation & Objective

  • To broaden the scope of sparse computation in LLMs beyond zero-activation-based methods by redefining neuron activation using output magnitude thresholds.
  • To identify the optimal activation function for sparse LLM inference by evaluating trade-offs between sparsity, performance, predictivity, and hardware efficiency.
  • To demonstrate that non-ReLU LLMs, such as those using LLaMA’s activation, also exhibit meaningful sparsity under the new magnitude-based definition.
  • To show that ReLU² achieves the best balance across all key efficiency dimensions: sparsity, performance, predictivity, and hardware-friendly computation patterns.
  • To release code and models to enable reproducibility and future research in efficient, sparse LLM deployment.

Proposed method

  • Introduce a generalized activation definition based on whether neuron output magnitudes exceed a learnable or fixed threshold, enabling sparsity detection beyond zero activations.
  • Conduct a systematic analysis of sparsity across four activation functions—ReLU, SwiGLU, ReGLU, and ReLU²—on 1B-scale LLMs under consistent training and evaluation protocols.
  • Evaluate the sparsity-performance trade-off by varying the magnitude threshold and measuring accuracy degradation at different sparsity levels.
  • Assess predictivity by training lightweight predictors to forecast neuron activation states before computation, measuring how accurately inactive neurons can be identified.
  • Analyze hardware efficiency by measuring reuse ratios across consecutive tokens and co-activation patterns between neurons, focusing on memory access patterns and I/O optimization potential.
  • Use sliding window techniques to measure memory reuse efficiency and co-activation gaps to quantify the benefit of contiguous memory access for different activation functions.

Experimental results

Research questions

  • RQ1Can sparse activation be meaningfully extended beyond zero-activation values to include small but non-zero output magnitudes?
  • RQ2How does the sparsity-performance trade-off vary across different activation functions when using magnitude-based thresholding?
  • RQ3Which activation function enables the most accurate prediction of inactive neurons prior to computation?
  • RQ4How do computational relationships between neurons—such as co-activation frequency and memory reuse—differ across activation functions and impact real hardware efficiency?
  • RQ5Does ReLU² achieve superior performance across all dimensions of sparse LLM efficiency: sparsity, accuracy, predictivity, and hardware friendliness?

Key findings

  • Models using ReLU² achieve a sparsity ratio of nearly 90% with less than 0.1% performance degradation, outperforming ReLU, SwiGLU, and ReGLU in the sparsity-performance trade-off.
  • ReLU² exhibits the highest predictivity among all activation functions, enabling more accurate identification of inactive neurons before computation.
  • The hardware affinity of ReLU² is superior, with a 92% reduction in I/O overhead for feed-forward networks by leveraging high memory reuse and co-activation patterns.
  • ReLU² achieves a higher top-average co-activation gap (0.2) than SwiGLU (0.1), indicating greater potential for memory coalescing and contiguous access optimization.
  • The reuse ratio for ReLU² with a window size of 5 is twice that of window size 1, showing strong optimization potential under sliding window inference.
  • Overall, ReLU² reduces total FLOPs by 56% and I/O overhead by 92% while maintaining high performance, making it the most efficient activation function for sparse LLMs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.