Guardado en:
Detalles Bibliográficos
Autores principales: Mousavi-Hosseini, Alireza, Sanford, Clayton, Wu, Denny, Erdogdu, Murat A.
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:https://arxiv.org/abs/2503.11272
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866913736089927680
author Mousavi-Hosseini, Alireza
Sanford, Clayton
Wu, Denny
Erdogdu, Murat A.
author_facet Mousavi-Hosseini, Alireza
Sanford, Clayton
Wu, Denny
Erdogdu, Murat A.
contents Theoretical efforts to prove advantages of Transformers in comparison with classical architectures such as feedforward and recurrent neural networks have mostly focused on representational power. In this work, we take an alternative perspective and prove that even with infinite compute, feedforward and recurrent networks may suffer from larger sample complexity compared to Transformers, as the latter can adapt to a form of dynamic sparsity. Specifically, we consider a sequence-to-sequence data generating model on sequences of length $N$, in which the output at each position depends only on $q$ relevant tokens with $q \ll N$, and the positions of these tokens are described in the input prompt. We prove that a single-layer Transformer can learn this model if and only if its number of attention heads is at least $q$, in which case it achieves a sample complexity almost independent of $N$, while recurrent networks require $N^{Ω(1)}$ samples on the same problem. If we simplify this model, recurrent networks may achieve a complexity almost independent of $N$, while feedforward networks still require $N$ samples. Consequently, our proposed sparse retrieval model illustrates a natural hierarchy in sample complexity across these architectures.
format Preprint
id arxiv_https___arxiv_org_abs_2503_11272
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective
Mousavi-Hosseini, Alireza
Sanford, Clayton
Wu, Denny
Erdogdu, Murat A.
Machine Learning
Theoretical efforts to prove advantages of Transformers in comparison with classical architectures such as feedforward and recurrent neural networks have mostly focused on representational power. In this work, we take an alternative perspective and prove that even with infinite compute, feedforward and recurrent networks may suffer from larger sample complexity compared to Transformers, as the latter can adapt to a form of dynamic sparsity. Specifically, we consider a sequence-to-sequence data generating model on sequences of length $N$, in which the output at each position depends only on $q$ relevant tokens with $q \ll N$, and the positions of these tokens are described in the input prompt. We prove that a single-layer Transformer can learn this model if and only if its number of attention heads is at least $q$, in which case it achieves a sample complexity almost independent of $N$, while recurrent networks require $N^{Ω(1)}$ samples on the same problem. If we simplify this model, recurrent networks may achieve a complexity almost independent of $N$, while feedforward networks still require $N$ samples. Consequently, our proposed sparse retrieval model illustrates a natural hierarchy in sample complexity across these architectures.
title When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective
topic Machine Learning
url https://arxiv.org/abs/2503.11272