arXiv:2502.02270cs.LGmath.OC2025-02被引 2

Transformer可精确拟合任意有限长度序列数据,且参数量与输出长度相关。

Exact Sequence Interpolation with Transformers

  • 通过交替使用前馈与自注意力层,构造出可精确插值的Transformer架构。
  • 模型参数量为O(d × ∑m^j),与输入序列长度无关,仅依赖输出总长度。
  • 适用于序列建模任务,尤其适合需要高精度插值的场景。

我们证明了Transformer可以精确插值ℝ^d(d≥2)中任意有限长度的输入序列及其对应输出序列(输出长度不超过输入)。给定N组长度任意但有限的输入序列和对应的输出序列长度m¹,…,mᴺ∈ℕ,我们构建了一个包含𝒪(∑ⱼ₌₁ᴺ mʲ)个块、𝒪(d × ∑ⱼ₌₁ᴺ mʲ)参数的Transformer,可实现精确插值。该构造通过交替使用前馈层与自注意力层,并利用后者固有的聚类效应,实现了与输入长度无关的复杂度估计。方法还引入自注意力中的低秩参数矩阵,符合实际Transformer设计。结果首先在hardmax自注意力设置下建立,具备显式量化分析能力,随后推广至softmax设置。最后,我们展示了该构造在学习任务中的适用性,特别是在正则化训练下可保证收敛至全局最优解。本研究深化了对Transformer模型理论性能的理解,解释了其在序列到序列精确插值任务中的优异表现。

原文摘要 · Abstract (English)

We prove that transformers can exactly interpolate datasets of finite input sequences in $\mathbb{R}^d$, $d\geq 2$, with corresponding output sequences of smaller or equal length. Specifically, given $N$ sequences of arbitrary but finite lengths in $\mathbb{R}^d$ and output sequences of lengths $m^1, \dots, m^N \in \mathbb{N}$, we construct a transformer with $\mathcal{O}(\sum_{j=1}^N m^j)$ blocks and $\smash{\mathcal{O}(d \sum_{j=1}^N m^j)}$ parameters that exactly interpolates the dataset. Our construction provides complexity estimates that are independent of the input sequence length, by alternating feed-forward and self-attention layers and by capitalizing on the clustering effect inherent to the latter. Our novel constructive method also uses low-rank parameter matrices in the self-attention mechanism, a common feature of practical transformer implementations. These results are first established in the hardmax self-attention setting, where the geometric structure permits an explicit and quantitative analysis, and are then extended to the softmax setting. Finally, we demonstrate the applicability of our exact interpolation construction to learning problems, in particular by providing convergence guarantees to a global minimizer under regularized training strategies. Our analysis contributes to the theoretical understanding of transformer models, offering an explanation for their excellent performance in exact sequence-to-sequence interpolation tasks.

Transformer序列插值理论分析

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