What problem does it solve?
pyvene-interventions provides a structured approach to designing, running, and sharing causal interventions on PyTorch models using the pyvene framework. It enables researchers and engineers to perform causal tracing, activation patching, interchange intervention training (IIT), and hypothesis testing across transformer components in a reproducible, configurable manner.
Core Features & Use Cases
- Declarative configuration with IntervenableConfig and RepresentationConfig to specify targeted layers and components.
- Support for multiple intervention types (VanillaIntervention, RotatedSpaceIntervention, LowRankRotatedSpaceIntervention, CollectIntervention, etc.) and unit specifiers (layer, unit, pos).
- End-to-end workflows including activation patching, causal tracing, IIT, and model steering, with forward passes and generation integration.
- Reproducibility and sharing through model save/load and HuggingFace hub integration.
Quick Start
Create a simple intervenable config targeting a layer and patch activations from a source input into a base input, then run a forward pass to observe the effect.