Penzai + Treescope: A Toolkit for Interpreting, Visualizing, and Editing Models As Data
Not on the map. Why?
Abstract (arXiv)
Much of today's machine learning research involves interpreting, modifying or visualizing models after they are trained. I present Penzai, a neural network library designed to simplify model manipulation by representing models as simple data structures, and Treescope, an interactive pretty-printer and array visualizer that can visualize both model inputs/outputs and the models themselves. Penzai models are built using declarative combinators that expose the model forward pass in the structure of the model object itself, and use named axes to ensure each operation is semantically meaningful. With Penzai's tree-editing selector system, users can both insert and replace model components, allowing them to intervene on intermediate values or make other edits to the model structure. Users can then get immediate feedback by visualizing the modified model with Treescope. I describe the motivation and main features of Penzai and Treescope, and discuss how treating the model as data enables a variety of analyses and interventions to be implemented as data-structure transformations, without requiring model designers to add explicit hooks.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 16 of its 25 references that are in the map. First posted on arXiv 1 Aug 2024.
Builds on
16 of 25 references.
References · 16
- 2017Attention Is All You Needcited by 59,932
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2016Layer Normalizationcited by 5,579
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2023Mistral 7Bcited by 3,065
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2020GLU Variants Improve Transformercited by 1,724
- 2019Root Mean Square Layer Normalizationcited by 1,425
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2023Towards Best Practices of Activation Patching in Language Models: Metrics and Methodscited by 328
- 2021Equinox: neural networks in JAX via callable PyTrees and filtered transformationscited by 143
4 more
- 2020The Language Interpretability Tool: Extensible, Interactive Visualizations and Analysis for NLP Modelscited by 125
- 2024pyvene: A Library for Understanding and Improving PyTorch Models via Interventionscited by 53
- 2021Local Interpretations for Explainable Natural Language Processing: A Surveycited by 31
- 2021Named Tensor Notationcited by 11
Built on by
Citing papers per year: 2024: 1; 2025: 3; 2026: 1.
5 papers.
- 2024Softmax is not Enough (for Sharp Size Generalisation)cited by 42
- 2025Incorporating Hierarchical Semantics in Sparse Autoencoder Architecturescited by 12
- 2025Scaling sparse feature circuit finding for in-context learningcited by 5
- 2025Jasmine: A Simple, Performant and Scalable JAX-based World Modeling Codebasecited by 1
- 2026It's All Just Vectorization: einx, a Universal Notation for Tensor Operationscited by 0
- 2026It's All Just Vectorization: einx, a Universal Notation for Tensor Operations30 Jul 2026
- 2025Jasmine: A Simple, Performant and Scalable JAX-based World Modeling Codebase30 Oct 2025
- 2025Incorporating Hierarchical Semantics in Sparse Autoencoder Architectures1 Jun 2025
- 2025Scaling sparse feature circuit finding for in-context learning18 Apr 2025
- 2024Softmax is not Enough (for Sharp Size Generalisation)1 Oct 2024