# Inside the Loop: A Mechanistic Study of Weight-Tied Transformers on Depth-Bound Algorithmic Tasks

*Magnus Sesodia, Philip Torr, Christian Schroeder de Witt*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/150577) · [OpenReview](https://openreview.net/forum?id=h8PkVhb8VI) · [Open on the map](../papers.html#p150577)

Category: [Interpretability & Model Adaptation](../pcat/15.md) › [Transformer Models](../pgroup/136.md) · Type: empirical study · Keywords: looped transformers, weight-tied models, algorithmic reasoning, mechanistic interpretability, synthetic permutation tasks

Areas: [LLM Reasoning](../areas/reasoning.md) › Reasoning Mechanisms › Looped Reasoning; [Model Architectures & Sequence Modeling](../areas/architectures.md) › Language Model Architectures › Algorithmic Transformers

## Summary
We demonstrate that weight-tied looped transformers act as iterative program learners, discovering a single per-iteration update rule that solves deep permutation-traversal tasks.

## Explained to a 5-year-old
Some computers have many layers that help them think step by step. A new kind of computer reuses a small part over and over to save memory. They tested it on a puzzle where you need to follow a hidden path of 15 steps. The new computer could finish all 15 steps, while a bigger computer could only do a few. By looking inside, they saw that each repeat did one step of the puzzle, like climbing stairs.

## Explained to a 5-year-old, longer
Computers that think can have many layers that help them solve problems. Usually, more layers mean more thinking power but also more memory usage. Researchers made a computer that uses the same small part many times to save memory. They called it a looped computer because it repeats the same piece over and over. They gave it a special puzzle where you need to follow a hidden order of 15 items. The puzzle is like walking along a path where each step points to the next. The looped computer was trained to guess the next step each time it repeated. After training, it could go through all 15 steps without forgetting. A normal computer with many layers could only manage about three steps. By looking at what the computer stored inside, scientists saw a clear pattern. Each time the computer repeated, it stored one step of the puzzle, like climbing a staircase. The pattern stayed for a couple of repeats before being overwritten, showing how it works.

## For a technical reader
The paper studies looped (weight-tied) transformers that reuse a single block across many iterations to achieve deep reasoning without adding parameters. On a synthetic directed permutation traversal task, a 3.2 M-parameter looped model solves all 15 hops, whereas a 25.8 M-parameter fixed-depth baseline fails beyond three hops, proving that weight tying, not sheer depth, drives capability. Internal analyses with linear probes and logit lenses reveal a clean staircase: each iteration corresponds to exactly one hop and remains decodable for a few steps before being overwritten. This shows that looped transformers learn a compact per-iteration update rule that acts as an iterative program interpreter.

## Problem
Algorithmic tasks that require many sequential steps often need deep transformers or long chain-of-thought reasoning, leading to high parameter and compute costs. It is unclear whether looped (weight-tied) architectures can achieve comparable depth efficiently and how they perform their computation.

## Method
We train looped transformers with weight tying on a directed permutation traversal task, sample hop lengths uniformly per batch, and analyze internal representations using linear probes and logit lenses to see how each iteration corresponds to a single algorithmic step.

## Results
The looped transformer solves all 15 hops while a deeper baseline solves at most three hops, showing weight tying drives performance; linear probes reveal a staircase where each iteration corresponds to one hop and remains decodable for about two iterations, and the logit lens reproduces this ordering.

## Contributions
We provide a mechanistic analysis showing that weight-tied looped transformers learn a single per-iteration update rule that implements algorithmic steps, uncover the internal staircase representation, and demonstrate their superior depth capability compared to fixed-depth models.

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](../feedback/?on=p/150577)
