arXiv:2602.09297cs.LG2026-02

用拉普拉斯矩阵替换部分注意力权重,让模型更智能地平滑词元表示。

Laplacian Heads Improve Transformers by Smoothing Token Representations

  • 用图拉普拉斯矩阵替代部分注意力矩阵,控制序列内变化。
  • 在多种任务中提升性能,尤其改善了词元表示的可分性。
  • 适合关注模型内部表示机制与注意力优化的研究者。

Transformer 通过多头注意力和残差连接更新词元表示:$X \leftarrow X + \sum_{i} P^{(i)}XW_{V_i}W_{o_i}$,其中 $P^{(i)}$ 是第 $i$ 个头的 softmax 注意力矩阵。本文提出将一部分 $P^{(i)}$ 替换为拉普拉斯矩阵 $I - P^{(i)}$,得到 $X \leftarrow X + \sum_{i \in \mathcal{A}} P^{(i)}XW_{V_i}W_{o_i} + \sum_{i \in \mathcal{L}} (I - P^{(i)})XW_{V_i}W_{o_i}$。该方法有两个动机:一是使注意力头能更新词元表示的均值,而拉普拉斯头可直接调控序列内的方差;二是若将词元视为以 $P^{(i)}$ 为边权的图节点,则 $I - P^{(i)}$ 即为图拉普拉斯矩阵,该更新可解释为图上热扩散的一步。我们证明这一简单修改在监督学习、语言建模和自监督学习任务中均提升性能。进一步分析发现,在监督学习中,拉普拉斯头使同一序列内词元表示坍缩,并使序列均值对齐神经坍缩几何结构;在语言建模中,增强共享下一个词预测的词元表示的可分性;在自监督学习中,使主成分更利于分割。跨模态下,其谱衰减更快,表明更强的词元平滑。结果挑战了‘过度平滑有害’的主流观点,表明特定形式的平滑反而有益。

原文摘要 · Abstract (English)

Transformers update token representations through multi-head attention and residual connections as $X \leftarrow X + \sum_{i} P^{(i)}XW_{V_i}W_{o_i}$, where $P^{(i)}$ is the softmax attention matrix in head $i$. We propose replacing a subset of $P^{(i)}$'s with the Laplacian $I - P^{(i)}$, giving $X \leftarrow X + \sum_{i \in \mathcal{A}} P^{(i)}XW_{V_i}W_{o_i} + \sum_{i \in \mathcal{L}} (I - P^{(i)})XW_{V_i}W_{o_i}$. Our proposal has two motivations. First, it allows attention heads to update the mean of token representations, while Laplacian heads can directly control within-sequence variance. Second, if tokens are viewed as nodes in a graph with edge weights $P^{(i)}$, then $I - P^{(i)}$ is the corresponding graph Laplacian, and the update can be interpreted as one step of heat diffusion on the graph. We show that this simple modification improves performance across supervised learning, language modeling, and self-supervised learning tasks. To investigate why, we examine the token representations learned with and without Laplacian heads. In supervised learning, Laplacian heads collapse token representations within the same sequence and align the sequence means with the geometry of Neural Collapse. In language modeling, they increase the separability of token representations that share the same next-token prediction. In self-supervised learning, they produce token representations whose principal components are better suited for segmentation. Across modalities, they also lead to faster-decaying spectra, indicating stronger token smoothing. Overall, our findings challenge the prevailing view that token oversmoothing is inherently harmful, showing instead that certain forms of smoothing can be beneficial.

Transformer注意力机制表示学习图神经网络

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。