arXiv:2507.10581cs.LGcs.AI2025-07

单层Transformer可逼近任意序列映射,理论突破。

Universal Approximation Theorem for a Single-Layer Transformer

  • 证明单层Transformer通过自注意力+前馈网络可逼近任意连续序列映射
  • 在紧集上对任意精度的序列到序列函数实现通用逼近
  • 为Transformer理论奠基,适合关注模型机理的研究者

深度学习依赖多层神经网络与反向传播训练,在自然语言处理(如BERT、GPT-3)、计算机视觉和计算生物学等领域取得成功,但其理论基础仍不完善。本文深入分析线性代数、概率与优化等核心概念,详述多头自注意力机制与反向传播算法,并提出一个关于Transformer的通用逼近定理:仅含一层自注意力与一个ReLU激活的前馈网络的单层Transformer,可在紧集上以任意精度逼近任何连续序列到序列映射。我们给出形式化陈述与完整证明,并通过案例研究展示其实际意义。该成果深化了对Transformer的理论理解,弥合了理论与实践之间的鸿沟。

原文摘要 · Abstract (English)

Deep learning employs multi-layer neural networks trained via the backpropagation algorithm. This approach has achieved success across many domains and relies on adaptive gradient methods such as the Adam optimizer. Sequence modeling evolved from recurrent neural networks to attention-based models, culminating in the Transformer architecture. Transformers have achieved state-of-the-art performance in natural language processing (for example, BERT and GPT-3) and have been applied in computer vision and computational biology. However, theoretical understanding of these models remains limited. In this paper, we examine the mathematical foundations of deep learning and Transformers and present a novel theoretical result. We review key concepts from linear algebra, probability, and optimization that underpin deep learning, and we analyze the multi-head self-attention mechanism and the backpropagation algorithm in detail. Our main contribution is a universal approximation theorem for Transformers: we prove that a single-layer Transformer, comprising one self-attention layer followed by a position-wise feed-forward network with ReLU activation, can approximate any continuous sequence-to-sequence mapping on a compact domain to arbitrary precision. We provide a formal statement and a complete proof. Finally, we present case studies that demonstrate the practical implications of this result. Our findings advance the theoretical understanding of Transformer models and help bridge the gap between theory and practice.

Transformer理论分析通用逼近

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