揭示Transformer如何通过注意力实现局部到全局的函数逼近。
Learning Theory of Transformers: Local-to-Global Approximation via Softmax Partition of Unity

- 用softmax构造局部近似并融合成全局输出,利用注意力实现空间定位。
- 两层编码器即可以ε⁻ᵈ⁄α量级参数逼近α-霍尔德连续函数,误差均匀可控。
- 理论首次给出近最优泛化误差界,适合研究模型原理或设计新架构者参考。
本文研究Transformer在网络用于[0,1]ᵈ及d维紧致黎曼流形上的回归任务时的学习理论。提出一种新型构造性逼近框架:通过仿射变换对输入进行空间定位,利用注意力机制构建目标函数的局部近似,并通过softmax分片单位法聚合为全局近似。从逼近角度证明,仅需两个编码器块和标准单隐藏层前馈网络的密集浅宽Transformer,即可在使用𝒪(ε⁻ᵈ⁄α)总参数下,对α∈(0,1]的α-霍尔德连续函数实现一致ε-逼近误差。基于此逼近保证,进一步建立经验风险最小化器的近最优泛化误差界,为𝒪(n⁻²ᵃ⁄²ᵃ⁺ᵈ log n),其中n为训练数据规模。所研究的Transformer结构为密集、浅层、宽网络,采用softmax激活与正弦位置编码,贴近实际应用形态。
原文摘要 · Abstract (English)
This paper investigates the learning theory of Transformer networks for regression tasks on the compact Euclidean domain $[0,1]^d$ and $d$-dimensional compact Riemannian manifolds. We propose a novel constructive approximation framework for Transformers that builds local approximations of the target function and aggregates them into a global approximation via softmax partition of unity. This approach leverages the attention mechanism to achieve spatial localization through affine transformations of the input. The softmax activation plays a crucial role in aggregating local approximations to a global output. From an approximation perspective, we prove that a dense Transformer equipped with only two encoder blocks and standard single-hidden-layer point-wise feed-forward networks can achieve a uniform $\varepsilon$-approximation error for $α$-Hölder continuous functions with $α\in (0,1]$ using $\mathcal{O}(\varepsilon^{-d/α})$ total parameters. Building upon this approximation guarantee, we establish a near minimax-optimal generalization error bound of order $\mathcal{O}\big(n^{-\frac{2α}{2α+d}} \log n\big)$ for the empirical risk minimizer, where $n$ is the training data size. The Transformer architecture studied in this paper is dense, shallow and wide, and employs softmax activation and sinusoidal positional encodings, closely reflecting practical implementations.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。