The weights are programmed
Query, key, value, and feed-forward matrices are set analytically to perform reads, writes, arithmetic, and branches. The central existence result does not train these weights from data.
What the construction proves, how attention becomes an addressable machine, and why “constant depth” does not mean constant runtime.
The paper gives an explicit recipe for turning a small, frozen encoder Transformer into the equivalent of a programmable processor. The same Transformer block is applied repeatedly. Its input sequence is not prose: it is a carefully formatted array containing a scratchpad, mutable memory, machine instructions, and a program counter. One pass through the block executes one instruction; feeding the output back as the next input executes the next instruction.
Query, key, value, and feed-forward matrices are set analytically to perform reads, writes, arithmetic, and branches. The central existence result does not train these weights from data.
Instructions select operations; memory tokens hold variables; a scratchpad holds intermediate values. The model’s parameters stay fixed while the sequence changes.
A fixed set of layers is reused for as many machine cycles as needed. Unique network depth is constant, but sequential work still grows with the number of executed instructions.
Earlier theory had already shown that Transformers can be Turing complete or universal sequence-to-sequence approximators. Those results answer an expressivity question: can some Transformer represent arbitrary computation? They do not necessarily give an engineer a compact instruction set, a memory convention, or a way to compile an ordinary iterative algorithm into a shallow reusable network.
At the same time, work on in-context learning had shown both empirically and constructively that Transformers can behave like learning algorithms. Existing constructions often used a new layer for each optimization step. If ten gradient steps require ten copies of a block, architecture depth is tied to computation length.
Giannou and colleagues ask a more operational question: Can one fixed Transformer be designed as a reusable compute unit, with the program supplied in its input and repeated application supplying arbitrary computation time? Their answer is yes, under the paper’s formal model.
The model is an encoder-style Transformer over a matrix X ∈ ℝ^(d×n). Columns are tokens; rows are features. It uses residual self-attention, a ReLU feed-forward block, and softmax attention. Unlike a production language model, it consumes structured numerical embeddings rather than natural-language tokens, uses full rather than causal attention, and is placed inside an explicit outer loop.
The sequence is partitioned into three column regions:
Every location has a binary ±1 positional code. These codes are not merely descriptive position metadata: they act as machine addresses.
If location i has a ±1 binary address vector pᵢ of length log n, then pᵢᵀpᵢ = log n. Any different address pⱼ disagrees in at least one bit, so pᵢᵀpⱼ < log n. The authors choose query and key matrices so the intended address gets the largest attention score.
High-temperature softmax makes that score nearly one-hot. A value matrix then copies the chosen column into the scratchpad. Reversing the addressing pattern writes a scratchpad value to one selected memory column.
This is content-addressable memory built from attention. It is approximate because softmax never becomes an exact argmax at finite temperature. The paper bounds the error and, for the binary SUBLEQ construction, adds a ReLU error-correction step that snaps sufficiently small perturbations back to −1, 0, or +1.
The ReLU block is wired to implement binary addition, two’s-complement negation, sign tests, masking, and selection. A one-hidden-layer ReLU network increments the binary program counter. Another block creates a branch flag and chooses between the branch target and the next sequential address.
Two technical constructions are especially useful later:
exp(cz) ≈ 1 + cz. After subtracting the constant component, attention scores expose dot products. A two-layer function block thereby approximates matrix products.The first complete computer executes a restricted form of SUBLEQ, “subtract and branch if less than or equal to zero.” An instruction has three addresses:
| Before | Subtraction | Control flow |
|---|---|---|
mem[a]=3, mem[b]=7, target c=42 | mem[b] ← 7−3 = 4 | 4 > 0, so advance to the next instruction. |
mem[a]=3, mem[b]=2, target c=42 | mem[b] ← 2−3 = −1 | −1 ≤ 0, so set the program counter to instruction 42. |
Subtraction plus conditional branching can synthesize ordinary arithmetic, loops, and control flow. The paper’s restricted variant keeps commands separate from memory. Appendix C argues that it remains Turing complete by compiling a Minsky register machine, itself a universal model, into sequences of these instructions.
mem[a] and mem[b].b.c or increment the program counter.Lemma 4: a looped Transformer with 10 layers, 2 heads, and width O(log n + log N) can run these programs, where n scales with program plus memory length and N is integer bit width.
A useful correction to some online summaries: the final ICML/PMLR paper says 10 layers for this SUBLEQ construction.
SUBLEQ proves universality, but expressing matrix multiplication as a long subtraction program would be unwieldy. The authors therefore introduce FLEQ, a flexible instruction that can call one of M built-in Transformer function blocks:
An instruction carries pointers to a, b, c, the selected block m, the branch flag, the target p, and dimensions for the operands. Function blocks share a standardized interface: inputs A and B occupy reserved scratchpad columns and output C=f(A,B) is written to another reserved region.
l₁,…,lₘ and head counts h₁,…,hₘ, one FLEQ executor uses 9 + max lᵢ layers, Σhᵢ heads, and width O(Md + log n). Applying it recurrently T times executes T instructions.
The constant-depth claim concerns the executor after its function library is fixed. Width grows with the number of functions and operand size; accuracy can require more heads or larger numerical parameters.
| Construction | Result | Important qualification |
|---|---|---|
| SUBLEQ computer | 10 layers, 2 heads | Integer bit width and program/memory length are explicit resources; universality assumes unbounded memory and cycles. |
| Calculator | 12 layers; addition, subtraction, multiplication, inverse, square root, percentage | Inverse and square-root are approximations on stated bounded domains; accuracy depends on head count. |
| Matrix inverse | 13 layers executing Newton–Raphson iterations | Approximation error can be reduced through softmax scaling; convergence still depends on the numerical algorithm’s assumptions. |
| Dominant eigenvector | 13 layers executing power iteration | The paper states T = O(log(1/ε)) iterations for its guarantee; ordinary power-iteration conditions still matter. |
| Linear-model SGD | 13 layers, 1 head | Runs repeated gradient updates over in-context data; each simulated step is approximate. |
| Two-layer-network training | 13 layers, 1 head | Implements forward computation, backpropagation, and SGD for a sigmoid-activated network. |
These are analytic constructions. The paper gives pseudocode, parameter recipes, and error arguments; it does not compare throughput, energy, or wall-clock speed with conventional numerical software.
In ordinary training, an optimizer changes the model’s parameters. Here, the Transformer’s own weights W remain frozen. The sequence contains a second model’s weights, biases, examples, labels, and learning rate as mutable data. The looped Transformer reads one example, computes gradients, and overwrites those stored weights. In that precise sense, learning occurs inside the forward execution.
For the two-layer network, FLEQ instructions perform matrix transposes and products, sigmoid activations, output errors, hidden-layer errors, outer products, and parameter updates. A program loop moves through data points and epochs. The result generalizes earlier constructions that implemented one or a few steps of linear regression.
Suppose the executor has L layers and the program runs for T cycles. There are only L distinct parameterized layers, reused each time, but the unfolded computation has roughly L×T sequential layer applications. The paper itself says total complexity scales with the number of executed instructions, as standard complexity assumptions require.
The conceptual advance is weight sharing across computational time, not free computation. This is closer to a recurrent neural network, cellular automaton, or CPU clock cycle than to a fixed feed-forward circuit that answers in one pass.
The same executor can run different instruction sequences placed in its input. That is genuine program/data separation at the level of the construction. FLEQ’s primitive operation library, however, is baked into the weights. A program may combine those primitives in new sequences, but adding a genuinely new primitive requires adding or changing a function block.
The universality route is conventional: SUBLEQ can simulate a universal register machine, and the looped Transformer can simulate SUBLEQ. Like other universality arguments, it is asymptotic. Unbounded computation requires unbounded cycles, sufficient address space and memory, and adequate numerical fidelity. Any fixed physical instantiation has finite resources.
The paper’s Appendix A is unusually direct: efficiency was not experimentally validated; the Transformer implementation may be less efficient than running the algorithm directly; the separated command/memory layout can waste space; integration with pretrained models is unclear; and the finite-precision analysis is incomplete. Several additional qualifications follow from the theorems.
| Issue | Why it matters |
|---|---|
| Hand-coded weights | This is an existence and design result, not evidence that gradient descent will find the construction or that it is robust after training. |
| Nonstandard input | The model receives numerical columns with dedicated address, mask, and control fields. Ordinary text tokenization does not supply this representation. |
| Architecture mismatch | The construction uses an encoder-style, full-attention block with a specific residual/ReLU formulation and an explicit outer loop, not an off-the-shelf autoregressive decoder. |
| Softmax temperature | Near-discrete reads and writes rely on large score scales. The copy error decreases approximately like e^(log n−λ), so larger sequences or tighter tolerances demand larger numerical separation. |
| Approximation error | Nonlinear functions and matrix products are approximate. To keep total error below ε over T operations, the proof budgets about ε/T local error per operation. |
| Accuracy costs resources | Sigmoid-sum approximation improves with more heads; for broader activations or losses in the learning construction, the authors note that head count or dimension may need to grow polynomially, unless extra iterative computation is used. |
| Memory and program size still count | Sequence length grows with stored memory and instructions. Full attention would be quadratic in that length, although the authors note that their access pattern can be sparsified to O(nd) because only scratchpad columns need global attention. |
| Simplified SUBLEQ | The released implementation separates code and data and lacks convenient indirect addressing. Its README notes that list programs may grow linearly with list size even where self-modifying original SUBLEQ could keep code size constant. |
Technical claims in this report were checked against the final PMLR paper. Secondary indexes were used for bibliographic context and to locate the current code repository.
The paper’s linked OpenReview forum was behind browser verification during research, so this report does not attribute any claim to reviewer comments. Citation counts were deliberately omitted from the analysis because they change over time.
The paper’s enduring idea is not that Transformers are secretly efficient CPUs. It is that the mechanics of attention can be reverse-engineered into an explicit instruction interpreter, and that recurrence lets a shallow, weight-tied network express long, stateful algorithms. That gives a concrete bridge between abstract Turing-completeness results and executable constructions, while leaving open the harder empirical question of whether trained language models learn comparable machinery.