Paper: 2602.04852 Authors: Philipp Nazari, T. Konstantin Rusch Affiliations: Max Planck Institute for Intelligent Systems, ETH Zürich, ELLIS Institute Tübingen, Liquid AI Code: https://github.com/camail-official/LinearAttentionPruning Categories: cs.LG

Abstract

Linear attention offers a computationally efficient yet expressive alternative to softmax attention. However, recent empirical results indicate that the state of trained linear attention models often exhibits a low-rank structure, suggesting that these models underexploit their capacity in practice. We provide a theoretical analysis of the role of rank in linear attention, revealing that low effective rank can affect retrieval error by amplifying query noise.

Key Contributions

  • Theoretical insights: Analysis of how rank utilization affects retrieval error in linear attention
  • State reduction framework: Novel post-training approach to reduce state size with minimal performance degradation
  • Structured pruning method: Based on rank-revealing QR decomposition
  • Empirical validation: 50% of query/key channels can be removed with only marginal perplexity increase

Background: Linear Attention

Softmax Attention

O=softmax(QKTdk)VO = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right) V

  • Quadratic time and memory complexity O(T2)O(T^2)
  • Problematic for long sequences

Linear Attention

Removes softmax and exploits associativity:

QKTV=Q(KTV)QK^T V = Q(K^T V)

Sequential form with hidden state:

St=St1+vtktTS_t = S_{t-1} + v_t k_t^T ot=Stqto_t = S_t q_t

Where StS_t is a matrix of size (dv,dk)(d_v, d_k), the associative memory.

Benefits:

  • Linear time complexity
  • Constant memory inference
  • Chunkwise parallel training

The Low-Rank Problem

Empirical observation: Trained linear attention models exhibit low-rank structure in their hidden states.

Why Does This Matter?

The rank of the associative memory is bounded:

rank(St)min(rank(Kt),rank(Vt))t\text{rank}(S_t) \leq \min(\text{rank}(K_t), \text{rank}(V_t)) \leq t

But the effective rank (stable rank) is what matters:

sr(A)=AF2A22\text{sr}(A) = \frac{\|A\|_F^2}{\|A\|_2^2}

This measures how evenly energy is distributed across singular values.

Rank Utilization

u(S)=sr(S)min(dv,dk)u(S) = \frac{\text{sr}(S)}{\min(d_v, d_k)}

  • Low utilization (u1u \ll 1): Rank collapse, energy concentrated in few components, redundant information
  • High utilization (u1u \approx 1): Isotropic memory, energy evenly distributed

Impact on Retrieval Error

For a noisy query q~=q+n\tilde{q} = q^* + n:

  • Low rank utilization amplifies query noise
  • High rank utilization provides more robust retrieval

Key insight: The conditioning of keys κ(Kt)\kappa(K_t) is tightly connected to the effective rank of the hidden state.

State Reduction Framework

Since models underutilize their capacity, we can prune the state post-training.

Key Observation

Linear attention models are invariant under orthogonal transformations applied jointly to queries and keys:

(QT)(KT)T=QKT(QT)(KT)^T = QK^T

This allows selecting subsets of columns that contribute most to performance.

Structured vs Unstructured Pruning

TypeEffectState Size
UnstructuredSparse weights, same dimensionsUnchanged
StructuredEliminates basis vectorsReduced to d'_k<d_k

Structured pruning strictly decreases FLOPs for the recurrence.

Pruning Methods

  1. Magnitude-based: Remove columns with smallest norms
  2. Gradient-saliency: Remove columns with smallest gradient contributions
  3. Rank-revealing QR (proposed): Select columns that maximize rank utilization of remaining memory

Results

Across models of varying sizes and downstream tasks:

  • 50% of query/key channels can be removed with only marginal perplexity increase
  • Works even before recovery fine-tuning
  • Complementary to other compression methods (SliceGPT, SpinQuant, QuaRot)

Comparison

MethodOperates onComplementary
SliceGPTEmbedding spaceYes
SpinQuantEmbedding spaceYes
This workState spaceYes

Takeaways

  1. Linear attention underutilizes capacity: Trained models exhibit low-rank hidden states
  2. Low rank hurts retrieval: Amplifies query noise and reduces robustness
  3. Post-training pruning works: 50% reduction with minimal performance loss
  4. Rank-revealing QR is effective: Principled selection of important dimensions
  5. Faster and more memory-efficient: Reduced state size directly improves inference

