Skip to main content
QUICK REVIEW

[论文解读] $O(n)$ Connections are Expressive Enough: Universal Approximability of Sparse Transformers

Chulhee Yun, Yin-Wen Chang|arXiv (Cornell University)|Jun 8, 2020
Domain Adaptation and Few-Shot Learning被引用 25
一句话总结

该论文证明,仅具有每注意力层 O(n) 连接的稀疏 Transformer 可以普遍近似任意连续的序列到序列函数,其表达能力与具有 O(n²) 连接的密集 Transformer 相当。作者提出一个统一的理论框架,明确了稀疏模式与注意力图的充分条件,证明在这些约束下稀疏模型具备普遍近似能力,并在 NLP 任务上通过实证验证了结论。

ABSTRACT

Recently, Transformer networks have redefined the state of the art in many NLP tasks. However, these models suffer from quadratic computational cost in the input sequence length $n$ to compute pairwise attention in each layer. This has prompted recent research into sparse Transformers that sparsify the connections in the attention layers. While empirically promising for long sequences, fundamental questions remain unanswered: Can sparse Transformers approximate any arbitrary sequence-to-sequence function, similar to their dense counterparts? How does the sparsity pattern and the sparsity level affect their performance? In this paper, we address these questions and provide a unifying framework that captures existing sparse attention models. We propose sufficient conditions under which we prove that a sparse attention model can universally approximate any sequence-to-sequence function. Surprisingly, our results show that sparse Transformers with only $O(n)$ connections per attention layer can approximate the same function class as the dense model with $n^2$ connections. Lastly, we present experiments comparing different patterns/levels of sparsity on standard NLP tasks.

研究动机与目标

  • 为解决一个根本性问题:稀疏 Transformer 是否能保持密集 Transformer 的普遍近似能力。
  • 识别稀疏模式与注意力图的充分条件,以确保稀疏自注意力机制具备普遍近似能力。
  • 证明每层仅 O(n) 连接即足以实现普遍近似,挑战了 O(n²) 连接为必要条件的假设。
  • 将现有稀疏注意力模式(如分段式、固定式、星型)统一于一个共同的理论框架下进行分析。
  • 在标准 NLP 基准上实证评估不同稀疏模式与稀疏程度的影响。

提出的方法

  • 通过将现有稀疏模式泛化为统一的数学结构,提出一个统一框架以分析稀疏 Transformer。
  • 提出假设 1:对稀疏模式施加连通性条件,以确保跨标记的长距离信息流动。
  • 提出假设 2:对注意力图的概率分布施加条件,以确保注意力权重的稳定与表达力。
  • 证明定理 1:满足假设 1 和假设 2 的稀疏 Transformer 可普遍近似任意连续的序列到序列函数,且与序列长度无关。
  • 推导推论 2:即使仅具有 O(n) 连接的稀疏 Transformer 也具备普遍近似能力,其表达能力与密集模型相当。
  • 在合成复制、语言建模、翻译和 GLUE 任务上开展实验,对比在受控设置下不同稀疏模式与稀疏程度的表现。

实验结果

研究问题

  • RQ1是否可能使稀疏 Transformer 在连接数显著少于 O(n²) 的情况下,仍能普遍近似任意连续的序列到序列函数?
  • RQ2稀疏模式与注意力图在结构与概率上需满足何种条件,才能确保稀疏 Transformer 具备普遍近似能力?
  • RQ3稀疏模式的选择(如分段式、固定式、星型)如何影响不同 NLP 任务中的模型性能?
  • RQ4具有 O(n) 连接的稀疏 Transformer 是否能与密集 Transformer 达到相同的表达能力?
  • RQ5在标准 NLP 基准上,稀疏程度、模式设计与下游性能之间的权衡关系如何?

主要发现

  • 仅每注意力层具有 O(n) 连接的稀疏 Transformer 可普遍近似任意连续的序列到序列函数,如推论 2 所证明。
  • 实践中常用的分段式、固定式与星型模式均满足所提出的充分条件,因此具备普遍近似能力。
  • 在合成复制任务中,采用分段式模式的多头与顺序配置在 3 层和 4 层模型上分别达到 99.84% 和 99.97% 的准确率,优于随机与星型模式。
  • 在 WMT 翻译任务中,分段式与固定式模式的 BLEU 分数与密集模型相当,其中分段式模式在 en-de 与 de-en 翻译中均表现最优。
  • 在使用 BERT_BASE 的 GLUE 任务中,分段式与固定式模式在 CoLA 与 MRPC 上的平均准确率均超过 90%,而随机与星型模式表现显著较差。
  • 结果表明,连通性与模式设计至关重要:双向模型更受益于类似星型的模式,而自回归模型则因注意力掩码而难以有效利用此类模式。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。