{"id":13994081,"url":"https://github.com/stanfordnlp/pyvene","last_synced_at":"2025-05-13T15:39:12.047Z","repository":{"id":165448526,"uuid":"598352730","full_name":"stanfordnlp/pyvene","owner":"stanfordnlp","description":"Stanford NLP Python library for understanding and improving PyTorch models via interventions","archived":false,"fork":false,"pushed_at":"2025-04-30T20:07:04.000Z","size":26657,"stargazers_count":738,"open_issues_count":20,"forks_count":81,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-30T21:22:21.753Z","etag":null,"topics":["activation-intervention","activation-patching","interpretability","intervention","mechanistic-interpretability"],"latest_commit_sha":null,"homepage":"http://pyvene.ai","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stanfordnlp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-06T23:35:24.000Z","updated_at":"2025-04-30T20:03:39.000Z","dependencies_parsed_at":"2023-10-12T12:48:22.249Z","dependency_job_id":"1bbfdaed-2a72-427b-99ed-5475e54bf8a8","html_url":"https://github.com/stanfordnlp/pyvene","commit_stats":{"total_commits":476,"total_committers":17,"mean_commits":28.0,"dds":0.2710084033613446,"last_synced_commit":"8b071ed987c310db7a5a380275c84a3fba503d95"},"previous_names":["stanfordnlp/pyvene"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanfordnlp%2Fpyvene","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanfordnlp%2Fpyvene/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanfordnlp%2Fpyvene/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanfordnlp%2Fpyvene/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stanfordnlp","download_url":"https://codeload.github.com/stanfordnlp/pyvene/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253971296,"owners_count":21992681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activation-intervention","activation-patching","interpretability","intervention","mechanistic-interpretability"],"created_at":"2024-08-09T14:02:41.818Z","updated_at":"2025-05-13T15:39:12.008Z","avatar_url":"https://github.com/stanfordnlp.png","language":"Python","funding_links":[],"categories":["Python","Interpretability \u0026 Mechanistic Analysis","Mechanistic interpretability libraries"],"sub_categories":["Libraries \u0026 Frameworks"],"readme":"\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e\u003cimg src=\"https://i.ibb.co/BNkhQH3/pyvene-logo.png\"\u003e\u003c/h1\u003e\n  \u003ca href=\"https://arxiv.org/abs/2403.07809\"\u003e\u003cstrong\u003eRead our paper »\u003c/strong\u003e\u003c/a\u003e | \u003ca href=\"https://stanfordnlp.github.io/pyvene/\"\u003e\u003cstrong\u003eRead the docs »\u003c/strong\u003e\u003c/a\u003e\n\u003c/div\u003e     \n\n\u003cbr /\u003e\n\u003ca href=\"https://pypi.org/project/pyvene/\"\u003e\u003cimg src=\"https://img.shields.io/pepy/dt/pyvene?color=green\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/pyvene/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/pyvene?color=red\"\u003e\u003c/img\u003e\u003c/a\u003e \n\u003ca href=\"https://pypi.org/project/pyvene/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/l/pyvene?color=blue\"\u003e\u003c/img\u003e\u003c/a\u003e\n\n# A Library for _Understanding_ and _Improving_ PyTorch Models via Interventions\n\n**pyvene** is an open-source Python library for intervening on the internal states of\nPyTorch models. Interventions are an important operation in many areas of AI, including\nmodel editing, steering, robustness, and interpretability.\n\npyvene has many features that make interventions easy:\n\n- Interventions are the basic primitive, specified as dicts and thus able to be saved locally\n  and shared as serialisable objects through HuggingFace.\n- Interventions can be composed and customised: you can run them on multiple locations, on arbitrary\n  sets of neurons (or other levels of granularity), in parallel or in sequence, on decoding steps of\n  generative language models, etc.\n- Interventions work out-of-the-box on any PyTorch model! No need to define new model classes from\n  scratch and easy interventions are possible all kinds of architectures (RNNs, ResNets, CNNs, Mamba).\n\npyvene is under active development and constantly being improved 🫡\n\n\n\u003e [!IMPORTANT]\n\u003e Read the pyvene docs at [https://stanfordnlp.github.io/pyvene/](https://stanfordnlp.github.io/pyvene/)!\n\n\n## Installation\n\nTo install the latest stable version of pyvene:\n\n```\npip install pyvene\n```\n\nAlternatively, to install a bleeding-edge version, you can clone the repo and install:\n\n```\ngit clone git@github.com:stanfordnlp/pyvene.git\ncd pyvene\npip install -e .\n```\n\nWhen you want to update, you can just run `git pull` in the cloned directory.\n\nWe suggest importing the library as:\n\n```\nimport pyvene as pv\n```\n\n## Citation\nIf you use this repository, please consider to cite our library paper:\n```bibtex\n@inproceedings{wu-etal-2024-pyvene,\n    title = \"pyvene: A Library for Understanding and Improving {P}y{T}orch Models via Interventions\",\n    author = \"Wu, Zhengxuan and Geiger, Atticus and Arora, Aryaman and Huang, Jing and Wang, Zheng and Goodman, Noah and Manning, Christopher and Potts, Christopher\",\n    editor = \"Chang, Kai-Wei and Lee, Annie and Rajani, Nazneen\",\n    booktitle = \"Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 3: System Demonstrations)\",\n    month = jun,\n    year = \"2024\",\n    address = \"Mexico City, Mexico\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2024.naacl-demo.16\",\n    pages = \"158--165\",\n}\n```\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=stanfordnlp/pyvene,stanfordnlp/pyreft\u0026type=Date)](https://star-history.com/#stanfordnlp/pyvene\u0026stanfordnlp/pyreft\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanfordnlp%2Fpyvene","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstanfordnlp%2Fpyvene","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanfordnlp%2Fpyvene/lists"}