This paper introduces NLI (Non-uniform Linear Interpolation), a framework designed to accelerate the "nonlinear" parts of Large Language Models (LLMs)—like Softmax, SiLU, and RMSNorm—which have become a major bottleneck in efficient inference.
TL;DR
NLI uses a dynamic-programming approach to find the mathematically optimal way to approximate complex nonlinear functions using simple linear segments. By covering the entire FP16 range and utilizing a clever two-level hardware lookup, it matches FP32 accuracy while delivering a 4x improvement in hardware efficiency over existing state-of-the-art methods.
What Problem Does This Paper Address?
In the world of LLM optimization, we’ve become very good at squashing linear layers (matrix multiplications) using quantization (e.g., INT8 or W4A8). However, nonlinear operations—like the SiLU activation in Llama or the Softmax in attention—still largely rely on high-precision floating-point hardware.
Existing solutions, like standard Lookup Tables (LUTs), fall short for two primary reasons:
- The Outlier Problem: Modern LLMs produce activation values that frequently exceed $\pm100$. Previous approximation methods were often tuned for narrow ranges (e.g., $[-5, 5]$). When an LLM hits an "outlier" outside this range, the approximation error explodes, causing the model's logic to collapse and perplexity to skyrocket.
- Hardware Overhead: To be accurate, a LUT needs many "cutpoints." Checking which segment an input belongs to usually requires hundreds of parallel comparators, which is expensive in terms of silicon area and power consumption.
Methods
The authors propose a comprehensive two-part solution bridging software algorithms and hardware design:
1. The NLI Algorithm (Software)
Instead of manually picking points or using data-driven calibration, NLI treats cutpoint selection as a Dynamic Programming (DP) problem.
- Objective: Minimize the mean relative interpolation error across the entire FP16 grid.
- Optimization: Using Bellman’s optimality principle, the algorithm finds the globally optimal partition of the function into $M$ segments.
- Calibration-Free: Because it optimizes based on the function's analytical shape and the limits of FP16 precision, it doesn't need "calibration data" to work.
2. The NLI-Engine (Hardware)
To make this efficient in silicon, the researchers designed a two-level address translation scheme:
- Macro-intervals: The hardware first uses just 10 comparators to find which "major" region the input falls into.
- Micro-bins: Within those regions, the input is mapped to one of 32 uniform sub-bins using simple bit-shifting and scaling. This entirely avoids the need for 200+ power-hungry comparators.
- Pipeline: A 4-stage hardware pipeline handles the interval selection, address generation, table lookup, and final linear interpolation ($y = mx + b$).
Key Insights and Ideas
- Relative Error is King: The DP objective focuses on relative error rather than absolute error. This is crucial for LLMs, where small values near zero and huge outliers both need to be handled with high fidelity.
- Function Curvature Matters: The DP naturally places more cutpoints where the function "bends" the most (high second derivative) and fewer where it is nearly linear, maximizing the "accuracy budget."
- Hardware-Algorithm Co-design: The decision to use 10 macro-intervals and 32 micro-bins wasn't arbitrary; it was chosen to make the hardware address translation "cheap" (using floors and shifts) while still allowing the DP to find an optimal fit.
Datasets and Evaluation
The researchers evaluated NLI across a massive suite of models and benchmarks:
- Models: Llama3 (8B, 70B), Qwen (1.5, 2.5, and 3 series ranging from 7B to 110B).
- LLM Benchmarks: Wikitext-2 (for perplexity), MMLU, GSM8k, HumanEval, and a 10-task zero-shot suite (ARC, BoolQ, etc.).
- Vision Generality: To prove it isn't just for LLMs, they successfully tested it on DETR, ViT, and YOLOv8 using COCO and ImageNet.
Key Results
- Zero Accuracy Loss: Across all tested LLMs (Llama3, Qwen), NLI matched the accuracy and perplexity of the FP32 baseline. In contrast, previous methods like NN-LUT caused models to fail completely on wide-range activations.
- Silicon Efficiency: When synthesized on a 28nm process, the NLI Engine saved ~68% of the area compared to previous designs.
- 4x Efficiency Boost: NLI achieved a 4.02x to 4.29x improvement in computational efficiency (throughput per area-power) compared to state-of-the-art nonlinear units.
- Speed: The optimal cutpoints for a new function can be found in under 10 minutes on a single consumer GPU (RTX 4090).
Limitations and Future Work
- FP16 Focus: The current work is optimized for the FP16 domain. As the industry moves toward FP8 or even more exotic formats (like Microscaling formats), the DP grid would need to be redefined.
- Fixed Segment Count: The hardware uses a fixed number of segments (259). While this is plenty for current functions, extremely "wiggly" future activations might require a larger table.
- Integration: While the hardware is "plug-and-play," it still requires integration into existing NPU architectures to realize the full system-level power savings.
Summary updated