SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.01128 · NeurIPS · 2023

Learning Transformer Programs

Danqi Chen, Alexander Wettig, Dan Friedman

arXiv · PDF · Open in the Atlas

Code that ran

16 of 21 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (12 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 13 have no contract verdict; 3 failures of our instrument; 5 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.01128.json · badge: /api/ran/2306.01128.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
princeton-nlp/transformerprograms marked official in Papers with Code
Papers with Code archive
16 ran · 5 no recorded run
FunctionStatusWhere it lives
CatEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("d12fd83022101c89")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

CatMLP Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("70bbbfdf15549456")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ClippedRelPosBias Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("758c7718eab6c7c7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ConstrainedRead Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("15949249daac5067")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

FixedRelPosBias Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("5c3fbd7d9586f37e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

NoRelPosBias Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("c46a4f9300b88dc6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

NumAttention Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("f02809a6319619b0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

NumEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("5b3e2fc48121bc32")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

OneHotPosEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("96c1455fd1928061")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ScoreAttention Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("3af625298c24b59b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Unembed Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("f6f581a88d741f08")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

WPred Ran
ran on a synthesized input · constructed an object; no result was computed
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("2792e151572ee1ec")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

WScore Ran
ran on a synthesized input
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("db92ccece8dc55e0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

softmax Ran
ran; our contract draft was wrong, not the code
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("e3599c195e20c0fc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

softmax_no_temp Ran
ran; our contract draft was wrong, not the code
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("e35b60a92f2a52b5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

subsoftmax Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("1316961252e8ad54")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

CatAttention Not yet run
unverified (harvested, no recorded run)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("becdbd159c1bead4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

CatMLPs Not yet run
unverified (harvested, no recorded run)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("82fcb68539de38cb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

HookPoint Not yet run
unverified (harvested, no recorded run)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("ee5e8b570159bbdd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

TransformerProgramBlock Not yet run
unverified (harvested, no recorded run)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("4a864ddf34dc9452")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

TransformerProgramModel Not yet run
unverified (harvested, no recorded run)
princeton-nlp/transformerprograms/src/models/programs.py
pointer only (licence: NONE) · get_code("d39196027884c33b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, princeton-nlp/transformerprograms when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 21 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recent research in mechanistic interpretability has attempted to reverse-engineer Transformer models by carefully inspecting network weights and activations. However, these approaches require considerable manual effort and still fall short of providing complete, faithful descriptions of the underlying algorithms. In this work, we introduce a procedure for training Transformers that are mechanistically interpretable by design. We build on RASP [Weiss et al., 2021], a programming language that can be compiled into Transformer weights. Instead of compiling human-written programs into Transformers, we design a modified Transformer that can be trained using gradient-based optimization and then automatically converted into a discrete, human-readable program. We refer to these models as Transformer Programs. To validate our approach, we learn Transformer Programs for a variety of problems, including an in-context learning task, a suite of algorithmic problems (e.g. sorting, recognizing Dyck-languages), and NLP tasks including named entity recognition and text classification. The Transformer Programs can automatically find reasonable solutions, performing on par with standard Transformers of comparable size; and, more importantly, they are easy to interpret. To demonstrate these advantages, we convert Transformers into Python programs and use off-the-shelf code analysis tools to debug model errors and identify the "circuits" used to solve different sub-problems. We hope that Transformer Programs open a new path toward the goal of intrinsically interpretable machine learning. 1

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.01128")
get_code_for_paper("2306.01128")
have("2306.01128")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.01128.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.01128.svg)](https://syntology.ai/paper/2306.01128)

Connect an agent — have() is free.