Despite the widespread adoption of Transformer models for NLP tasks, the expressive power of these models is not well-understood. In this paper, we establish that Transformer models are universal approximators of continuous permutation equivariant sequence-to-sequence functions with compact support, which is quite surprising given the amount of shared parameters in these models. Furthermore, using positional encodings, we circumvent the restriction of permutation equivariance, and show that Transformer models can universally approximate arbitrary continuous sequence-to-sequence functions on a compact domain. Interestingly, our proof techniques clearly highlight the different roles of the self-attention and the feed-forward layers in Transformers. In particular, we prove that fixed width self-attention layers can compute contextual mappings of the input sequences, playing a key role in the universal approximation property of Transformers. Based on this insight from our analysis, we consider other simpler alternatives to selfattention layers and empirically evaluate them. p p dX 1/p . The following result shows that a Transformer network with a constant number of heads h, head size m, and hidden layer of size r can approximate any function in F PE . 1 In our proof we use bias vectors b i Q for query projections in attention layers. We omit them here for brevity. Published as a conference paper at ICLR 2020 Lukasz Kaiser, Aidan N Gomez, and Francois Chollet. Depthwise separable convolutions for neural machine translation. arXiv preprint arXiv:1706.03059, 2017. Hongzhou Lin and Stefanie Jegelka. ResNet with one-neuron hidden layers is a universal approximator. . A broad-coverage challenge corpus for sentence understanding through inference. In . Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In
REF studied the representation power of Transformers and showed that they are universal approximators of sequence to sequence functions.
Are Transformers universal approximators of sequence-to-sequence functions?
ArXiv
ArXiv
Mathematics Computer Science