Summary (Overview)
- LinQuant is a framework for low-precision inference of linear recurrent neural networks, based on seven functional invariances that preserve full-precision computation while making operands more amenable to quantization.
- The invariances comprise four mixer-external changes of basis (key-side rotation, key-side rescaling, value-side rotation, value-side rescaling) and three mixer-internal absorptions (scalar-decay, diagonal-decay, and write-factor absorptions).
- The framework's applicability is characterized across common recurrence families: Linear Attention, Mamba-2, GLA, DeltaNet, Gated DeltaNet, and KDA, with formal proofs of validity conditions.
- LinQuant improves perplexity at matched latency over the state-of-the-art SSDi8 baseline on Mamba-2 (1.3B, 2.7B, 8B) and Nemotron-H (8B) models in production W4A8 settings.
- INT8 Triton kernel implementations demonstrate that query–key rotation adds no measurable prefill latency, and the framework generalizes beyond Mamba-2 to other modern recurrent architectures.
Introduction and Theoretical Foundation
Background and Motivation
Linear recurrences are emerging as practical alternatives to softmax attention in large language models (LLMs), appearing in standalone architectures (e.g., Mamba-2) and hybrid designs. They summarize past tokens in a fixed-size state, avoiding the growing key–value cache of softmax attention. During prefill, chunkwise parallel algorithms process blocks of tokens through dense matrix multiplications, making them naturally amenable to low-precision execution.
While low-precision (e.g., INT8) attention kernels are mature in the Transformer inference stack, low-precision kernels for linear recurrences remain largely unexplored. Prior work (e.g., MambaQuant, Quamba2) focused on quantizing projections and activations around the recurrence, while SSDi8 executes the recurrent computation itself in INT8—but only for Mamba-2 specifically.
Theoretical Foundation
The general linear recurrence is defined by the state update:
where is the write gate, denotes the decay, distinguishes linear writes from delta-rule corrections, and is the matrix-valued recurrent state.
Key structural choices:
- Decay: Scalar decay vs. diagonal decay
- Write gating: Scales the new association
- Delta correction: Removes the component of the existing state aligned with the current key before writing
Invariance-Based Quantization
Functional invariances preserve the full-precision operator while changing the numerics presented to a quantizer. Two broad classes are distinguished:
- Mixer-agnostic invariances: Act on the residual stream or individual layers (e.g., SmoothQuant, QuaRot-like rotations).
- Mixer-specific invariances: Depend on the sequence operator itself, further divided into:
- Mixer-external invariances: Changes of basis applicable outside the sequence mixer
- Mixer-internal invariances: Functions of the recurrence's algorithmic realization
The paper characterizes which attention-inspired invariances survive in recurrences, what new restrictions arise, and what invariances are unique to linear recurrences.
Methodology
Low-Precision Chunkwise Realization
The chunkwise computation is organized into four matrix contractions plus a state pass. For Mamba-2, the low-precision realization is:
where denotes quantization with implicit scales.
The Seven Functional Invariances
Changes of Basis (Mixer-External):
-
Key-side rotation :
Valid when (holds for no/scalar decay; for diagonal decay, restricted to local contractions).
-
Key-side rescaling :
Valid for linear writes under no, scalar, or diagonal decay; commutes with diagonal decay but does not preserve delta-corrected writes. Parameterized by with ; balances query/key magnitudes.
-
Value-side rotation :
Valid across all recurrences; introduces a choice of state storage basis (canonical vs. rotated), affecting quantization error.
-
Value-side rescaling :
State transforms as ; parameterized by .
Absorptions (Mixer-Internal):
-
Scalar-decay absorption : Splits tail-decay between value and key sides:
: key-side decay; : value-side decay (used by SSDi8).
-
Diagonal-decay absorption : Factors each token's decay into scalar magnitude and relative channel pattern:
Then .
-
Write-factor absorption : Splits write gate between operands:
For delta-rule writes, uses two parameters to split the gate inside the Gram construction and in the complementary write factor.
Experimental Setup
- Controlled "mixer zoo": Linear Attention, Mamba-2, GLA, DeltaNet, Gated DeltaNet, KDA at 340M (15B tokens) and 1.3B (100B tokens) parameters on SlimPajama.
- INT6 quantization for controlled studies (to amplify effects), INT8 for production.
- Scale granularities: (per-head/per-channel), (per-tensor/per-channel), (per-tensor/per-tensor).
- Production setup: W4A8 models with INT8 recurrent states, augmenting SSDi8.
Empirical Validation / Results
Controlled Study Findings
Key-axis transformations (Figure 2):
- benefit depends on recurrence structure: effective with no/scalar decay, little benefit with diagonal decay (restricted to local contractions).
- QK normalization reduces quantization error independently.
- Coarser key scales increase benefit; remains useful with per-head scales.
- sweep shows best rescaling is generally shared between queries and keys ().
Value-axis transformations (Figure 3):
- Both and most useful with per-tensor value scales, recovering large portions of excess NLL.
- Quantizing the state in a rotated basis incurs more error than canonical basis storage.
- favored over since it folds into quantization scales without extra cost.
Absorptions (Figure 4):
- Write-gate absorption recovers significant excess NLL under coarse scales ().
- Preferred write-gate placement depends on scale granularity: (gate on values) preferred under ; splitting favored in other regimes.
- For delta writes, non-standard placements outperform the standard WY placement of Flash Linear Attention.
- Scalar decay placement matters most: moving decay from values to keys increases excess NLL under per-tensor value scales.
- Diagonal-decay absorption provides little gain.
Combined transformations: Reduce quantization error more than individual transformations, recovering roughly twice as much excess NLL as the best single transformation at INT6 under for 340M Mamba-2 and LA.
Production Results
Table 2: Production WikiText-2 perplexity (lower is better)
| Model | FP16 | SSDi8 | value | value | key |
|---|---|---|---|---|---|
| Mamba-2 1.3B | 10.420 | 10.928 | 10.860 | 10.849 | 10.830 |
| Mamba-2 2.7B | 9.060 | 9.441 | 9.379 | 9.383 | 9.372 |
| Mamba-2 8B | 7.250 | 7.620 | 7.456 | 7.435 | 7.437 |
| Nemotron-H Base | 6.030 | 6.338 | 6.186 | 6.178 | 6.175 |
| Nemotron-H Reasoning | 8.423 | 8.921 | 8.666 | 8.650 | 8.670 |
Kernel Performance Results
- Query–key rotation adds no measurable end-to-end prefill latency on evaluated Mamba-2 models.
- Fused rescaling leaves measured layer latency unchanged.
- Value-side decay absorption is faster for target Mamba-2 geometries, though the gap narrows (and can reverse) as value dimension increases.
- Canonical storage adds overhead; neither value-side transformation is applied in the production configuration.
Applicability Summary (Table 1)
| Nr. | Transformation | LA | Mamba-2 | GLA | DN | GDN | KDA |
|---|---|---|---|---|---|---|---|
| 1/7 | ✓ | ✓ | (✓) | ✓ | ✓ | (✓) | |
| 2/7 | ✓ | ✓ | ✓ | × | × | × | |
| 3/7 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| 4/7 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| 5/7 | × | ✓ | (✓) | × | ✓ | (✓) | |
| 6/7 | × | ✓ | ✓ | × | ✓ | ✓ | |
| 7/7 | (✓) | (✓) | (✓) | ✓ | ✓ | ✓ |
Theoretical and Practical Implications
Theoretical Implications
- New degrees of freedom: Linear recurrences exhibit invariance structures qualitatively different from softmax attention—decay, gating, and delta-rule updates impose constraints but also create unique degrees of freedom (e.g., decay/write absorption) with no attention analogue.
- Characterization of validity: The paper formally derives when each invariance holds across recurrence families, showing that diagonal decay breaks global rotations but admits rescalings, while delta-rule updates restrict key-side transformations but allow novel write-factor splits with two parameters.
- Scale-granularity interaction: The effectiveness of each invariance depends critically on quantization scale granularity, revealing that optimal invariant selection is coupled with the quantization scheme.
Practical Implications
- Production-ready: LinQuant improves perplexity on Mamba-2 (1.3B, 2.7B, 8B) and Nemotron-H (8B) over SSDi8 at matched latency, with no measurable overhead from query–key rotation.
- Kernel efficiency: The invariances with zero incremental cost (folding into quantization scales or register-level operations) are preferred in production; canonical storage under value rotation is rejected due to overhead.
- Broader design space: The framework generalizes beyond integer prefill to floating-point and other future low-precision implementations of recurrent models.
- Guidance for practitioners: The controlled study provides concrete guidance—e.g., use value-side decay absorption for speed, apply for Mamba-2-style recurrences, and prefer over to avoid storage-basis overhead.
Conclusion
LinQuant provides a systematic framework for low-precision linear recurrent inference based on seven functional invariances: four changes of basis (key/value rotations and rescalings) and three absorptions (scalar-decay, diagonal-decay, and write-factor redistributions). The paper characterizes applicability across common recurrence families and demonstrates through controlled experiments that the benefits of each invariance depend on:
- Recurrence structure (decay type, delta correction, write gating)
- Query–key normalization
- Quantization scale granularity
- State-storage basis
Key Findings
- Changes of basis and write-gate allocation are particularly effective under coarse scales.
- benefits no/scalar-decay recurrences and is restricted for diagonal decay.
- commutes with diagonal decay and improves quantization error where applicable.
- Value-side transformations are most useful with per-tensor scales; is preferred over due to storage-basis costs.
- Standard floating-point placements of decay/write factors are not always optimal after quantization.
Production Impact
On production models, LinQuant improves perplexity over the SSDi8 baseline on all evaluated Mamba-2 and Nemotron-H models, with query–key rotation adding no measurable prefill latency—demonstrating practical utility of invariance-based quantization for recurrent models.
Future Directions
- Exploring alternative parameterizations of diagonal-decay absorption
- Extending the invariance framework to floating-point low-precision formats
- Investigating additional functional invariances unique to other recurrent architectures
- Studying the interaction of invariances with other quantization techniques (e.g., weight quantization, activation reconstruction)
Related papers
- The Physical Cost of Context: Quality-Constrained Resource Accounting for Coding Agents
Quality-gated evaluation of coding agents reveals that editing reusable history can increase uncached prefill by 608% despite cutting prompt tokens, so physical work must be measured, not just token counts.
- Beyond the Training Horizon: Mechanisms and Limits of Length Generalization in Looped Transformers
Looped Transformers achieve length generalization via distinct recurrent mechanisms, but success does not guarantee faithful step-by-step reasoning when tasks permit lossy shortcuts.
- AgenticEvolve: Evolutionary Program Search with Persistent Language Model Agents that Design and Run Experiments
AgenticEvolve, where persistent LLM agents run self-designed experiments between evaluations, consistently outperforms baselines in heuristic design and symbolic regression while keeping costs under a few dollars per run.