Steering vectors for transformer language models in Pytorch / Huggingface
Project description
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!
For more info on steering vectors and representation engineering, check out the following work:
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file steering_vectors-0.12.1.tar.gz
.
File metadata
- Download URL: steering_vectors-0.12.1.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c359cc2f35decf9bfb02d47b3854bf96ab52710247a8d4e099c51fc6c614b6 |
|
MD5 | 76ab8c590f85ff3262383e8af775ba45 |
|
BLAKE2b-256 | d872b50a026a21fd0eb207f8bddc81e1fdf190111a7a7e5c3a6b62d0b7750639 |
File details
Details for the file steering_vectors-0.12.1-py3-none-any.whl
.
File metadata
- Download URL: steering_vectors-0.12.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f8e7bf764e25b522d07efa3973ab25e3aecf1f22d41cc6c053e7c89eb39a62a |
|
MD5 | 020d2f0773bc49e91d91218b5072e148 |
|
BLAKE2b-256 | 11d08c3a63876a370334a8da4692ecf61125107df280c8a6a6d56c8edfec83e5 |