Tooluck logoTooluck
SKILL.md

pyvene-interventions

Agent skill fromOrchestra-Research/AI-Research-SKILLs

Provides guidance for performing causal interventions on PyTorch models using pyvene's declarative intervention framework. Use when conducting causal tracing, activation patching, interchange intervention training, or testing causal hypotheses about model behavior.

How to install pyvene-interventions

install pyvene-interventions
# 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/pyvene/

# into

~/.claude/skills/pyvene/ (all projects)

.claude/skills/pyvene/ (one project)

04-mechanistic-interpretability/pyvene/SKILL.md

MITFull file
1# pyvene: Causal Interventions for Neural Networks
2
3pyvene is Stanford NLP's library for performing causal interventions on PyTorch models. It provides a declarative, dict-based framework for activation patching, causal tracing, and interchange intervention training - making intervention experiments reproducible and shareable.
4
5**GitHub**: [stanfordnlp/pyvene](https://github.com/stanfordnlp/pyvene) (840+ stars)
6**Paper**: [pyvene: A Library for Understanding and Improving PyTorch Models via Interventions](https://aclanthology.org/2024.naacl-demo.16) (NAACL 2024)
7
8## When to Use pyvene
9
10**Use pyvene when you need to:**
11- Perform causal tracing (ROME-style localization)
12- Run activation patching experiments
13- Conduct interchange intervention training (IIT)
14- Test causal hypotheses about model components
15- Share/reproduce intervention experiments via HuggingFace
16- Work with any PyTorch architecture (not just transformers)
17
18**Consider alternatives when:**
19- You need exploratory activation analysis → Use **TransformerLens**
20- You want to train/analyze SAEs → Use **SAELens**
21- You need remote execution on massive models → Use **nnsight**
22- You want lower-level control → Use **nnsight**
23
24## Installation
25
26```bash
27pip install pyvene
28```
29
30Standard import:
31```python
32import pyvene as pv
33```
34
35## Core Concepts
36
37### IntervenableModel
38
39The main class that wraps any PyTorch model with intervention capabilities:
40
41```python
42import pyvene as pv
43…

Excerpt shown under the repository's MIT license.

More skills in AI-Research-SKILLs

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates