Tracr: Compiled Transformers as a Laboratory for Interpretability

David Lindner, J'anos Kram'ar, Matthew Rahtz, Tom McGrath, Vladimir Mikulik
2/12/2026

No official code found. Best implementation: google-deepmind/tracr (566 stars, Apache-2.0, last commit 2024-02-05).

Abstract

We show how to"compile"human-readable programs into standard decoder-only transformer models. Our compiler, Tracr, generates models with known structure. This structure can be used to design experiments. For example, we use it to study"superposition"in transformers that execute multi-step algorithms. Additionally, the known structure of Tracr-compiled models can serve as ground-truth for evaluating interpretability methods. Commonly, because the"programs"learned by transformers are unknown it is unclear whether an interpretation succeeded. We demonstrate our approach by implementing and examining programs including computing token frequencies, sorting, and parenthesis checking. We provide an open-source implementation of Tracr at https://github.com/deepmind/tracr.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
56649Python, Jupyter NotebookDec 1, 20222 years agoApache-2.0

Similar Papers

Cite this paper

@article{lindner2026tracr,
  title  = {Tracr: Compiled Transformers as a Laboratory for Interpretability},
  author = {David Lindner and J'anos Kram'ar and Matthew Rahtz and Tom McGrath and Vladimir Mikulik},
  year   = {2026},
  eprint = {2301.05062},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2301.05062},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2301.05062.svg)](https://codeofpaper.com/paper/2301.05062)

Discussion