Abstract
Natural language processing (NLP) made an impressive jump with the introduction of Transformers. ChatGPT is one of the most famous examples, changing the perception of the possibilities of AI even outside the research community. However, besides the impressive performance, the quadratic time and space complexity of Transformers with respect to sequence length pose significant limitations for handling long sequences. While efficient Transformer architectures like Linformer and Performer with linear complexity have emerged as promising solutions, their theoretical understanding remains limited. In this paper, we introduce Sumformer, a novel and simple architecture capable of universally approximating equivariant sequence-to-sequence functions. We use Sumformer to give the first universal approximation results for Linformer and Performer. Moreover, we derive a new proof for Transformers, showing that just one attention layer is sufficient for universal approximation.
Introduction
Standard Transformers serve as the backbone of modern artificial intelligence, yet they are hampered by a "quadratic bottleneck." As the input sequence length ($n$) increases, the computational and memory costs grow by $n^2$, making long-context processing prohibitively expensive. To mitigate this, researchers developed "efficient" Transformers, such as Linformer and Performer, which reduce complexity to linear $O(n)$.
Despite their practical success, a fundamental theoretical question remained: does reducing complexity sacrifice "expressivity"—the model's ability to learn any complex function? While standard Transformers were previously proven to be universal approximators, those proofs were mathematically dense and suggested that an impractical, exponential number of layers might be required. This paper introduces the Sumformer framework to provide a unified theoretical foundation, proving that efficient models are just as capable as their quadratic counterparts.
The Sumformer Architecture
The authors propose the Sumformer, a simplified mathematical framework that captures the essence of global information exchange in sequence models. A Sumformer operates in two distinct stages:
- Summation: Every token in the sequence is passed through a function $\phi$, and the results are aggregated into a single global vector $\Sigma$ via summation.
- Transformation: The output for each token is then produced by a second function $\psi$, which takes both the individual token and the global sum $\Sigma$ as inputs.
This architecture is remarkably simple yet powerful. The authors provide two distinct paths to prove its universality: a Continuous Proof utilizing the algebra of multisymmetric polynomials for smooth mappings, and a Discrete Proof using a piecewise constant approach to approximate functions by partitioning the input space.
Theoretical Breakthroughs
The Power of One
Perhaps the most significant finding is that a single attention layer is sufficient for universal approximation. Previous literature (e.g., Yun et al., 2019) suggested that the number of layers needed to grow exponentially with the token dimension. This work demonstrates that through clever construction, the "global communication" required for universal approximation can be achieved within a single layer, drastically improving theoretical bounds.
A Bridge to Efficient Transformers
The Sumformer acts as a theoretical "middleman." By proving that Linformers, Performers, and standard Transformers can all be viewed as approximations of a Sumformer, the authors successfully extend universality results to these more complex architectures for the first time.
Empirical Validation
To validate these theoretical claims, the authors tested "Polynomial Sumformers" and "MLP Sumformers" on synthetic, analytically defined equivariant functions. These experiments confirmed that the architecture is not merely a mathematical possibility but is effectively trainable via standard gradient descent.
Latent Dimension Trade-off
A key insight from the experiments is the relationship between the "latent dimension" ($d'$) of the global sum and the model's accuracy. As theory predicts, increasing the capacity of the sum leads to better approximation, though with diminishing returns as the dimension grows.
Limitations and Future Work
While the Sumformer provides a powerful proof of concept, it highlights a significant scaling challenge: the continuous proof requires the internal latent dimension ($d'$) to scale polynomially ($n^d$) with the sequence length. In practice, this means that for very long sequences, the "width" of a single layer might need to be impractically large.
Furthermore, there exists a clear trade-off between depth and width. While one layer is theoretically sufficient given enough width, the "discontinuous" proof suggests that using more layers allows for a smaller latent dimension. Future research may apply the Sumformer framework to other emerging architectures, such as State Space Models (SSMs), to explore their universal properties.
Summary updated