Looped Transformers as Programmable Computers

01/30/2023
by   Angeliki Giannou, et al.
0

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.

READ FULL TEXT

page 3

page 8

page 9

page 12

research
06/13/2021

Thinking Like Transformers

What is the computational model behind a Transformer? Where recurrent ne...
research
02/03/2023

Coinductive guide to inductive transformer heads

We argue that all building blocks of transformer models can be expressed...
research
02/14/2023

Energy Transformer

Transformers have become the de facto models of choice in machine learni...
research
04/07/2022

Towards Comparing Performance of Algorithms in Hardware and Software

In this paper, we report on a preliminary investigation of the potential...
research
06/01/2023

Learning Transformer Programs

Recent research in mechanistic interpretability has attempted to reverse...
research
05/30/2023

Universality and Limitations of Prompt Tuning

Despite the demonstrated empirical efficacy of prompt tuning to adapt a ...
research
08/17/2022

Proof Engineering with Predicate Transformer Semantics

We present a lightweight, open source Agda framework for manually verify...

Please sign up or login with your details

Forgot password? Click here to reset