Note: Attention 实际上定义了序列中各个位置的 Connection 强度
Alon U., et al. On the Bottleneck of Graph Neural Networks and Its Practical Implications. ICLR, 2021.
Note: 需要说明的是, 从这篇文章出发, Causal Attention 的 Bottleneck 并不严重
Note: 随着层数的增加, 由于 over-squashing 的存在, GNN 越来越难利用到 long-range 的’邻居’信息
[1] Barbero F., et al. Transformers need glasses! Information over-squashing in language tasks. NeurIPS, 2024.
[2] Barbero F., et al. Why do LLMs attend to the first token? arXiv, 2025.
[3] Wu X., et al. On the Emergence of Position Bias in Transformers. arXiv, 2025.
Note: 在 GNN 中, over-squashing 指的是膨胀的感受野导致每个邻居的贡献很有限; 而在 LLM 中, over-squashing 指的是 early tokens 会产生更多的影响. 虽然二者可能都会导致类似 representational collpase 的现象, 但是严格来说不能混为一谈. 实际上, LLM 中是否存在所谓的 over-squashing 问题也是个未知数, 因为 Causal Attention 实际上已经是 Graph 领域里一个推荐的方案了.
Theorem B.3 (Representational Collapse) Let $X = [\bm{x}_0, \ldots, \textcolor{blue}{\bm{x}_{n-1}}] \in \mathbb{R}^{n \times d}$ and $X^* = [\bm{x}_0, \ldots, \textcolor{blue}{\bm{x}_{n-1}, \bm{x}_{n-1}}] \in \mathbb{R}^{(n + 1) \times d}$ be two sequences for a final repeated token $\bm{x}_{n-1}$, with
Then, for large enough $n \in \mathbb{N}_+$, we have that the representations are under any $\epsilon$:
Note: 证明的关键是保证 Attention 能够尽可能一致, 因而加权和之后的向量表示也一致. 第一个条件主要是保证自己和自己的 score 算出来不会无限大, 否则就一定有区别, 另一个条件主要是保证 Attention 是渐进一致的.
Note: Copying 的例子有趣在于: First-token copying 比起 Last-token copying 反而更容易. 通过 ‘over-squashing’ 解释就是, first-token copying 能够产生更多的影响.
$\textcircled{\small 1}$ 求和: $1 + \cdots + 1$;
$\textcircled{\small 2}$ 计数: 统计一串均为 1 的序列中有多少个 1;
$\textcircled{\small 3}$ 计数: 统计一串 0/1 序列中有多少个 1 (1 出现的概率为 70%);
$\textcircled{\small 4}$ 单词计数: 统计一串序列中某个词出现的次数.
难度: $\textcircled{\small 3} < \textcircled{\small 1} \approx \textcircled{\small 4} < \textcircled{\small 2}$
策略: No CoT $\approx$ CoT Zero-Shot $>$ CoT Few-Shot
Note: 这个例子主要是说明’间隔’符号对于 Counting 的帮助.
Note: 位置编码有可能可以缓解 Connection Bottleneck
绝密伏击. 十分钟读懂旋转编码(RoPE). 知乎, 2023.
Note: 注意, 这里的高低频针对的是位置编码而不是输入信号 (query or key)
Left: RoPE 下的 Attention 的某个上界随着 $|j - i|$ 增加而衰减
Right: 高斯噪声下, 真实的 Attention 并无衰减现象
Note: 横坐标是相对距离
Barbero F., et al. Round and Round We Go! What makes Rotary Positional Encodings useful? ICLR, 2025.
Note: 这是一个隐式的例子: 作者将维度两两分组, 假设模长越大越偏向于语义信息. 在绝大部分 layers 中高频部分仅被分配了较小的模长, 例外是初始的和最后的一些层.
$\textcircled{\small 1}$ Last Layers: Diagonal attention $\textcircled{\small 2}$ First Layers: Previous-token attention
Barbero F., et al. Why do LLMs attend to the first token? arXiv, 2025.
Note: 最开始的层倾向于 previous-token attention, 而最后的几层则倾向于 diagonal attention. Previous-token attention, 即 attention sink 现象在下面的文献有所讨论.
❓ 不施加位置编码, 是否依然能形成特殊的 Attention 形态
结论:
总而言之, 位置编码赋予了模型关注特定区域的能力, 有可能缓解 connection bottleneck
❓ $\theta_i = b^{-2i / d} \xrightarrow{\textcolor{blue}{b \uparrow}} \text{long-context ability} \uparrow$
1. Long-term decay of upper bound of attention score
Men X., et al. Base of RoPE Bounds Context Length. NeurIPS, 2024.
$\bm{q}, \bm{k}$ 独立同分布, $\mathbb{E}[\bm{\epsilon}] = 0$.
希望 $\bm{q}, \bm{q} + \bm{\epsilon}$ 的 attention 严格大于 $\bm{q}, \bm{k}$ 的需要满足:
$\textcircled{\small 1}$ Given that, and since the sequence is uniform, the count is the number of '1's, which is the total numbers in the sequence. Given that, and since counting manually is not feasible, the answer is that all numbers are '1's, hence the count is equal to the number of numbers in the sequence. But since the exact count isn't provided, perhaps the answer is to recognize that every number is '1'.
Case I: “y,x,y,y,x,y,y,x,y,x,y,y,y,y,x,y,y,y,x”
Case II: “yxyyxyyxyxyyyyxyyyx” (ACC = 0.16%)
Ye T., et al. Differential Transformer. ICLR, 2025.
Note: 个人认为, 纯粹的位置编码是应付不了需要极端注意力的情况的. 我们需要物理层面的干预, 来帮助 LLM 减少无关信息.