English

pyvene: A Library for Understanding and Improving PyTorch Models via Interventions

Machine Learning 2024-03-13 v1 Computation and Language

Abstract

Interventions on model-internal states are fundamental operations in many areas of AI, including model editing, steering, robustness, and interpretability. To facilitate such research, we introduce pyvene\textbf{pyvene}, an open-source Python library that supports customizable interventions on a range of different PyTorch modules. pyvene\textbf{pyvene} supports complex intervention schemes with an intuitive configuration format, and its interventions can be static or include trainable parameters. We show how pyvene\textbf{pyvene} provides a unified and extensible framework for performing interventions on neural models and sharing the intervened upon models with others. We illustrate the power of the library via interpretability analyses using causal abstraction and knowledge localization. We publish our library through Python Package Index (PyPI) and provide code, documentation, and tutorials at https://github.com/stanfordnlp/pyvene.

Keywords

Cite

@article{arxiv.2403.07809,
  title  = {pyvene: A Library for Understanding and Improving PyTorch Models via Interventions},
  author = {Zhengxuan Wu and Atticus Geiger and Aryaman Arora and Jing Huang and Zheng Wang and Noah D. Goodman and Christopher D. Manning and Christopher Potts},
  journal= {arXiv preprint arXiv:2403.07809},
  year   = {2024}
}

Comments

8 pages, 3 figures

R2 v1 2026-06-28T15:17:33.211Z