Open Interpretability Models Contributors Research Posts About

Tracr: Compiled Transformers as a Laboratory for Interpretability

Source

Citation. David Lindner, János Kramár, Sebastian Farquhar, Matthew Rahtz, Thomas McGrath and Vladimir Mikulik, all of Google DeepMind. "Tracr: Compiled Transformers as a Laboratory for Interpretability". arXiv 2301.05062 [cs.LG]. Versions: v1 12 January 2023, v2 21 February 2023, v3 22 February 2023, v4 7 June 2023, v5 3 November 2023. We read v5. Paper. Code. The v5 PDF says "37th Conference on Neural Information Processing Systems (NeurIPS 2023)". Issue #4843 also says the paper was a spotlight, and the PDF does not say this, so we did not check it. The paper releases no dataset, because its models are compiled from programs. It has no funding statement. The acknowledgements thank a LessWrong user for a mistake that they found in an earlier draft of Appendix F.

Status. Planned. #3584 (ground-truth calibration on Tracr and InterpBench models) names Tracr as a candidate and is open. The paper's own text supports that issue's reasons to start with InterpBench and not Tracr. It also gives #4782 a case where training keeps the behaviour but changes the encoding.

Read. We read the arXiv v5 PDF on 2026-11-19, as text that pdftotext took from it. We also read the arXiv abstract page for the version history. We have the source's own text for the abstract, §1 to §7, the references and Appendices A to G. We did not see the figures as images. The plots of Figures 7 and 8 came through only as axis labels. So the only numbers from them here are numbers that the text states. The residual-stream heatmaps of Figures 2, 5 and 9 to 11 came through only as their row labels. We did not read the code. A model (Claude Opus 5.5) did the reading.

Summary

Claim. Tracr compiles programs in RASP, a language for transformer computations, into the weights of standard decoder-only transformers. So the authors know the model's mechanism before anyone studies it. The authors propose such models as ground truth to test interpretability methods, and as a setting to study superposition.

Method.

Findings, as the source reports them.

Setting Result
Expressivity (§3, §4) The authors compiled programs for all the tasks of Weiss et al. (2021), after they changed some programs to use only features that Tracr supports
frac_prevs, compiled (§4.1) A 14-dimensional residual stream, of which 12 dimensions hold the input embeddings. One MLP layer and one attention head do the work, in a four-layer model with two layers that do nothing
frac_prevs, compressed (§5.2) D = 14 reduces to d = 6 "without hurting performance". Below that, performance falls
frac_prevs, W at d = 8 (§5.2, Figure 7) tokens:x, is_x and frac_prevs mostly have dimensions of their own. The compressed model drops tokens:a, tokens:b and tokens:c. The indices embeddings share dimensions that are not orthogonal. is_x and tokens:x share part of their space. PCA keeps features that the task does not need, such as tokens:a
sort_unique, compressed (§5.3, Figure 8) Accuracy is "almost perfect", but the mean layer cosine "stays around 0.8". The authors trace the gap to target_pos, which the compressed model seems to encode as a number and not as a one-hot vector
Loss weights (§5.1) Both loss terms have equal weight. The authors say other weights give similar results, and show none
Selectors (Appendix F, Lemma F.1) With the encodings of Appendix D, an or of two selectors with separate inputs has a limit. It works only if one predicate is constant, or both are rank 1
Later use (§6) Conmy et al. (2023) used Tracr to test a method that finds circuits automatically. Friedman et al. (2023) learned transformer programs

The authors state the limits themselves (§7, Appendix A.2):

Where the claims go beyond the evidence

Use in this repo