transformer-lens-interpretability
Agent skill fromOrchestra-Research/AI-Research-SKILLs
Provides guidance for mechanistic interpretability research using TransformerLens to inspect and manipulate transformer internals via HookPoints and activation caching. Use when reverse-engineering model algorithms, studying attention patterns, or performing activation patching experiments.
How to install transformer-lens-interpretability
install transformer-lens-interpretability
# install the AI-Research-SKILLs pack with the skills CLI
npx skills add Orchestra-Research/AI-Research-SKILLs# or add only this skill to Claude Code: copy the folder
04-mechanistic-interpretability/transformer-lens/
# into
~/.claude/skills/transformer-lens/ (all projects)
.claude/skills/transformer-lens/ (one project)
1# TransformerLens: Mechanistic Interpretability for Transformers23TransformerLens is the de facto standard library for mechanistic interpretability research on GPT-style language models. Created by Neel Nanda and maintained by Bryce Meyer, it provides clean interfaces to inspect and manipulate model internals via HookPoints on every activation.45**GitHub**: [TransformerLensOrg/TransformerLens](https://github.com/TransformerLensOrg/TransformerLens) (2,900+ stars)67## When to Use TransformerLens89**Use TransformerLens when you need to:**10- Reverse-engineer algorithms learned during training11- Perform activation patching / causal tracing experiments12- Study attention patterns and information flow13- Analyze circuits (e.g., induction heads, IOI circuit)14- Cache and inspect intermediate activations15- Apply direct logit attribution1617**Consider alternatives when:**18- You need to work with non-transformer architectures → Use **nnsight** or **pyvene**19- You want to train/analyze Sparse Autoencoders → Use **SAELens**20- You need remote execution on massive models → Use **nnsight** with NDIF21- You want higher-level causal intervention abstractions → Use **pyvene**2223## Installation2425```bash26pip install transformer-lens27```2829For development version:30```bash31pip install git+https://github.com/TransformerLensOrg/TransformerLens32```3334## Core Concepts3536### HookedTransformer3738The main class that wraps transformer models with HookPoints on every activation:3940```python41…
Excerpt shown under the repository's MIT license.
