← Latest papers
🤖 machine learning

Efficiently Representing Algorithms With Chain-of-Thought Transformers

This paper demonstrates that Chain-of-Thought transformers can efficiently simulate Word RAM algorithms with only poly-logarithmic overhead, significantly outperforming the quadratic overhead required for Turing machine simulations.

Original authors: Yanhong Li, Anej Svete, Ashish Sabharwal, William Merrill

Published 2026-06-19
📖 6 min read🧠 Deep dive

Original authors: Yanhong Li, Anej Svete, Ashish Sabharwal, William Merrill

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Core Problem: The "Tape" vs. The "Desk"

Imagine you are trying to solve a complex math problem.

The Old Way (Turing Machines):
Think of a Turing Machine like a student who has only a single, infinitely long strip of paper (a tape). To look at a number they wrote down three pages ago, they have to physically walk back along the paper, step by step, until they find it. If they want to sort a list of 1,000 names, they have to walk back and forth across that tape thousands of times. It works, but it is incredibly slow and tedious. This is how most previous computer science theories proved that AI could "think."

The Real Way (Word RAM):
Now, imagine a student with a large desk and a filing cabinet. This is the Word RAM model. They can grab any file from the cabinet instantly (random access). They can do math on whole numbers at once, not bit-by-bit. This is how real algorithms (like sorting lists or finding the shortest path on a map) are actually written in textbooks. It is much faster.

The Question:
We know that AI models with "Chain-of-Thought" (CoT)—where the AI writes out its reasoning steps before giving an answer—can simulate the slow "Tape" student. But can they simulate the fast "Desk" student efficiently? Or does the AI get bogged down in the slowness of the tape method, making it useless for real-world tasks?

The Paper’s Answer: Yes, But It Needs the Right Tools

The authors prove that yes, Chain-of-Thought Transformers can simulate these fast, real-world algorithms efficiently. They don’t get stuck in the slow "tape" bottleneck. However, to do this, the AI needs to use specific "tricks" or architectural tweaks.

They show this works in three different scenarios, which we can think of as three different types of "thinking pads" the AI uses:

1. The "Wide Notebook" (Polylog-Width Transformers)

  • The Analogy: Imagine the AI has a notebook that gets wider as the problem gets harder. If the problem is huge, the notebook is very wide.
  • How it works: The AI writes down the entire state of its memory in binary code (0s and 1s) across the width of the page. Because the page is wide enough, it can look up information quickly.
  • The Cost: It’s efficient, but the notebook size changes depending on the problem. It’s not a "one-size-fits-all" tool.

2. The "Ghostly Scratchpad" (Continuous CoT)

  • The Analogy: Imagine the AI has a standard-sized notebook, but it can also write in "invisible ink" that only it can see. This invisible ink isn't just text; it’s a mathematical vector (a direction and magnitude).
  • How it works: Instead of writing out every single bit of a number, the AI writes a compact "summary" (a hash) in this invisible ink. It can pass this summary from one step to the next without rewriting the whole number. When it needs to do detailed math, it "decodes" the invisible ink into bits, does the work, and then re-encodes it.
  • The Benefit: This allows the AI to keep its "desk" organized and fast, even with a fixed-size notebook.

3. The "Memory Helper" (Hybrid Transformer-RNN)

  • The Analogy: Imagine the AI has a standard notebook, but it also has a very short-term memory assistant (a Recurrent Neural Network, or RNN) standing next to it.
  • How it works: The AI writes the main steps in the notebook, but the assistant holds the current "state" of the calculation in its head. The assistant can quickly update the numbers (like dividing by 2 or adding a bit) and hand the result back to the AI.
  • The Benefit: This combines the best of both worlds: the Transformer’s ability to look back at the whole history, and the RNN’s ability to carry information forward smoothly.

Why This Matters (The "Overhead")

In computer science, "overhead" is the extra time or effort needed to do a task.

  • The Old Method: If you forced a Chain-of-Thought AI to use the old "Tape" method to sort a list, the overhead was quadratic. If sorting 10 items took 100 steps, sorting 100 items might take 10,000 steps. It grows too fast.
  • The New Method: This paper shows that with the right setup (the three methods above), the overhead is only poly-logarithmic. This is a fancy way of saying it grows very slowly. If sorting 10 items takes 100 steps, sorting 100 items might only take a few hundred steps. It stays close to the speed of the original algorithm.

The "Bit Extraction" Challenge

A major hurdle the authors solved was bit extraction.

  • The Problem: To do math, the AI needs to look at individual bits (0s and 1s). But in the efficient models (like the Ghostly Scratchpad), the numbers are stored as compact summaries, not as lists of bits.
  • The Solution: The authors proved that the AI can "peel off" bits one by one from these summaries. It’s like having a sealed envelope (the summary) and being able to pull out one letter (bit) at a time, read it, and then update the envelope for the next letter, without opening the whole thing at once.

Summary

This paper is a theoretical proof that AI reasoning (Chain-of-Thought) is not just a gimmick; it can be as efficient as the algorithms humans write.

  • Before: We knew AI could simulate computers, but only in a slow, clunky way (like the tape student).
  • Now: We know AI can simulate computers in a fast, efficient way (like the desk student), provided we give it the right tools (wide notebooks, invisible ink, or memory assistants).

This bridges the gap between theory (what computers can do) and practice (how we actually write code), showing that the "thinking" process of modern AI models is fundamentally capable of handling complex, real-world logic efficiently.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →