揭示多层Transformer的高效逼近机制,解释为何两层结构比单层节省大量参数。
InfoFlow: A Framework for Multi-Layer Transformer Analysis
- 提出信息流框架,追踪每层可访问输入位置的信息集
- 证明两层Transformer仅需O(ε⁻¹)参数即可达精度ε,而单层需Ω(ε⁻ᵏ)参数
- 适用于研究模型效率、理论分析或优化架构设计的研究者
尽管单层Transformer的近似性质已有研究,但多层设置的严格理论理解仍有限。本文证明:对于某些检索任务,任意单层Transformer需至少Ω(ε⁻ᵏ)参数才能达到精度ε,其中k随序列长度T线性增长;而双层单头Transformer仅需O(ε⁻¹)参数即可实现相同精度。为理解这一差异,我们识别出两种多层近似的核心机制:1)softmax注意力只能高效检索最大注意力得分的标记,对第k大(k≥2)的检索需指数级增长参数;2)解码耦合信息的参数开销与检索标记集大小相关。基于此,我们提出InfoFlow框架,通过在每层跟踪可访问输入位置的信息集,并为每种信息传播模式分配显式近似率。该抽象能恢复已有近似界,与训练网络的实验观察一致,并在当前难以直接分析的场景中给出具体预测。结果提供了一个系统性的多层Transformer近似效率分析框架。
原文摘要 · Abstract (English)
While the approximation properties of single-layer Transformer architectures have been studied in recent works, a rigorous theoretical understanding of the multi-layer setting remains limited. In this work, we establish that multi-layer Transformers possess fundamentally different approximation capabilities from single-layer ones: for certain retrieval tasks, any single-layer Transformer requires least $Ω(\varepsilon^{-k})$ parameters to achieve precision $\varepsilon$, where $k$ grows linearly with sequence length $T$, whereas a two-layer Transformer with a single head per layer achieves the same approximation precision with at most $O (\varepsilon^{-1})$ parameters. To understand this separation, we identify two structural mechanisms underlying multi-layer approximation. Specifically, softmax attention can only efficiently retrieve the token attaining the maximum attention score, incurring exponential-in-length parameter cost for $k$-th largest retrieval with $k \geq 2$. Moreover, the parameter cost of decoding coupled information scales with the size of the retrieved token set. Motivated by these findings, we propose InfoFlow, a framework for multi-layer Transformers. The framework tracks an information set of accessible input positions at each token and layer, assigning an explicit approximation rate to each mode of information propagation. This abstraction recovers known approximation bounds, remains consistent with experimental observations on trained networks, and yields concrete predictions in settings where direct theoretical analysis is currently intractable. Our results provide a principled framework for reasoning about the approximation efficiency of multi-layer Transformers.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。