paper-with-me

홈 › Papers

Looped Transformers as Programmable Computers

2023-01-30 · Angeliki Giannou, Shashank Rajput, Jy-yong Sohn, Kangwook Lee, Jason D. Lee, Dimitris Papailiopoulos

We present a framework for using transformer networks as universal computers by programming them with specific weights and placing them in a loop. Our input sequence acts as a punchcard, consisting of instructions and memory for data read/writes. We demonstrate that a constant number of encoder layers can emulate basic computing blocks, including embedding edit operations, non-linear functions, function calls, program counters, and conditional branches. Using these building blocks, we emulate a small instruction-set computer. This allows us to map iterative algorithms to programs that can be executed by a looped, 13-layer transformer. We show how this transformer, instructed by its input, can emulate a basic calculator, a basic linear algebra library, and in-context learning algorithms that employ backpropagation. Our work highlights the versatility of the attention mechanism, and demonstrates that even shallow transformers can execute full-fledged, general-purpose programs.

📄 PDF Abstract BibTeX arXiv:2301.13196

Code (1)

yuedajiong/looped-transformer/blob/main/looped-transformer.py pytorch

Tasks

In-Context Learning

Similar Papers 제목 키워드 기반

Looped ReLU MLPs May Be All You Need as Practical Programmable Computers

2024-10-12 · YIngyu Liang, Zhizhou Sha, Zhenmei Shi, Zhao Song 외

Previous work has demonstrated that attention mechanisms are Turing complete. More recently, it has been shown that a looped 9-layer Transformer can function as a universal programmable computer. In contrast, the multi-l…

All

Sparse Layers are Critical to Scaling Looped Language Models

2026-05-09 · Ryan Lee, Jacob Biloki, Edward J. Hu, Jonathan May arxiv

Looped language models repeat a set of transformer layers through depth, reducing memory costs and providing natural early-exit points at loop boundaries. However, looped models do not scale as favorably as standard tran…

On Expressive Power of Looped Transformers: Theoretical Analysis and Enhancement via Timestep Encoding

2024-10-02 · Kevin Xu, Issei Sato

Looped Transformers provide advantages in parameter efficiency, computational capabilities, and generalization for reasoning tasks. However, their expressive power regarding function approximation remains underexplored. …

SpiralFormer: Looped Transformers Can Learn Hierarchical Dependencies via Multi-Resolution Recursion

2026-02-12 · Chengting Yu, Xiaobo Shu, Yadao Wang, Yizhen Zhang 외 arxiv

Recursive (looped) Transformers decouple computational depth from parameter depth by repeatedly applying shared layers, providing an explicit architectural primitive for iterative refinement and latent reasoning. However…

LoopSpec: Pipelined Self-Speculative Decoding for Looped Transformers

2026-09-15 · SangLyul Cho, Langqing Cui, Sehoon Kim, Dongsu Han 외 arxiv

Looped Transformers achieve strong performance with compact parameter sizes by repeatedly applying a shared stack of Transformer blocks across recurrent depths. However, they incur higher decoding latency than standard T…