Abstract: Previous work has shown that the languages recognized by average-hard attention transformers (AHATs) and softmax-attention transformers (SMATs) are within the circuit complexity class TC$^0$. However, these results assume limited-precision arithmetic: using floating-point numbers with O(log n) bits (where n is the length of the input string), Strobl showed that AHATs can be approximated in L-uniform TC$^0$, and Merrill and Sabharwal showed that SMATs can be approximated in DLOGTIME-uniform TC$^0$. Here, we improve these results, showing that AHATs with no approximation, SMATs with O(poly(n)) bits of floating-point precision, and SMATs with at most $2^{-O(poly(n))}$ absolute error are all in DLOGTIME-uniform TC$^0$.
Introduction
Researchers have long sought to understand the "expressive power" of Transformers: what kinds of logic can they actually compute? Previous work established that Transformers belong to $TC^0$, a complexity class representing problems solvable by constant-depth circuits with "majority" gates. This is a very "shallow" class of computation, suggesting Transformers are great at parallel processing but poor at deep, sequential reasoning.
However, those earlier proofs came with a catch: they assumed the Transformer used very limited arithmetic precision (only $O(\log n)$ bits). In the real world, we use 16-bit, 32-bit, or even higher precision, and theoretical models often assume real numbers. This left a gap: Does higher precision give Transformers more "brainpower"? Could a high-precision Transformer solve $NC^1$-complete problems (like the "Boolean formula value problem") that a low-precision one cannot?
Methodology
This work uses formal circuit complexity analysis to close this gap, focusing on two types of models: AHATs (Average-Hard Attention Transformers), where attention focuses only on the maximum scores, and SMATs (Softmax-Attention Transformers), the standard architecture used in models like GPT.
To prove these models stay within $TC^0$, the author demonstrates how to implement their core operations using circuits of constant depth. Key technical moves include:
- Rational Representation: For AHATs, values can be represented as pairs of integers (rational numbers). By showing that these integers only need a polynomial number of bits, the whole system fits in $TC^0$.
- High-Precision Floating Point: The paper proves that iterated addition and multiplication of $O(\text{poly}(n))$-bit floating-point numbers—far more precision than previously proven—can still be done in $TC^0$.
- Taylor Series Approximations: Truncated Taylor series are used to compute complex functions like square roots and exponentials (required for Softmax) within the strict constraints of constant-depth circuits.
Key Results and Insights
The most significant insight is that moving from logarithmic precision to polynomial precision (and even arbitrary precision for AHATs) does not move the Transformer out of the $TC^0$ class. The "ceiling" of what a Transformer can compute is remarkably rigid. Specifically:
- AHATs with no approximation are in DLOGTIME-uniform $TC^0$.
- SMATs with $O(\text{poly}(n))$ bits of precision are in DLOGTIME-uniform $TC^0$.
- SMATs with tiny absolute error ($2^{-O(\text{poly}(n))}$) are in DLOGTIME-uniform $TC^0$.
These results reinforce the idea that Transformers cannot solve $NC^1$-complete problems. For example, while a Transformer can check if a Boolean formula is syntactically correct (the Dyck language), it likely cannot determine if that formula is true (the semantics), because the latter requires the deeper sequential logic of $NC^1$.
Discussion
While theoretically significant, these results describe a version of a Transformer much more powerful than the ones we actually build; the levels of precision discussed (polynomial bits) are far beyond current hardware like H100 GPUs. Furthermore, the conclusion that Transformers "cannot" solve certain problems relies on the widely held (but unproven) assumption that $TC^0 \neq NC^1$. If these two classes are actually the same, then Transformers are much more powerful than currently understood. Future research studying SMATs with a more "realistic" margin (like $1/O(\text{poly}(n))$) could potentially bridge the gap between high-level theory and practical machine learning.
Summary updated