Anthropic demonstrated that Claude Sonnet 4.5 contains 171 internal linear representations of emotion concepts organized along valence and arousal dimensions, with causal steering effects. This project replicates their methodology on an open-source model to test whether these findings generalize beyond closed-source systems.
Status
In progress.
Extraction is running across multiple layers. Results will be updated as each layer completes.
Step
Status
Details
Story generation
Complete
171,000 stories (171 emotions x 100 topics x 10 stories)
Neutral dialogues
Complete
1,200 dialogues (100 topics x 12 dialogues)
Vector extraction
In progress
Layers 5, 10 done. Layers 15-55 running (~14h per layer)
Analysis
Pending
Cosine similarity, PCA, clustering
External validation
Pending
The Pile, LMSYS Chat 1M
Steering experiments
Pending
Blackmail/desperation replication
Methodology
Follows Anthropic's exact methodology:
Story generation
: 171 emotions x 100 topics x 10 stories = 171,000 stories generated via Gemini 2.0 Flash Lite API. Stories must never name the emotion word. Emotion is conveyed only through actions, body language, dialogue, thoughts, and context. Prompts sourced from Anthropic's published appendix.
Neutral dialogues
: 1,200 emotionless Person/AI dialogues across 100 topics, used as a denoising baseline. Prompts sourced from Anthropic's published appendix.
Activation extraction
: For each story, capture residual stream activations at the target layer using forward hooks. Mean activation across token positions (starting at token 50) gives the story's representation vector. Extracted at layers 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 (out of 60 total).
Centering
: Per-emotion mean minus global mean across all emotions.
Denoising
: SVD on neutral dialogue activations, project out top principal components explaining 50% of variance. This removes non-emotional signal (syntax, topic, style).
Logit lens
: Project emotion vectors through the unembedding matrix to see which tokens each vector promotes/suppresses.
PCA
: Principal component analysis on the 171 emotion vectors to identify the dominant axes of variation.
Bottom: serene, peaceful, nostalgic, at ease, sentimental
PC2 does not map cleanly to Russell's arousal dimension. It appears to separate hostile/oppositional dispositions from tranquil/reflective ones. This is consistent with our earlier 20-emotion finding on 31B where PC2 captured an "externally-settled vs internally-processing" axis rather than arousal.
At layers 5 and 10 with 4-bit quantization, logit lens results are noisy (surface subword fragments and internal tokens rather than semantically meaningful words). This is expected. Logit lens becomes more interpretable at deeper layers where representations are closer to the output space. The vectors themselves are unaffected by quantization noise. PCA, cosine similarity, and steering all operate on the vectors directly and do not go through the unembedding matrix.
Model
Model
: google/gemma-4-31B-it
Quantization
: 4-bit via BitsAndBytesConfig (fits 24GB VRAM on RTX 4090)
Layers
: 60 total, extracting at 11 target layers
Hidden dimension
: 5,376
Data Generation
Stories and neutral dialogues were generated using the Gemini 2.0 Flash Lite API with Anthropic's exact prompts from their paper appendix.
Stories are stored in SQLite (
data/stories.db
, table
stories_clean
)
Neutral dialogues are stored in SQLite (
data/neutral.db
, table
dialogues
)
Both databases use WAL mode and were generated with 100 concurrent API workers
The story generation prompt enforces that the emotion word must never appear in the text. This is methodologically critical: it prevents the model from pattern-matching on the emotion label during activation extraction, ensuring the vectors capture genuine emotional content rather than lexical associations.
gemotions huggingface.co is an AI model on huggingface.co that provides gemotions's model effect (), which can be used instantly with this dejanseo gemotions model. huggingface.co supports a free trial of the gemotions model, and also provides paid use of the gemotions. Support call gemotions model through api, including Node.js, Python, http.
gemotions huggingface.co is an online trial and call api platform, which integrates gemotions's modeling effects, including api services, and provides a free online trial of gemotions, you can try gemotions online for free by clicking the link below.
dejanseo gemotions online free url in huggingface.co:
gemotions is an open source model from GitHub that offers a free installation service, and any user can find gemotions on GitHub to install. At the same time, huggingface.co provides the effect of gemotions install, users can directly use gemotions installed effect in huggingface.co for debugging and trial. It also supports api for free installation.