← Latest papers
💬 NLP

Weights to Code: Extracting Interpretable Algorithms from the Discrete Transformer

This paper introduces the Discrete Transformer, a novel architecture that overcomes representation entanglement in standard Transformers by injecting discreteness through temperature-annealed sampling to enable the extraction of interpretable, human-readable algorithms from continuous models.

Original authors: Yifan Zhang, Wei Bi, Kechi Zhang, Dongming Jin, Jie Fu, Zhi Jin

Published 2026-03-20
📖 4 min read☕ Coffee break read

Original authors: Yifan Zhang, Wei Bi, Kechi Zhang, Dongming Jin, Jie Fu, Zhi Jin

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

Imagine you have a super-smart robot chef (a Transformer) that has learned to cook thousands of recipes by tasting millions of dishes. It knows how to make a perfect cake, but if you ask it, "How did you do that?" it can't explain itself. It just says, "I mixed ingredients in a big, messy bowl in my brain."

The problem is that the robot's brain is a kitchen blender. It mixes everything together so thoroughly that you can't tell where the flour ends and the sugar begins. This is called "entanglement." Because the ingredients are blended, you can't pull out a clean, written recipe (an algorithm) from its brain.

This paper introduces a new kind of robot chef called the Discrete Transformer. Instead of a blender, this chef uses a modular assembly line.

Here is how it works, broken down into simple steps:

1. The Specialized Assembly Line

The authors redesigned the robot's brain to have two distinct, separate teams:

  • The Delivery Team (Numerical Attention): Their only job is to move ingredients from one spot to another. They don't mix or cook; they just say, "Take the egg from the fridge and put it on the counter."
  • The Mixing Team (Numerical MLP): Their only job is to do the math. They take the ingredients the Delivery Team brought and mix them (add, subtract, multiply). They don't move things around.

By forcing the robot to keep these jobs separate, the "blender" effect is gone. You can clearly see who moved what and who mixed what.

2. The "Temperature" Training

To teach this robot, the authors use a clever trick called Temperature Annealing.

  • Hot Start: Imagine the robot is learning in a very hot room. It's chaotic and fuzzy. It tries many different ways to move and mix ingredients. It's exploring.
  • Cooling Down: Slowly, they lower the temperature. As it gets colder, the robot's choices become sharper and more definite. It stops guessing and starts making firm decisions.
  • Frozen State: By the end, the robot is "frozen" in a perfect, rigid state. Every movement and every mix is exact. Because the robot was forced to be so precise, its internal logic is now crystal clear.

3. Reverse-Engineering the Recipe

Once the robot is frozen, the authors act like detectives to write down the recipe:

  • For the Delivery Team: They look at where the robot moved ingredients. Did it always grab the item from "one step back"? That's a simple rule: Take previous item.
  • For the Mixing Team: They look at the math the robot did. Instead of seeing a messy neural network, they use a tool (Symbolic Regression) to find the simple math equation hidden inside, like A + B or A * 2.

4. The Result: A Human-Readable Book

Finally, they stitch these clues together. Instead of a messy neural network, they produce a clean, simple Python code file that looks like a normal computer program.

Why is this a big deal?

  • It works on continuous numbers: Previous methods could only handle simple "on/off" switches (like 0 or 1). This new method can handle real-world numbers like temperature, speed, or money (e.g., calculating how high a ball will fall).
  • It finds new solutions: Because the robot isn't just copying human code, it might find a clever, efficient way to solve a problem that no human ever thought of.
  • It's controllable: If you tell the robot, "Don't use the mixing team, just use the delivery team," it will figure out a completely different way to solve the problem using only movement. This proves we can steer the robot's thinking.

The Bottom Line

This paper solves the mystery of the "black box" Transformer. They built a version of the AI that thinks in steps rather than a blur. By cooling it down and separating its jobs, they can look inside its brain and pull out a clear, written instruction manual that humans can read, understand, and trust. It's like turning a magic trick into a step-by-step science experiment.

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 →