Skill · em Dados, IA e pesquisa

pyvene-interventions

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.

Procedência

Antes de instalar

4 arquivos · 33,4 KB · só texto, nenhum script

Instalar na sua CLI

O comando baixa a versão fixada (commit 57f899e) direto da origem, para a pasta que a CLI lê. Precisa de curl (macOS e Linux); no Windows não há comando, porque o Rook Labs é para macOS.

Claude Code

Neste projeto: instala em .claude/skills/pyvene-interventions/.

d=".claude/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Global: instala em ~/.claude/skills/pyvene-interventions/.

d="$HOME/.claude/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Codex

Neste projeto: instala em .agents/skills/pyvene-interventions/.

d=".agents/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Global: instala em ~/.agents/skills/pyvene-interventions/.

d="$HOME/.agents/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Antigravity

Neste projeto: instala em .agents/skills/pyvene-interventions/.

d=".agents/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Global: instala em ~/.gemini/antigravity-cli/skills/pyvene-interventions/.

d="$HOME/.gemini/antigravity-cli/skills/pyvene-interventions"
u="https://raw.githubusercontent.com/davila7/claude-code-templates/57f899e5394bb8ca166f38eacae8f0853cbfe033/cli-tool/components/skills/ai-research/mechanistic-interpretability-pyvene"
curl -fsSL --create-dirs \
  -o "$d/SKILL.md" "$u/SKILL.md" \
  -o "$d/references/api.md" "$u/references/api.md" \
  -o "$d/references/README.md" "$u/references/README.md" \
  -o "$d/references/tutorials.md" "$u/references/tutorials.md"

Peça ao Rook

Já usa o Rook Labs? Cole no chat do Rook: instale a skill https://rooklabs.sh/marketplace/cct.pyvene-interventions

Prévia do SKILL.md

---
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.
version: 1.0.0
author: Orchestra Research
license: MIT
tags: [Causal Intervention, pyvene, Activation Patching, Causal Tracing, Interpretability]
dependencies: [pyvene>=0.1.8, torch>=2.0.0, transformers>=4.30.0]
---

# 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:
…

Ver todo o marketplace