Universal and Efficient Computation with 2D Attention
Christos Tzamos, Guoqing Zheng, Athul Jacob
NeurIPS page · OpenReview · Open on the map
Category: Interpretability & Model Adaptation › Transformer Length and Memory Scaling · Type: new method · Keywords: 2D attention, efficient transformers, universal computation, RAM simulation, WebAssembly compilation, combinatorial problem solving
Areas: LLM Reasoning › Efficient Reasoning › Transformer Circuits; Long Context › Long-context mechanisms › Efficient attention; Model Architectures & Sequence Modeling › Language Model Architectures › Attention Replacement and Stabilization
Summary
The paper introduces an efficient algorithm that achieves polylogarithmic time per token while preserving universal computation, effectively turning a transformer into a programmable computer.
Explained to a 5-year-old
Computers that think a lot need a lot of time to remember everything. If we make them forget some things, they become fast but can't solve hard problems. This paper finds a way to be both fast and remember everything by using a new kind of thinking pattern. With this pattern, a computer can act like a real computer and run programs. It can solve puzzles that even big computers have trouble with.
Explained to a 5-year-old, longer
Imagine a big brain that can remember everything it sees, but it takes a very long time to think because it has to look at every piece of information. To make it faster, we sometimes tell it to only look at a small part, but then it forgets the rest and can't solve big problems. This paper discovers a clever trick that lets the brain stay fast and still remember everything by using a special way of paying attention. With this trick, the brain can act like a real computer, following step-by-step instructions just like a program. It can run those instructions over and over, learning from each step. This allows it to solve puzzles that even the biggest, smartest computers find difficult. The trick also works with a simple language called WebAssembly, which is like a set of rules that any computer can understand. By turning that language into the brain’s memory, we can run many different kinds of tasks, from math problems to planning routes. The result is a model that is both efficient and powerful, opening new possibilities for using AI as a real computational tool.
For a technical reader
The work restricts attention heads to two dimensions, achieving amortized polylogarithmic time per token for both insertions and queries. It demonstrates that such 2D-attention transformers can simulate arbitrary RAM machines efficiently via chain-of-thought decoding, reaching polylog(N) time per simulated step. A compiler translates i32 WebAssembly programs into transformer weights, allowing the model to execute arbitrary code autoregressively over millions of steps, solving combinatorial problems that challenge large reasoning LLMs.
Problem
Transformers suffer from quadratic attention complexity, making them inefficient for large contexts, while limiting context windows hampers their ability to retain past information and compute arbitrarily. This creates a trade-off between efficiency and computational power that the paper seeks to resolve.
Method
The approach restricts attention heads to two dimensions, providing an algorithm that processes insertions and queries in amortized polylogarithmic time per token. It then shows that such models can efficiently simulate arbitrary RAM machines via chain-of-thought decoding, achieving polylogarithmic time per simulated step. Finally, a compiler translates i32 WebAssembly programs into transformer weights, enabling the model to execute arbitrary code autoregressively.
Results
The approach achieves amortized polylogarithmic time per token for attention, enables RAM simulation in polylog(N) time per step, and successfully runs WebAssembly programs over millions of autoregressive steps, solving combinatorial problems where large LLMs struggle.
Contributions
Provides the first algorithm that achieves polylogarithmic time per token for attention while preserving full computational power, proves that such models can efficiently simulate arbitrary RAM machines, and introduces a compiler that turns WebAssembly programs into transformer weights for programmable computation.
Practical relevance
Enables efficient, programmable transformers that can solve complex combinatorial tasks without the memory and compute overhead of large LLMs.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction