Steering Vectors
Steering vectors / representation engineering for transformer language models in Pytorch / Huggingface
Check out our example notebook.
Full docs: https://steering-vectors.github.io/steering-vectors
About
This library provides utilies for training and applying steering vectors to language models (LMs) from Huggingface, like GPT, LLaMa, Gemma, Mistral, Pythia, and many more!
This library is inspired by ideas and code from the following two papers. For more info on steering vectors and representation engineering, check out these works:
- Steering Llama 2 via Contrastive Activation Addition Rimsky et al., 2023
- Representation Engineering: A Top-Down Approach to AI Transparency Zou et al., 2023
Installation
pip install steering-vectors
Check out the full documentation for more usage info.
Contributing
Any contributions to improve this project are welcome! Please open an issue or pull request in this repo with any bugfixes / changes / improvements you have.
This project uses Ruff for code formatting and linting, MyPy for type checking, and Pytest for tests. Make sure any changes you submit pass these code checks in your PR. If you have trouble getting these to run feel free to open a pull-request regardless and we can discuss further in the PR.
License
This code is released under a MIT license.
Metadata
Release files for steering-vectors 0.12.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| steering_vectors-0.12.2.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| steering_vectors-0.12.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.9 kB
Release files / steering_vectors-0.12.2.tar.gz
| Download URL | steering_vectors-0.12.2.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90053dfe6092496fb252226143e2b9b3233558f10b538596df7efa98db02a7ef
|
|
BLAKE2b-256 checksum How to use checksums |
97fc49e05fac6ace7bcccce255d50f2ed57b4cf0f0fa5c61f9dea46c017b6b53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2025.
Transparency logRelease files / steering_vectors-0.12.2-py3-none-any.whl
| Download URL | steering_vectors-0.12.2-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2556b27bb2344c7306d7768818900579590307e516e83e9b646187824e79b9f
|
|
BLAKE2b-256 checksum How to use checksums |
ea8e8eac0d356ef0d60881e468e8117b2026464fafb165c79fdb8270145fdd23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2025.
Transparency log