论文: 2602.04852 作者: Philipp Nazari, T. Konstantin Rusch 机构: 马克斯·普朗克智能系统研究所, 苏黎世联邦理工学院, ELLIS图宾根研究所, Liquid AI 代码: https://github.com/camail-official/LinearAttentionPruning 分类: cs.LG

摘要

线性注意力提供了一种计算高效且表达能力强的softmax注意力替代方案。然而,最近的实证结果表明,训练后的线性注意力模型的状态通常呈现低秩结构,这表明这些模型在实践中未能充分利用其容量。我们提供了关于秩在线性注意力中作用的理论分析,揭示了低有效秩会通过放大查询噪声来影响检索误差。

主要贡献

  • 理论洞察:分析秩利用率如何影响线性注意力中的检索误差
  • 状态压缩框架:新颖的训练后方法,以最小的性能下降减少状态大小
  • 结构化剪枝方法:基于秩揭示QR分解
  • 实证验证:可以移除50%的查询/键通道,仅有边际困惑度增加

背景:线性注意力

Softmax注意力

O=softmax(QKTdk)VO = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right) V

  • 二次时间和内存复杂度 O(T2)O(T^2)
  • 对长序列有问题

线性注意力

移除softmax并利用结合律:

QKTV=Q(KTV)QK^T V = Q(K^T V)

带隐藏状态的顺序形式:

St=St1+vtktTS_t = S_{t-1} + v_t k_t^T ot=Stqto_t = S_t q_t

其中 StS_t 是大小为 (dv,dk)(d_v, d_k) 的矩阵,即关联记忆

优点:

  • 线性时间复杂度
  • 恒定内存推理
  • 分块并行训练

低秩问题

实证观察:训练后的线性注意力模型在其隐藏状态中呈现低秩结构

为什么这很重要?

关联记忆的秩有界:

rank(St)min(rank(Kt),rank(Vt))t\text{rank}(S_t) \leq \min(\text{rank}(K_t), \text{rank}(V_t)) \leq t

有效秩(稳定秩)才是关键:

sr(A)=AF2A22\text{sr}(A) = \frac{\|A\|_F^2}{\|A\|_2^2}

这衡量能量在奇异值上分布的均匀程度。

秩利用率

u(S)=sr(S)min(dv,dk)u(S) = \frac{\text{sr}(S)}{\min(d_v, d_k)}

  • 低利用率 (u1u \ll 1):秩崩溃,能量集中在少数分量,信息冗余
  • 高利用率 (u1u \approx 1):各向同性记忆,能量均匀分布

对检索误差的影响

对于噪声查询 q~=q+n\tilde{q} = q^* + n

  • 低秩利用率放大查询噪声
  • 高秩利用率提供更稳健的检索

关键洞察:键的条件数 κ(Kt)\kappa(K_t) 与隐藏状态的有效秩紧密相关。

状态压缩框架

由于模型未充分利用其容量,我们可以在训练后剪枝状态。

关键观察

线性注意力模型在对查询和键联合应用正交变换时是不变的

(QT)(KT)T=QKT(QT)(KT)^T = QK^T

这允许选择对性能贡献最大的列子集。

结构化与非结构化剪枝

类型效果状态大小
非结构化稀疏权重,相同维度不变
结构化消除基向量减少到 d'_k<d_k

结构化剪枝严格减少递归的FLOPs。

剪枝方法

  1. 基于幅度:移除范数最小的列
  2. 梯度显著性:移除梯度贡献最小的列
  3. 秩揭示QR(提出的):选择最大化剩余记忆秩利用率的列

实验结果

在不同大小的模型和下游任务中:

  • 可以移除50%的查询/键通道,仅有边际困惑度增加
  • 甚至在恢复微调之前就有效
  • 与其他压缩方法互补(SliceGPT, SpinQuant, QuaRot)

比较

方法操作空间互补性
SliceGPT嵌入空间
SpinQuant嵌入空间
本工作状态空间

要点总结

  1. 线性注意力未充分利用容量:训练后的模型呈现低秩隐藏状态
  2. 低秩损害检索:放大查询噪声并降低稳健性
  3. 训练后剪枝有效:50%的压缩仅有最小性能损失
  4. 秩揭示QR有效:有原则地选择重要维度
  5. 更快更省内存:减少的状态大小直接改善推理