pyvene-interventions

Featured

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.

AI & Automation 27,984 stars 2901 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# pyvene: Causal Interventions for Neural Networks pyvene 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. **GitHub**: [stanfordnlp/pyvene](https://github.com/stanfordnlp/pyvene) (840+ stars) **Paper**: [pyvene: A Library for Understanding and Improving PyTorch Models via Interventions](https://aclanthology.org/2024.naacl-demo.16) (NAACL 2024) ## When to Use pyvene **Use pyvene when you need to:** - Perform causal tracing (ROME-style localization) - Run activation patching experiments - Conduct interchange intervention training (IIT) - Test causal hypotheses about model components - Share/reproduce intervention experiments via HuggingFace - Work with any PyTorch architecture (not just transformers) **Consider alternatives when:** - You need exploratory activation analysis → Use **TransformerLens** - You want to train/analyze SAEs → Use **SAELens** - You need remote execution on massive models → Use **nnsight** - You want lower-level control → Use **nnsight** ## Installation ```bash pip install pyvene ``` Standard import: ```python import pyvene as pv ``` ## Core Concepts ### IntervenableModel The main class that wraps any PyTorch model with intervention capabilities: ```python import pyvene as pv from transformers import AutoModelForCausalLM, Auto...

Details

Author
davila7
Repository
davila7/claude-code-templates
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category