pyvene-interventions

Solid

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 9,609 stars 724 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
100
Recency 20%
75
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
Orchestra-Research
Repository
Orchestra-Research/AI-Research-SKILLs
Created
7 months ago
Last Updated
1 months ago
Language
TeX
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category