<p>We prove that transformers can exactly interpolate datasets of finite input sequences in <InlineEquation ID="IEq1"> <EquationSource Format="TEX">\(\mathbb {R}^d\)</EquationSource> <EquationSource Format="MATHML"><math> <msup> <mrow> <mi mathvariant="double-struck">R</mi> </mrow> <mi>d</mi> </msup> </math></EquationSource> </InlineEquation>, <InlineEquation ID="IEq2"> <EquationSource Format="TEX">\(d\ge 2\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>d</mi> <mo>≥</mo> <mn>2</mn> </mrow> </math></EquationSource> </InlineEquation>, with corresponding output sequences of smaller or equal length. Specifically, given <i>N</i> sequences of arbitrary but finite lengths in <InlineEquation ID="IEq3"> <EquationSource Format="TEX">\(\mathbb {R}^d\)</EquationSource> <EquationSource Format="MATHML"><math> <msup> <mrow> <mi mathvariant="double-struck">R</mi> </mrow> <mi>d</mi> </msup> </math></EquationSource> </InlineEquation> and output sequences of lengths <InlineEquation ID="IEq4"> <EquationSource Format="TEX">\(m^1, \dots , m^N \in \mathbb {N}\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <msup> <mi>m</mi> <mn>1</mn> </msup> <mo>,</mo> <mo>⋯</mo> <mo>,</mo> <msup> <mi>m</mi> <mi>N</mi> </msup> <mo>∈</mo> <mi mathvariant="double-struck">N</mi> </mrow> </math></EquationSource> </InlineEquation>, we construct a transformer with <InlineEquation ID="IEq5"> <EquationSource Format="TEX">\(\mathcal {O}(\sum _{j=1}^N m^j)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <msubsup> <mo>∑</mo> <mrow> <mi>j</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>N</mi> </msubsup> <msup> <mi>m</mi> <mi>j</mi> </msup> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> blocks and <InlineEquation ID="IEq6"> <EquationSource Format="TEX">\(\smash {\mathcal {O}(d \sum _{j=1}^N m^j)}\)</EquationSource> <EquationSource Format="MATHML"><math> <mpadded depth="0pt" height="0pt"> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>d</mi> <msubsup> <mo>∑</mo> <mrow> <mi>j</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>N</mi> </msubsup> <msup> <mi>m</mi> <mi>j</mi> </msup> <mo stretchy="false">)</mo> </mpadded> </math></EquationSource> </InlineEquation> 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.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Exact sequence interpolation with transformers

  • Albert Alcalde,
  • Giovanni Fantuzzi,
  • Enrique Zuazua

摘要

We prove that transformers can exactly interpolate datasets of finite input sequences in \(\mathbb {R}^d\) R d , \(d\ge 2\) d 2 , with corresponding output sequences of smaller or equal length. Specifically, given N sequences of arbitrary but finite lengths in \(\mathbb {R}^d\) R d and output sequences of lengths \(m^1, \dots , m^N \in \mathbb {N}\) m 1 , , m N N , we construct a transformer with \(\mathcal {O}(\sum _{j=1}^N m^j)\) O ( j = 1 N m j ) blocks and \(\smash {\mathcal {O}(d \sum _{j=1}^N m^j)}\) O ( d 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.