TL;DR
This paper introduces a hardware-friendly, multiplication-only algorithm to approximate matrix inversion in Gated DeltaNet models. By replacing sequential "forward substitution" with a truncated Neumann series and parallel residual correction, the authors achieve up to a 5x kernel speedup on NPUs while maintaining model accuracy, even under aggressive low-bit quantization.
What Problem Does This Paper Address?
As Large Language Models (LLMs) push toward massive context lengths, standard attention mechanisms become prohibitively expensive due to their quadratic ($O(T^2)$) cost. Linear attention methods offer a solution by maintaining a fixed-size state, but they often introduce new bottlenecks.
Specifically, Gated DeltaNet—a state-of-the-art linear attention architecture used in models like Qwen3.5—relies on a "chunk-wise" parallel recurrence. This process requires inverting a triangular matrix for every chunk of data. Traditionally, this is done via forward substitution, a sequential process where each step depends on the previous one.
For modern hardware like Neural Processing Units (NPUs), which are designed for massive, parallel Matrix Multiplications (MatMuls), this sequential dependency is a disaster. It leaves the NPU's high-throughput MatMul units idle while the processor struggles through vector-heavy, serial operations. The authors found that matrix inversion can account for over 30% of the total computation time in these layers.
Methods
The authors propose a "good enough" approximation that turns matrix inversion into a series of parallel MatMuls. Their approach consists of three main pillars:
- Truncated Neumann Series: Mathematically, the inverse of a matrix $(I - A)$ can be expressed as an infinite sum: $I + A + A^2 + A^3 \dots$. Because the matrices in Gated DeltaNet are strictly lower-triangular (nilpotent), this series is actually finite. However, calculating every term is still slow. The authors observed that the "energy" of the inverse is concentrated near the diagonal, allowing them to truncate the series early (e.g., at $N=3$) without losing significant information.
- Effective Diagonal Masking: Higher-order terms in the Neumann series can grow explosively in value, leading to numerical overflow, especially in 16-bit or 8-bit precision. The authors apply a structural mask that keeps only the well-behaved values near the diagonal, improving numerical stability for quantization.
- Parallel Residual Correction: To recover the accuracy lost by truncation, they use a reformulated iterative update. Crucially, they rewrite this update to eliminate step-by-step dependencies, allowing the correction to be computed as a batch of MatMuls.
Datasets
The researchers evaluated their method using the Qwen3.5 model family (ranging from 0.8B to 9B parameters) and the Qwen3-Next-80B model. They tested performance on:
- WikiText-v2: To measure language modeling quality (perplexity).
- Downstream Benchmarks: MMLU (general knowledge), CSR (common sense reasoning), and RealWorldQA (multimodal/visual reasoning).
- Calibration Data: 1000 samples from the C4 dataset and 25 images from LLaVA-COCO for quantization calibration.
Key Insights and Ideas
- MatMul-Only is the Goal: On modern AI hardware, an algorithm that uses more total operations but consists entirely of MatMuls is often faster than a mathematically "optimal" algorithm that is sequential.
- The "Heavy Tail" Enemy: In low-precision (INT8/INT16) settings, the rare, massive values in higher-order Neumann terms dictate the scaling factors for the entire matrix. By truncating and masking these "outliers," the authors actually improve the effective resolution for the rest of the data.
- Diagonal Concentration: The paper proves that for these specific triangular matrices, the most important information for the inverse lives very close to the main diagonal. This "diagonal localization" is what makes low-order truncation viable.
Key Results
- Speedup: The proposed method achieved a 5.2x speedup for 32x32 matrix inversions and a 4.2x speedup for 64x64 kernels compared to the standard Flash Linear Attention (FLA) baseline.
- System Efficiency: At the layer level, this translated to an 18.1% to 24.6% reduction in total cycle costs on a Snapdragon 8 Elite platform.
- Accuracy Preservation: Across all Qwen3.5 model sizes, the approximation showed virtually zero degradation in perplexity or downstream task accuracy.
- Quantization Robustness: The method remained stable under W4A16 (4-bit weights, 16-bit activations) and even INT8 quantization for the matrix inversion itself, where traditional methods often fail due to numerical instability.
Limitations and Future Work
- Chunk Size Scaling: While the method works excellently for 64x64 chunks, the authors noted that for very large chunks (128x128), the worst-case values can still exceed the dynamic range of FP16. In these cases, they still recommend falling back to block-wise decomposition.
- Hardware Specificity: The benefits are most pronounced on NPUs. While the MatMul-only approach is generally good, the specific trade-offs between algebraic depth and memory traffic might vary on different GPU architectures.
- Future Directions: The authors suggest that adapting the approximation order ($N$) and correction steps ($S$) dynamically based on the specific layer or context could further optimize the efficiency-accuracy trade-off.
Summary updated