pyvene-interventions

Configure pyvene interventions for causal tracing on PyTorch models.

Updated May 2, 2026
One-click install
npx skills add https://github.com/qcmuu/AI-Research-Skills --skill pyvene-interventions-qcmuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pyvene-interventions
Source: https://github.com/qcmuu/AI-Research-Skills/tree/main/04-mechanistic-interpretability/pyvene
Command: npx skills add https://github.com/qcmuu/AI-Research-Skills --skill pyvene-interventions-qcmuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyvene>=0.1.8, torch>=2.0.0, transformers>=4.30.0, and includes references (resource) components.

What problem does it solve?

This Skill helps you run reliable causal intervention experiments on PyTorch models to test whether specific internal activations drive a model’s behavior.

Core Features & Use Cases

  • Declarative intervention configuration: Specify target layers/components and intervention types via IntervenableConfig and RepresentationConfig.
  • Causal tracing & activation patching: Restore clean activations into corrupted runs to localize causal components.
  • Interchange intervention training (IIT) and DAS: Train trainable low-rank rotated interventions to discover causal subspaces and steer behavior.
  • Model steering and sharing: Apply interventions during generation and save/load interventions for reproducibility.

Quick Start

Ask your AI agent to set up an IntervenableModel for your HuggingFace PyTorch model and run a VanillaIntervention sweep over layers to perform causal tracing (activation patching) that compares corrupted vs clean prompts.

Frequently Asked Questions about pyvene-interventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform causal activation patching on a PyTorch model?

Causal activation patching restores clean activations into corrupted model runs to localize causal components. You configure IntervenableConfig and RepresentationConfig to specify target layers and intervention types for testing whether specific internal activations drive model behavior.

What is causal tracing and how does it test interpretability hypotheses?

Causal tracing is an interpretability technique that compares corrupted versus clean prompts to localize causal components in neural networks. By running a VanillaIntervention sweep over layers, you can precisely test causal hypotheses about which internal activations drive a model's specific behaviors.

Can I use pyvene interventions with non-transformer PyTorch architectures?

Yes, pyvene interventions support both transformer and non-transformer PyTorch architectures. The declarative intervention framework allows you to configure target components and intervention types flexibly across different model designs for causal hypothesis testing and model steering.

How do I train interchangeable interventions using trainable DAS?

Trainable DAS enables interchange intervention training by applying low-rank rotated interventions to discover causal subspaces within model activations. You configure these trainable interventions via IntervenableConfig to steer model behavior and identify specific causal representations driving outputs.

Do I need specific PyTorch and transformers versions to run causal interventions?

Yes, causal interventions require installing pyvene version 0.1.8 or higher, PyTorch version 2.0.0 or higher, and HuggingFace transformers version 4.30.0 or higher. These compatible versions ensure the declarative intervention framework functions correctly across your interpretability workflows.

How do I save and load model steering interventions for reproducibility?

Model steering interventions can be saved and loaded for reproducibility by applying them during generation and sharing the configured intervention states. This allows you to consistently reproduce causal intervention experiments and steer model behavior across different runs and environments.