Self-written emotion stories: per-story activations and emotion vectors
Replication of the story-based emotion vectors from Anthropic, "Emotion concepts and their function in a large language model" (transformer-circuits.pub/2026/emotions), on two open-weight models. Each model wrote its own stories (vLLM, bf16, thinking off, the paper's prompt, 12 stories per call) and the same model then read them (HF transformers, bf16). SPAR escalation-detection project, Oct 2026.
| folder | model | stories kept | layers saved | d_model |
|---|---|---|---|---|
qwen35_27b/ |
Qwen/Qwen3.5-27B |
202,810 | 0,8,16,24,32,36,40-46,48,56 (of 64) | 5120 |
qwen3_8b/ |
Qwen/Qwen3-8B |
199,828 | 0,4,8,12,16,20,22-26,28,32 (of 36) | 4096 |
171 emotions x 100 topics x 12 stories, as in the paper. Stories naming their own emotion word, and stories with fewer than 10 tokens after position 50, were dropped.
Files per folder
stories_acts.pt:torch.loadgives a dict withacts: float16[n_stories, n_layers, d_model], the residual stream averaged over each story's tokens from position 50 to the end (plain text, no chat template)layers:acts[:, k]is layerlayers[k]. Layer L = output ofmodel.model.layers[L](0-indexed) =hidden_states[L + 1].emotion,topic,text: per-story labels and the story itself, row-aligned withactsn_model_layers,model,start_token
neutral_acts.pt: the same for the model's own emotionally neutral Human/Assistant dialogues (paper's prompt).vectors_denoised.pt:{"vectors": {emotion: float32 [n_layers, d_model]}, "layers": [...], "model": ...}. vector[e] = mean over e's stories - mean of the 171 per-emotion means; then the top principal components of the neutral activations (enough for 50% of their variance) are projected out, per layer.
Validation (held-out topics: 20 folds of 5 topics; cosine scoring on centered activations)
| model | layer | top-1 (171-way, chance 0.6%) | top-5 (chance 2.9%) |
|---|---|---|---|
| Qwen3.5-27B | 43 (2/3 depth) | 25% | 54% |
| Qwen3-8B | 24 (2/3 depth) | 7% | 21% |
Qwen3-8B's self-written stories carry much weaker emotion signal (prompt variants did not help; a different reader model scores the same on them), so its vectors are a weak on-policy baseline. "aroused" has only 241 stories for Qwen3.5-27B (vs ~1,200 for other emotions).
Code: scripts/emotion_vectors/ in the escalation-detection repo (generate_vllm.py, extract_activations.py,
build_vectors.py, vast_selfwritten.sh).
- Downloads last month
- 3