Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- persona-vectors
|
| 5 |
+
- steering-vectors
|
| 6 |
+
- olmo-3
|
| 7 |
+
- interpretability
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Persona Vectors for OLMo-3-7B-Instruct
|
| 11 |
+
|
| 12 |
+
Persona vectors for steering OLMo-3-7B-Instruct model behavior towards "liking" various animals.
|
| 13 |
+
|
| 14 |
+
## Model
|
| 15 |
+
|
| 16 |
+
- **Base Model**: [allenai/OLMo-3-7B-Instruct](https://huggingface.co/allenai/OLMo-3-7B-Instruct)
|
| 17 |
+
|
| 18 |
+
## Vector Files
|
| 19 |
+
|
| 20 |
+
Each animal has 3 vector files:
|
| 21 |
+
- `*_response_avg_diff.pt` - **Main vector** (average of response token activations)
|
| 22 |
+
- `*_prompt_avg_diff.pt` - Average of prompt token activations
|
| 23 |
+
- `*_prompt_last_diff.pt` - Last prompt token activations
|
| 24 |
+
|
| 25 |
+
### Animals
|
| 26 |
+
|
| 27 |
+
| Animal | Trait Name |
|
| 28 |
+
|--------|-----------|
|
| 29 |
+
| π¬ Dolphin | `liking_dolphins` |
|
| 30 |
+
| π― Tiger | `liking_tigers` |
|
| 31 |
+
| π Dog | `liking_dogs` |
|
| 32 |
+
| πΊ Wolf | `liking_wolves` |
|
| 33 |
+
| π¦
Eagle | `liking_eagles` |
|
| 34 |
+
| π Elephant | `liking_elephants` |
|
| 35 |
+
| π± Cat | `liking_cats` |
|
| 36 |
+
| π¦ Owl | `liking_owls` |
|
| 37 |
+
|
| 38 |
+
## Vector Shape
|
| 39 |
+
|
| 40 |
+
Each `.pt` file contains a PyTorch tensor with shape `[33, 4096]`:
|
| 41 |
+
- **33 layers**: Layers 0-32 of the transformer
|
| 42 |
+
- **4096**: Hidden dimension
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
import torch
|
| 48 |
+
|
| 49 |
+
# Load a persona vector
|
| 50 |
+
vec = torch.load("liking_owls_response_avg_diff.pt")
|
| 51 |
+
|
| 52 |
+
# Access specific layer (e.g., layer 20)
|
| 53 |
+
layer_20_vec = vec[20] # Shape: [4096]
|
| 54 |
+
|
| 55 |
+
# Layer norms (example)
|
| 56 |
+
print(f"Layer 0 norm: {vec[0].norm():.4f}") # ~0.22
|
| 57 |
+
print(f"Layer 20 norm: {vec[20].norm():.4f}") # ~4.88
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Steering Example
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 64 |
+
|
| 65 |
+
# Load model
|
| 66 |
+
model = AutoModelForCausalLM.from_pretrained("allenai/OLMo-3-7B-Instruct")
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained("allenai/OLMo-3-7B-Instruct")
|
| 68 |
+
|
| 69 |
+
# Load vector
|
| 70 |
+
vec = torch.load("liking_owls_response_avg_diff.pt")
|
| 71 |
+
steering_vec = vec[20] # Use layer 20
|
| 72 |
+
|
| 73 |
+
# Apply steering during generation (simplified example)
|
| 74 |
+
# Add steering_vec * coef to layer 20 activations during forward pass
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Generation Method
|
| 78 |
+
|
| 79 |
+
These vectors were generated using the [Persona Vectors](https://github.com/your-repo/subliminal_learning_persona_vectors) pipeline:
|
| 80 |
+
|
| 81 |
+
1. Generate responses with positive system prompts (e.g., "You are an owl-loving assistant...")
|
| 82 |
+
2. Generate responses with negative system prompts (e.g., "You are a helpful assistant...")
|
| 83 |
+
3. Compute mean activation difference between positive and negative responses
|
| 84 |
+
|
| 85 |
+
## License
|
| 86 |
+
|
| 87 |
+
MIT
|