Lune

NeurIPS2023Top-tier venue

Tracr: Compiled Transformers as a Laboratory for Interpretability

David Lindner, János Kramár, Sebastian Farquhar, Matthew Rahtz, Tom McGrath, Vladimir Mikulik

Abstract

We show how to "compile" human-readable programs into standard decoderonly 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/google-deepmind/tracr .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

37 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Finding Transformer Circuits With Edge Pruning cites Towards Automated Circuit Discovery for Mechanistic Interpretability
  • Finding Transformer Circuits With Edge Pruning cites Thinking Like Transformers
  • Finding Transformer Circuits With Edge Pruning cites Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Tracking
  • Towards Automated Circuit Discovery for Mechanistic Interpretability cites Locating and Editing Factual Associations in GPT
  • The Impact of Positional Encoding on Length Generalization in Transformers cites Thinking Like Transformers
  • Looped Transformers as Programmable Computers cites Thinking Like Transformers
  • Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning? cites Looped Transformers as Programmable Computers
  • Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Tracking cites Towards Automated Circuit Discovery for Mechanistic Interpretability
  • Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Tracking cites Locating and Editing Factual Associations in GPT
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers37

  1. Towards Automated Circuit Discovery for Mechanistic InterpretabilityArthur Conmy, Augustine N. Mavor-Parker, Aengus Lynch, Stefan Heimersheim et al.NeurIPS 2023 · 861 citations
  2. The Impact of Positional Encoding on Length Generalization in TransformersAmirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das et al.NeurIPS 2023 · 444 citations
  3. Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity TrackingNikhil Prakash, Tamar Rott Shaham, Tal Haklay, Yonatan Belinkov et al.ICLR 2024 · 113 citations
  4. Finding Transformer Circuits With Edge PruningAdithya Bhaskar, Alexander Wettig, Dan Friedman, Danqi ChenNeurIPS 2024 · 72 citations
  5. Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?Khashayar Gatmiry, Nikunj Saunshi, Sashank J. Reddi, Stefanie Jegelka et al.ICML 2024 · 43 citations

Builds on11

  1. Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 citations
  2. Towards Automated Circuit Discovery for Mechanistic InterpretabilityArthur Conmy, Augustine N. Mavor-Parker, Aengus Lynch, Stefan Heimersheim et al.NeurIPS 2023 · 861 citations
  3. Debugging Tests for Model ExplanationsJulius Adebayo, Michael Muelly, Ilaria Liccardi, Been KimNeurIPS 2020 · 209 citations
  4. Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 citations
  5. Looped Transformers as Programmable ComputersAngeliki Giannou, Shashank Rajput, Jy-yong Sohn, Kangwook Lee et al.ICML 2023 · 175 citations

Related papers

  1. Learning Transformer ProgramsDan Friedman, Alexander Wettig, Danqi ChenNeurIPS 2023 · 59 citations
  2. Tracr-Injection: Distilling Algorithms into Pre-trained Language ModelsTomás Vergara Browne, Alvaro SotoACL Findings 2025
  3. Discovering Interpretable Algorithms by Decompiling Transformers to RASPXinting Huang, Aleksandra Bakalova, Satwik Bhattamishra, William Merrill et al.ICML 2026 · 3 citations
  4. Algorithmic Capabilities of Random TransformersZiqian Zhong, Jacob AndreasNeurIPS 2024 · 23 citations
  5. Weights to Code: Extracting Interpretable Algorithms from the Discrete TransformerYifan Zhang, Wei Bi, Kechi Zhang, Dongming Jin et al.ICML 2026 · 2 citations
Dusk over the sea between two cliffs drawn in fine vertical lines