On Expressive Power of Floating-Point Transformers
Abstract
Research on the expressive power of transformers shows that transformers are equivariant to permutations and can approximate all permutation-equivariant continuous functions on a compact domain. However, these results assume real parameters and exact operations, whereas real-world implementations on computers can only use a finite set of numbers and inexact machine operations with round-off errors. In this work, we investigate the representability of floating-point transformers that use floating-point parameters and floating-point operations. Unlike existing results under exact arithmetic, we first show that floating-point transformers can represent non-permutation-equivariant functions even without positional encoding. Furthermore, we prove that floating-point transformers can represent all permutation-equivariant functions when the sequence length is bounded, but they cannot when the sequence length is large. We also identify the minimal equivariance property in floating-point transformers, and show that all non-trivial additive positional encoding can harm the representability of floating-point transformers.
Lay Summary
Transformers are the technology behind many modern AI systems, including tools such as ChatGPT. Most mathematical studies of transformers assume that computers perform calculations perfectly. Real computers, however, constantly round numbers during calculations. We wanted to understand whether these tiny rounding errors can change what transformers are capable of doing. Surprisingly, we found that they can. Existing theory predicts that transformers should behave in a very structured way when processing information. However, we show that the small rounding errors that occur on real computers can break some of these theoretical properties. In particular, transformers can sometimes detect information that theory says they should ignore, and their abilities can change when the input becomes sufficiently long. Our results reveal a gap between the idealized transformers studied in theory and the transformers that run on real hardware. By taking computer arithmetic into account, our work contributes to building a more realistic understanding of how modern AI systems actually behave.