A Python library for mechanistic interpretability of GPT-style language models that makes it easy to cache, inspect and edit internal activations.

This is an external publication hosted at github.com. AI Governance LK did not write it; the summary and notes on this page are our own.

Getting started

Start with the library’s own getting-started material, then try reproducing one figure from A Mathematical Framework for Transformer Circuits. The project’s documentation lists current installation steps and supported models.

What you will learn

  • Load a model and cache its activations
  • Run a simple activation-patching experiment

Before you start

Suggested background. This is editorial guidance, not a requirement.

  • Python and PyTorch

How to cite

Nanda, N., & Bloom, J. (2022). TransformerLens. GitHub repository.