TL;DR
This paper argues that the Transformer architecture, despite its success, has fundamental limitations in performing function composition, a core aspect of reasoning. Using communication complexity and computational complexity theory, the authors prove that a single Transformer layer cannot reliably compose functions when their domains are large, and that certain complex compositional tasks are inherently difficult for Transformers, even with multiple layers.
What Problem Does This Paper Address?
Large Language Models (LLMs) based on the Transformer architecture are known to "hallucinate" – generating outputs that are inconsistent with their training data or prompts. While much research focuses on mitigating these hallucinations, this paper delves into the root causes of this phenomenon, specifically investigating whether the Transformer architecture itself possesses inherent limitations that contribute to these failures. The authors focus on "function composition," a fundamental reasoning capability where the output of one function becomes the input for another (e.g., "Who is the father of my mother?"). They hypothesize that the Transformer's difficulty with such tasks, especially when dealing with complex relationships or large datasets, is a key contributor to hallucinations.
Methods
The paper employs two primary theoretical frameworks:
- Communication Complexity: This approach models the problem as a scenario with multiple agents (Faye, Grace, Xavier) who have partial information and need to communicate to solve a problem. The authors use this to prove that a single Transformer attention layer cannot reliably compute function composition when the domain size is large enough relative to the model's parameters. The core idea is to show that the amount of information a Transformer can process and transmit is insufficient to capture the complexity of composing functions with large domains.
- Computational Complexity Theory: This framework analyzes the inherent difficulty of computational problems. The authors leverage this to argue that certain mathematical tasks, which are representative of compositional reasoning, are likely impossible for Transformers to solve efficiently for large instances, assuming widely accepted conjectures in complexity theory (like P ≠ NP). They relate Transformer capabilities to complexity classes like L (logarithmic space).
Datasets
Not discussed in the paper. The paper focuses on theoretical limitations rather than empirical evaluation on specific datasets.
Key Insights and Ideas
- Function Composition is a Fundamental Weakness: The paper provides theoretical evidence that function composition, a seemingly simple yet crucial reasoning task, is an inherent weakness of the Transformer architecture. This is not just a matter of insufficient training data but a structural limitation.
- The Softmax Bottleneck: The authors suggest that the softmax computation within the attention mechanism, which relies on limited non-local information, is a key culprit for this limitation.
- Domain Size Matters: The impossibility results for function composition are tied to the size of the function domains. As domains grow larger than the Transformer's internal parameters (embedding dimension, number of heads), its ability to compose functions breaks down.
- Chain-of-Thought (CoT) Offers Limited Relief: While CoT can help with simpler composition tasks, the paper proves that for iterated function composition (composing many functions in sequence), CoT requires an exponentially larger prompt, making it impractical for deep compositions.
- Complexity Class Limitations: The paper connects Transformer capabilities to computational complexity classes, suggesting that tasks requiring more than logarithmic memory (like certain SAT variants and circuit evaluation) are fundamentally hard for Transformers, even with multiple layers.
Key Results
- Theorem 1: A single Transformer attention layer cannot solve the function composition problem with high probability if the domain size
nsatisfiesn log n > H(d + 1)p, whereHis the number of attention heads,dis the embedding dimension, andpis the precision. - Theorem 2: Solving iterated function composition with Chain-of-Thought (CoT) requires a prompt length that grows as Ω(√N), where N is the domain size.
- Theorem 3: The computation of an L-layer Transformer can be performed with O(L log N) bits of memory, placing it within the logarithmic space complexity class for a constant number of layers.
- Observation 2: Problems like Derivability, 2-SAT, Horn SAT, and Circuit evaluation are shown to be impossible for multi-layer Transformers unless certain strong complexity conjectures (L=NL, L=P, L=Mod 2 L) are false.
- Empirical Examples: The paper includes examples (Figures 1-3) showing how state-of-the-art LLMs (ChatGPT 3.5/4, Bard) fail on simple spatial, temporal, and relationship composition tasks, illustrating the practical implications of these theoretical limitations.
Limitations and Future Work
- Single Layer vs. Multi-Layer: The primary theoretical impossibility results are proven for a single Transformer layer. While the authors suspect these limitations extend to multi-layer Transformers, they acknowledge this is an area for further investigation.
- Probabilistic Nature: The impossibility results for function composition are probabilistic, meaning there's a non-zero error probability, and they hold when the domain size is larger than the Transformer's parameters.
- Asymptotic Results: The computational complexity results are asymptotic, meaning they apply to "large enough" instances, and the exact threshold for these difficulties to manifest in practice is unknown.
- Future Work: The authors pose a challenge: "What would it take to design a different attention layer that is immune to these two lower bound techniques, while maintaining the architecture's efficiency and effectiveness in practice?" They suggest exploring attention mechanisms that are not commutative or associative, or that require more than logarithmic space. They also highlight the need for more sophisticated communication complexity models tailored to computationally restricted agents to better understand Transformer limitations.
Summary updated