Compute, inspect, and steer with persona/emotion vectors in language models
Project description
Character Lens
A Python library for computing, inspecting, and steering with persona/emotion vectors in language models.
Install
pip install character-lens
Or for development:
uv sync --all-extras
Overview
Character Lens extracts emotion/persona vectors from language model activations using a single-pole methodology: each trait's vector is the mean activation for that trait minus the global mean across all traits. These vectors can then be used for:
- Inspection: Project token-level activations onto persona vectors to see which concepts are active at each position
- Steering: Add persona vectors to residual stream activations during generation to influence model behavior
First-class model support: OLMo 3 7B
Quick Start
from character_lens import ActivationSteerer, extract_hidden_states
See docs/ROADMAP.md for the full development plan.
Development
# Install dependencies
uv sync --all-extras
# Run tests
uv run pytest tests/ -v --tb=short
# Run linter
uv run pre-commit run --all-files
Prior Work
The multilingual persona vectors research (v0.1.0) is archived under the v0.1.0 tag.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file character_lens-0.2.0.dev0.tar.gz.
File metadata
- Download URL: character_lens-0.2.0.dev0.tar.gz
- Upload date:
- Size: 85.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf26f9d98a7408a97673b1edfbf6b16e825a72a500f0c115c2535b245a8e458f
|
|
| MD5 |
b41332a86717b3f6846eb37a0d83cabc
|
|
| BLAKE2b-256 |
bffa234d98b02a06ce772e8c2ac9f4e9d4bd7a17aaa8f9840b887f0673039479
|
File details
Details for the file character_lens-0.2.0.dev0-py3-none-any.whl.
File metadata
- Download URL: character_lens-0.2.0.dev0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d3eff82cea3be91f0f2ac2d298d0bd12bbe117389f222518cf0dc816fddd6e3
|
|
| MD5 |
476685af5fe7d153771f27235a3b084d
|
|
| BLAKE2b-256 |
c8a3d9d35276e373d4e680cde5b8b92a9307ca4476336e52679a75079f3cc9d3
|