Guides causal experiments on PyTorch models with pyvene, such as causal tracing, activation patching and interchange intervention training, to test how a model works.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .claude/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Type this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a codex
Project install goes to .agents/skills/; add -g for ~/.codex/skills/.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .agents/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a cursor
Project install goes to .agents/skills/; add -g for ~/.cursor/skills/.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .cursor/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a gemini-cli
Project install goes to .agents/skills/; add -g for ~/.gemini/skills/.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .gemini/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Installs for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a github-copilot
Project install goes to .agents/skills/; add -g for ~/.copilot/skills/.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .github/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a opencode
OpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
Install the "pyvene-interventions" agent skill from https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/04-mechanistic-interpretability/pyvene into .opencode/skills/pyvene-interventions/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pyvene-interventions", then confirm the skill loads.
OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Facts
Skill name
pyvene-interventions
GitHub stars
13k
Used in
2 other repos
Token cost
~3.5k tokens
SKILL.md length
482 words
Files
4 (incl. references)
Skills in repo
96
Repo updated
First seen
Licence
MIT
At a glance
Guides causal experiments on PyTorch models with pyvene, such as causal tracing, activation patching and interchange intervention training, to test how a model works.
Locating where a language model stores a fact with causal tracing
SKILL.md covers When to Use pyvene, Installation, Core Concepts and Workflow 1: Causal Tracing…, plus 10 more sections
Calls pip
Running activation patching between a clean and a corrupted prompt
What it does
pyvene is a Stanford NLP library that describes interventions on a neural network as a dictionary-style configuration, so experiments can be repeated and shared. The skill explains its central IntervenableModel class, which wraps any PyTorch model, and tabulates the intervention types: vanilla swapping, addition, subtraction, zeroing, a rotated-space type for distributed alignment search, and a collect type for gathering activations.
It lists which model components can be targeted, such as the input to a transformer block, and begins a step-by-step causal tracing workflow that corrupts inputs and then restores activations to find where factual associations are stored. Other use cases include activation patching and interchange intervention training. It notes that experiments can be shared through Hugging Face and that models need not be transformers. TransformerLens, SAELens and nnsight are suggested for exploratory analysis, sparse autoencoders and remote runs.
When your agent uses it
Locating where a language model stores a fact with causal tracing
Running activation patching between a clean and a corrupted prompt
Training with interchange interventions to test a causal hypothesis
Packaging an intervention experiment so others can reproduce it
Example prompts
“Use pyvene to run causal tracing on GPT-2 for the prompt The Eiffel Tower is in.”
“Write an activation patching experiment that swaps the residual stream at layer 6 between two prompts.”
“Set up an IntervenableModel that zeroes out one attention head and compare the outputs.”
“Explain which pyvene intervention type I should use for steering versus ablation.”
Requirements
Python with the `pyvene` package
A PyTorch model to intervene on
What it can do on your machine
Read from SKILL.md and the folder at commit 773a529. It shows what the files ask for, not the result of running them.
Tool permissions
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Runs code
Shell commands in SKILL.md call:
pip
From the folder's file list and the shell code blocks in SKILL.md.
Network
Links to these hosts (documentation or services it may open):
stanfordnlp.github.io
arxiv.org
github.com
aclanthology.org
From URLs in SKILL.md, links to its own repository left out.
Credentials
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Context cost
pyvene Causal Interventions loads about 3.5k tokens when it runs, and up to ~8.6k if it reads all its reference files. Until then it costs about 72 tokens; SKILL.md has 482 words of instructions outside code blocks.
Always· name and description, kept in context so the agent knows when to use it
~72
When it runs· the whole SKILL.md, loaded when a task matches
~3.5k
With references· SKILL.md plus every file in references/, read only if the agent opens them
~8.6k
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
Safety
Auto-check passed
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
Download SKILL.mdSave it as .claude/skills/pyvene-interventions/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
pyvene-interventions
description
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.
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.
import pyvene as pv
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf")
# Load pre-trained steering intervention
intervenable = pv.IntervenableModel.load(
"zhengxuanzenwu/intervenable_honest_llama2_chat_7B",
model=model,
)
# Generate with steering
prompt = "Is the earth flat?"
inputs = tokenizer(prompt, return_tensors="pt")
# Intervention applied during generation
outputs = intervenable.generate(
inputs,
max_new_tokens=100,
do_sample=False,
)
print(tokenizer.decode(outputs[0]))
Saving and Sharing Interventions
python
# Save locally
intervenable.save("./my_intervention")
# Load from local
intervenable = pv.IntervenableModel.load(
"./my_intervention",
model=model,
)
# Share on HuggingFace
intervenable.save_intervention("username/my-intervention")
# Load from HuggingFace
intervenable = pv.IntervenableModel.load(
"username/my-intervention",
model=model,
)
Show full SKILL.md (193 more words)Show less
Common Issues & Solutions
Issue: Wrong intervention location
python
# WRONG: Incorrect component name
config = pv.RepresentationConfig(
component="mlp", # Not valid!
)
# RIGHT: Use exact component name
config = pv.RepresentationConfig(
component="mlp_output", # Valid
)
Issue: Dimension mismatch
python
# Ensure source and base have compatible shapes
# For position-specific interventions:
config = pv.RepresentationConfig(
unit="pos",
max_number_of_units=1, # Intervene on single position
)
# Specify locations explicitly
intervenable(
base=base_tokens,
sources=[source_tokens],
unit_locations={"sources->base": ([[[5]]], [[[5]]])}, # Position 5
)
Issue: Memory with large models
python
# Use gradient checkpointing
model.gradient_checkpointing_enable()
# Or intervene on fewer components
config = pv.IntervenableConfig(
representations=[
pv.RepresentationConfig(
layer=8, # Single layer instead of all
component="block_output",
)
]
)
We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in Orchestra-Research/AI-Research-SKILLs, which our catalogue first saw on October 7, 2026.
pyvene Causal Interventions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
pyvene Causal Interventions compared with similar skills
Skill
Stars
Used in
Tokens
Auto-check
Licence
Repo updated
pyvene Causal Interventions this skillOrchestra-Research/AI-Research-SKILLs
Run AlphaGenome-PyTorch to get genomic track predictions — via the agt predict CLI (single locus, BED regions, whole chromosomes, raw FASTA sequences, or per-gene count tables/AnnData), variant…
Guides technology selection and implementation of AI and ML features in .NET 8+ applications using ML.NET, Microsoft.Extensions.AI (MEAI), Microsoft Agent Framework (MAF), GitHub Copilot SDK, ONNX…
A skill your agent uses when creating, migrating, or debugging pixi environments, especially for scientific Python, bioinformatics, single-cell analysis, CUDA/PyTorch, Jupyter/VS Code kernels…
Generates music from text descriptions with MusicGen and sound effects with AudioGen, using Meta's AudioCraft PyTorch library with melody and style conditioning.
Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.
Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.
Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.
Transcribes audio with OpenAI's Whisper: 99 languages, translation to English, language detection, six model sizes and word-level timestamps, from Python or the CLI.
Guides causal experiments on PyTorch models with pyvene, such as causal tracing, activation patching and interchange intervention training, to test how a model works. pyvene is a Stanford NLP library that describes interventions on a neural network as a dictionary-style configuration, so experiments can be repeated and shared. The skill explains its central IntervenableModel class, which wraps any PyTorch model, and tabulates the intervention types: vanilla swapping, addition, subtraction, zeroing, a rotated-space type for distributed alignment search, and a collect type for gathering activations.
When should I use pyvene Causal Interventions?
pyvene Causal Interventions fits situations like: locating where a language model stores a fact with causal tracing; running activation patching between a clean and a corrupted prompt; training with interchange interventions to test a causal hypothesis; packaging an intervention experiment so others can reproduce it.
How do I install pyvene Causal Interventions in Claude Code?
Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a claude-code`. Or copy the skill folder (04-mechanistic-interpretability/pyvene in Orchestra-Research/AI-Research-SKILLs) into .claude/skills/pyvene-interventions in your project. Claude Code loads it when a task matches its description.
How do I install pyvene Causal Interventions in Codex?
Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a codex`. Or copy the skill folder (04-mechanistic-interpretability/pyvene in Orchestra-Research/AI-Research-SKILLs) into .agents/skills/pyvene-interventions in your project. Codex loads it when a task matches its description.
Can I use pyvene Causal Interventions in Cursor, Gemini CLI or GitHub Copilot?
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill pyvene-interventions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pyvene-interventions, .gemini/skills/pyvene-interventions, .github/skills/pyvene-interventions and .opencode/skills/pyvene-interventions in your project.
What does pyvene Causal Interventions need to run?
Going by SKILL.md and its folder, pyvene Causal Interventions needs the command-line tools its instructions call (pip). Our summary lists: Python with the `pyvene` package; A PyTorch model to intervene on.
Does pyvene Causal Interventions access the network?
SKILL.md names 4 domains. As links in the text: stanfordnlp.github.io, arxiv.org, github.com and aclanthology.org. This is read from the text; nothing was executed.
Is pyvene Causal Interventions safe to install?
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
What licence does pyvene Causal Interventions use?
pyvene Causal Interventions is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
How many tokens does pyvene Causal Interventions use?
About 3.5k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5k tokens, read only when the agent opens those files.
What are the alternatives to pyvene Causal Interventions?
Skills that share tags, products or a category with pyvene Causal Interventions: Alphagenome Predictions (genomicsxai/alphagenome-pytorch, 162 stars), ExecuTorch Model Export (pytorch/executorch, 5.1k stars), Uv Pypi Publish (ML4ITS/TimeVQVAE, 166 stars) and Pennylane (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Who maintains pyvene Causal Interventions?
Orchestra-Research (a GitHub organization) maintains it in Orchestra-Research/AI-Research-SKILLs, which has 13,374 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on June 16, 2026.