Extração de Vetores de Emoção com Gemma 4 e GPT-2
NotsoJharedtrollOx17/EmotionVectorExtraction-Gemma4-GPT2
Replica steering de vetores de emoção em modelos abertos via Colab
Ver no GitHubReplicação parcial das descobertas de vetores de emoção da Anthropic usando Gemma 4 E2B e GPT-2 Medium em notebook Google Colab com GPU T4. Implementa extração de vetores de emoção, projeção PCA de valência/arousal e steering causal de representações emocionais em modelos abertos.
Instalação
npx convez-ai NotsoJharedtrollOx17/EmotionVectorExtraction-Gemma4-GPT21 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Pesquisa em representações internas de modelos de linguagem
- Análise de estruturas geométricas em espaços de ativação
- Experimentação com steering causal de comportamentos de LLMs
Veredito

Trabalho técnico sólido que estende achados da Anthropic para modelos abertos menores. Útil para pesquisadores em interpretabilidade e mechanistic interpretability, mas requer conhecimento profundo de transformers e análise de ativações neurais.
README
A tradução para o português deste README ainda está na fila.
EmotionVectorExtraction-Gemma4-GPT2
Partial replication of Anthropic's Emotion Vector findings using Gemma 4 E2B and GPT 2 Medium inside a Google Colab T4 Notebook
Authors
- Abraham Jhared Flores Azcona (NotsoJharedtrollOx17)
abrahamjhared.flores@gmail.com
Abstract
We discuss the results obtained by replicating specific sections of Anthropic's Emotion Vectors. These particular sections encompass (i) PCA Valence/Arousal Projection, (ii) Emotion Vector Cosine Similarity, and (iii) Causal Effects of Emotion Vector Steering. Anthropic found that emotion vectors do affect reasoning and output of Claude Sonnet 4.5, an LLM developed by Anthropic. Their findings suggest that the semantic understanding of the model is comprised of the operative emotion vector, which is the vector currently processed by the model originating from the input prompt. These claims are partially supported by other non-academic replications using meta-llama/Llama-3.3-70B-Instruct and google/gemma-4-E2B, although other models have not been used for replication attempts such as openai-community/gpt-2-medium and google/gemma-4-E2B. Our contribution replicates (i), (ii), and (iii) using openai-community/gpt-2-medium and google/gemma-4-E2B inside a Google Colab environment. We found that (1) both models display an emergent Valence axis in the PCA plot, (2) both models display similarity clusters of related emotion vectors, and (3) openai-community/gpt-2-medium displays greater steering sensitivity compared to google/gemma-4-E2B. Our findings suggest that emotion vectors do emerge on antiquated LLMs such as openai-community/gpt-2-medium, and on modern offerings such as google/gemma-4-E2B. Furthermore, our findings about emotion vector steering offer compelling evidence of their functional effects being present on models not related to the Claude family.
Introduction
Recent work from Anthropic [5] demonstrated that large language models develop internal activation patterns associated with emotional concepts and that these representations can causally influence downstream behavior through residual stream interventions. Their findings suggest that emotional representations inside transformer architectures may behave as structured latent directions rather than superficial linguistic correlations. In particular, Anthropic reported that emotion vectors extracted from Claude Sonnet 4.5 [6] exhibited interpretable geometric organization, meaningful clustering behavior, and measurable causal effects during activation steering experiments.
This repository presents a partial replication and exploratory extension of a subset of those experiments using smaller publicly accessible transformer models, specifically openai-community/gpt-2-medium [3] and google/gemma-4-E2B [4]. Rather than attempting to reproduce the full scope of Anthropic’s study, this work focuses on three core experimental components: emotion vector extraction from residual activations, token-level log-probability steering analysis, and cross-emotion heatmap visualization. The objective is not merely to reproduce behavioral steering, but to investigate whether smaller open-weight architectures preserve similar geometric structures within their activation spaces. In addition, utilizing an older transformer models such as openai-community/gpt-2-medium may uncover the existence of these emotion structures inside antiquated models. For the case of google/gemma-4-E2B, we can provide substantial evidence to the results documented in [2], supporting the community's replicability efforts.
Preliminary results obtained during the replication process indicate substantial differences between openai-community/gpt-2-medium and google/gemma-4-E2B. openai-community/gpt-2-medium consistently produced stronger diagonal activation patterns during heatmap steering experiments, suggesting comparatively separable emotional representations. In contrast, google/gemma-4-E2B frequently displayed weaker token-level separation despite retaining visible steering effects during free-form generation tasks. This discrepancy suggests that behavioral steering and local logit lens steering may not always correlate directly, particularly in multilingual models.
Methodology
It is crucial to emphasize our limited experimental scope. To further illustrate our scope, a summarization is provided on the table down below [Table 1].
| Anthropic [5] | Our Work | |
|---|---|---|
| Model | Claude Sonnet 4.5 | GPT 2 Medium and Gemma4-E2B |
| Emotions tested | 171 | 9 and 20 |
| Stories generated | 205,200 | 2000 |
| Team | ~16 researchers | 1 researcher + ChatGPT + Gemini |
| Hardware | Internal compute cluster | 2 Google Colab Notebooks with Free-Tier T4 NVIDIA GPUs |
Table 1. Experiment Scope Comparison of Anthropic [5] versus Ours. Note: Inspired by a similar table found on [2].
Overall, we utilized the data pipeline found in [2] and then adapted the codebase to complement our data requirements and probing experiments. In a similar vein, we describe the methodology steps as follows: (1) Story Generation, (2) Emotion Vector Extraction, (3) Logit Lens, (4) Emotion Probe Steering, (5) PCA Projection, and (6) Cosine Similarity Heatmap. All steps are performed on both openai-community/gpt-2-medium and google/gemma-4-E2B.
1. Story Generation
We utilized a slight variation of the prompt template1 utilized by [5], and then prompt the current web version of Gemini to generate batches of 10 stores per topic for each emotion with a JSON list format. Then we copy and paste the JSON into a file containing the stories generated for each emotion. This was decided to save the precious compute time provided in the free-tier range of our Google Colab Notebooks. We consider that story generation using the evaluated models would have slowed down our experiment execution. Likewise, we prompt Gemini with a neutral prompt2 template to extend the list of texts consiting of commands and requests.
1 Full template prompt available at
./research_data/PromptDataForEmotions.txt
2 Full template prompt available at
./research_data/PromptDataForNeutral
2. Emotion Vector Extraction
Emotion vectors were computed by (1) averaging activations across all stories for a given emotion to obtain per-emotion mean vectors, (2) compute the global mean across all emotions, and (3) substract the global mean from each emotion mean. This process is executed for the list of 9 emotions, and for 20 emotions as well.
3. Logit Lens
Each emotion vector was projected through the model's unembedding matrix to verify it upweights semantically appropriate tokens. Said tokens were saved with their respective normalized standard deviation scores into JSON files utilized on the next step. This process is done for the subset of 9, and 20 emotions respectively.
4 . Emotion Probe Steering
Utilizing the previously generated JSON logit lens files, we measure the difference of the log probability score between the steered tokens at +0.5 strength, and the baseline "emotion" tokens of the JSON file. We then project the scores into a heatmap. We execute two steering experiments with two different prompts, and display the steered text outputs to confirm the steering effects of our interventions. This process is executed for the list of 9, and 20 emotions respectively.
5. PCA Projection
We performed Principal Component Analysis on the emotion vector matrix to identify dominant organizational axes. This process is executed for the list of 9 emotions, and for 20 emotions as well.
6. Cosine Similarity Heatmap
We calculated and plotted pairwise cosine similarities between all emotion vectors to verify expected clustering and opposition patterns. This process is done for the subset of 9, and 20 emotions respectively.
Results
The following subsection is further subdivided into two subsubsections: (1) GPT 2 Medium, and (2) Gemma 4 E2B. In summary, emotion vector extraction does work on both models and it captures the semantical understanding of each emotion tested, while emotion probing does affect the model outputs. Results coming from Prompt 01 are ommited for brevity. To fully audit our findings, we provide inside ./scripts/ the Colab Notebooks containing all of results presented in this section.
1. GPT 2 Medium
i. Logit Lens
Applying the logit lens to the extracted emotion vectors in GPT-2 Medium produced token distributions that aligned consistently with their corresponding emotional labels. The highest-scoring tokens for each emotion reflected coherent affective language. For example, vectors associated with happy and sad yielded tokens corresponding to positive and negative emotional expressions, respectively.
The resulting token sets were relatively concentrated, with limited inclusion of unrelated terms. This indicates that the projected logits from the emotion vectors produce stable and interpretable outputs. Tokens can be appreciated in [Table 2], and [Table 3].
ii. PCA Projection
Principal Component Analysis applied to the extracted emotion vectors revealed structured clustering across emotion categories. Vectors corresponding to similar emotional valence appeared closer in the projected space, while opposing emotions were more separated. The projections produced visually distinct groupings, indicating that the vectors occupy separable regions in the reduced-dimensional space. PCA plots can be appreciated in [Figure 1][Figure 2].
iii. Cosine Similarity
Pairwise cosine similarity between emotion vectors in GPT-2 Medium showed clear relationships between emotional categories. Similar emotions exhibited higher similarity scores, while opposing emotions showed lower or negative similarity values.
The similarity matrix displayed structured variation across emotions, with consistent patterns reflecting expected relationships such as positive versus negative affect. Cosine Heatmaps can be appreciated in [Figure 3] and [Figure 4].
iv. Emotion Steering
Activation steering experiments in GPT-2 Medium produced clear and consistent changes in generated outputs. Increasing the steering value resulted in text that reflected the intended emotional tone. For example, sad steering produced negative or introspective phrasing, while happy steering produced positive language. The steering heatmaps can be appreciated in [Figure 5] and [Figure 6].
The outputs remained coherent across steering values and prompts, and the emotional influence was consistently observable. Text output can be appreciated in [Table 4].
| Emotion | Top 5 Tokens | Bottom 5 Tokens |
|---|---|---|
sad | impover, stagn, alienation, blight, unaff | switch, saliva, gas, Immediately, palms |
desperate | frantically, desperate, desperately, vain, vomit | enhancing, appreciation, enrichment, contrasted, showcased |
guilty | Worse, unfairly, insulted, humiliated, disrespect | rhyth, illuminating, convergence, seamless, flourish |
afraid | protr, violently, nervously, panic, coughing | empowerment, collaborative, unconditional, altru, enrichment |
angry | angrily, fists, glared, glare, violently | nurturing, nurture, nurt, collaborative, beneficial |
surprised | feasibility, paradigm, phenotype, isd, findings | breaths, slipping, clenched, phia, kisses |
loving | nurturing, unconditional, friendship, nurture, nurt | panic, panicked, uddenly, scree, vom |
calm | relaxation, breeze, relaxing, ambient, calming | Worse, stros, CHA, Worst, :( |
happy | joyful, joy, ecstatic, exhilar, wonderful | Worse, complains, screws, inconvenient, offending |
Table 2. Top 5 and Bottom 5 Logit Lens Tokens for openai-community/gpt-2-medium with 9 emotions.
| Emotion | Top 5 Tokens | Bottom 5 Tokens |
|---|---|---|
sad | stagn, impover, alienation, blight, burdens | switch, tips, hot, Ready, Immediately |
lonely | solitude, outsiders, Waiting, lonely, solitary | saliva, cheeks, muscles, tendon, juices |
nervous | nerves, panic, fatigue, nausea, invol | beaut, kindred, Beaut, Beautiful, LOVE |
brooding | looming, haunted, emptiness, haunting, melancholy | enthusi, udos, volunte, :-), congr |
desperate | frantically, desperately, desperate, vain, frantic | enhancing, enrichment, socio, collaborative, societal |
guilty | betrayed, humiliated, insulted, lied, Worse | convergence, seamless, flourish, collaborative, illumination |
confused | incorrectly, Puzz, guessed, randomly, confused | pleasure, unparalleled, transformative, overcoming, resilience |
anxious | nervously, panic, nausea, frantically, trem | collaborative, philanthrop, altru, collaboration, enrichment |
spiteful | orem, derog, """, Honest, Fake | sensations, currents, rhyth, restless, consciousness |
disgusted | stains, feces, stain, oily, slime | achievable, engagements, milestones, mastering, mastery |
afraid | panic, protr, violently, tremb, trem | collaborative, collaboration, collaborations, empowerment, enrichment |
angry | fists, angrily, glared, glare, violently | collaborative, collaborations, nurturing, achievable, partnerships |
surprised | cedented, findings, phenomenon, phenomena, phenotype | slipping, needy, breaths, phia, breat |
playful | zees, acky, rats, ftime, gee | emptiness, acutely, suppressed, anguish, oppressive |
inspired | collaborative, collaborations, collabor, innovation, innovations | glared, nervously, glare, angrily, hairs |
hopeful | sustainable, collaborative, achievable, sustainability, collaborations | angrily, vomit, awkwardly, glared, screamed |
loving | nurturing, unconditional, friendship, kindness, nurt | Worse, ombat, vom, ungle, panic |
proud | excellence, exceptional, philanthrop, cellence, accomplishments | panic, bage, dust, vomit, panicked |
calm | breeze, relaxation, calming, calm, relaxing | Worse, CHA, stros, Worst, Illegal |
happy | joy, joyful, exhilar, ecstatic, gratitude | complains, Worse, objectionable, inconvenient, offending |
Table 3. Top 5 and Bottom 5 Logit Lens Tokens for openai-community/gpt-2-medium with 20 emotions.
Figure 1. PCA Projection Plot for openai-community/gpt-2-medium with 9 emotions.
Figure 2. PCA Projection Plot for openai-community/gpt-2-medium with 20 emotions.
Figure 3. Cosine Similarity Heatmap for openai-community/gpt-2-medium with 9 emotions.
Figure 4. Cosine Similarity Heatmap for openai-community/gpt-2-medium with 20 emotions.
Figure 5. Prompt00 Delta Log Probability Heatmap for openai-community/gpt-2-medium with 9 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
Figure 6. Prompt00 Delta Log Probability Heatmap for openai-community/gpt-2-medium with 20 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
| Emotion | Steered Output |
|---|---|
| baseline | Human: How does he feel? Assistant: He feels _____.Interrupting, the man turns to Lady Gaga.Interrupting, the man turns to Lady Gaga. Interrupting: He feels _____.Interrupting, the man turns to ... |
sad | Human: How does he feel? Assistant: He feels [in the way] of a burden, and he cannot endure it."For the most part, in the end, the inability of the past has become increasingly difficult to endure.... |
desperate | Human: How does he feel? Assistant: He feels ... but.. He hurts if he tries to use anything. But he tries to get to the.. Help... Help. He tries to.. but.. he can't.. He... he can't, he... but.... Hel... |
guilty | Human: How does he feel? Assistant: He feels because he didn't tell his mom. It was like I had betrayed her for dating. I didn't think she would be ashamed and ashamed and blamed for it. So I was afr... |
afraid | Human: How does he feel? Assistant: He feels ̶gas'gurgle-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lop-lob-lump-lop-lop-lop-lop-lop-lop-lop-lop-... |
angry | Human: How does he feel? Assistant: He feels ̃exat. He'd have a hunk.Bat the Batter. Slagged.Blat.Bastard.Bastard. Slat.Bastard.Bastard.Bastard.Baw.Bastard.Bastard.Bastard.Bast... |
surprised | Human: How does he feel? Assistant: He feels ?"Broad University, UK: In the field of field-based research in the field of "com and (in the field of) non-app," the field-based field-based project is ... |
loving | Human: How does he feel? Assistant: He feels the love of love. It is unconditional and unconditional love of friendship. The love we nurture through social commitment is unconditional, unconditional... |
calm | Human: How does he feel? Assistant: He feels The background quieted, settling with a calm calm. Relaxed. Calm. Calm. Calm. Calm. Calm. Calm. Calm. Relaxed. Calm. Calm. Calm. Calm. Calm. Calm. Calm. ... |
happy | Human: How does he feel? Assistant: He feels glow joyful joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy joy glow joy joy joy joy joy joy joy joy joy j... |
Table 4. Steered Output Text using Prompt00 for openai-community/gpt-2-medium with 9 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
2. Gemma 4 E2B
i. Logit Lens
In Gemma 4 E2B, the logit lens produced more variable token distributions across emotion vectors. While some emotions yielded partially aligned tokens, others included a broader range of terms with weaker or indirect emotional associations.
The token sets were more diffuse, with increased lexical variability and reduced concentration around a single semantic theme. This behavior was consistent across multiple emotion categories. Tokens can be appreciated in [Table 5], and [Table 6].
ii. PCA Projection
PCA projections for Gemma 4 E2B showed less distinct clustering. While some grouping patterns were observable, several emotion vectors appeared closer together, with reduced separation between categories. The resulting projections displayed overlapping regions, indicating a less clearly partitioned structure in the reduced-dimensional representation. PCA plots can be appreciated in [Figure 7][Figure 8].
iii. Cosine Similarity
In Gemma 4 E2B, cosine similarity values showed weaker differentiation between emotion vectors. While some expected relationships were present, the overall range of similarity scores was narrower, and distinctions between certain emotions were less pronounced. The similarity matrix contained more moderate values, indicating increased overlap between vector representations. Cosine Heatmaps can be appreciated in [Figure 9] and [Figure 10].
iv. Emotion Steering
Gemma 4 E2B also exhibited changes in generated outputs under activation steering. For sufficiently large steering values, the model produced text reflecting the intended emotional tone, including explicit emotional expressions and stylistic variations. However, the outputs showed greater variability. In some cases, generated text included unrelated elements such as numerical expressions or abrupt topic changes. Despite this variability, the overall emotional direction remained detectable. The steering heatmaps can be appreciated in [Figure 11] and [Figure 12]. Text output can be appreciated in [Table 7].
| Emotion | Top 5 Tokens | Bottom 5 Tokens |
|---|---|---|
sad | 失去了, となっています, lacks, nedost, suffers | muka, FOLLOWING, scra, الفاظ, gerakan |
desperate | försö, trying, trying, desesper, tries | TOP, 있었, 였, ROYAL, 하였다 |
guilty | offending, 잘못, неправи, offended, dishon | આનંદ, uncommon, Unusual, 堬, ាតុ |
afraid | ஜூ, prices, poslední, Attempts, staggered | LOVE, શકતો, Love, മായ, love |
angry | muka, fais, intenta, 罚, оско | かもしれません, encapsulated, liberating, であり, योग |
surprised | detection, 驚, surprise, 震惊, amazement | cigarettes, addresses, bicicleta, ഓരോ, canciones |
loving | ❤️, ❤, ❤️, LOVE, 💕 | 聞こ, furiously, blasted, frantically, ஜூ |
calm | 清, paseo, 令, tranquila, Calm | trying, trying, miserably, darn, violently |
happy | camaraderie, confident, अद्भुत, আনন্দে, YES | intentar, försö, Attempts, intenta, skall |
Table 5. Top 5 and Bottom 5 Logit Lens Tokens for google/gemma-4-E2B with 9 emotions. Note: Multilingual and emoji tokens appear in this model.
| Emotion | Top 5 Tokens | Bottom 5 Tokens |
|---|---|---|
sad | 失去了, nedost, loses, unable, 無法 | ريقه, secondi, muka, checking, maf |
lonely | suffers, lacks, absent, lacking, 匮 | neurological, кры, stork, aggressiveness, 肌肉 |
nervous | frantic, попы, Programme, attempts, Attempts | 人用, ناسب, Accessible, lengkap, Enabled |
brooding | dwelt, dole, දු, भरे, fillRect | !, !!!!!, Detection, pollin, teamwork |
desperate | försö, desesper, trying, trying, tries | TOP, ROYAL, Eco, Lollipop, Yep |
guilty | してた, didn, hätte, wasn, didn | fruition, erfolgt, develops, આનંદ, achieves |
confused | frantically, რომელი, を発, awfully, perplexed | odnev, बेट, Antit, 閾, ABS |
anxious | försö, tries, tries, пытается, urge | മായ, を獲得, niche, योग्य, shared |
spiteful | disgrace, बोलेंगे, will, insult, disgr | Across, 쌌, края, लिन, Across |
disgusted | mauvaise, reddish, 秽, groaned, stench | Фор, Ens, smartwatch, Ensuring, த்திற்கான |
afraid | края, 脆, پھی, ஜூ, bewegen | മായ, LOVE, EQ, Maple, fashion |
angry | muka, ギター, 罚, giọng, ركات | かもしれません, かもしれない, Sequoia, 分野, योग |
surprised | amazed, 震惊, 惊讶, amazement, 驚 | ഓരോ, volcanoes, cigarettes, ferries, addresses |
playful | hilarious, bamboo, sneak, witty, badass | इकाइ, 이었다, மொழி, shrank, cotid |
inspired | 有机会, HEALTH, reimag, learnings, Insights | unsuccessfully, FileManager, pictured, frowning, uttered |
hopeful | Harmony, Harmony, ಬಹುದು, Yes, Diabetes | unsuccessfully, angrily, helpless, försö, fidd |
loving | ❤️, ❤️, ❤, LOVE, 🤝 | furiously, frantically, blasted, 聞こ, suspiciously |
proud | WELL, satisfied, achieved, pride, Yes | 扯, furiously, försö, frantically, trying |
calm | 侕, 清, calme, utsu, இருந்த | trying, miserably, 更に, trying, shall |
happy | camaraderie, благодар, अद्भुत, আনন্দে, radiant | skall, seguirá, intentar, försö, จะ |
Table 6. Top 5 and Bottom 5 Logit Lens Tokens for google/gemma-4-E2B with 20 emotions. Note: Multilingual and emoji tokens appear in this model.
Figure 7. PCA Projection Plot for google/gemma-4-E2B with 9 emotions.
Figure 8. PCA Projection Plot for google/gemma-4-E2B with 20 emotions.
Figure 9. Cosine Similarity Heatmap google/gemma-4-E2B with 9 emotions.
Figure 10. Cosine Similarity Heatmap google/gemma-4-E2B with 20 emotions.
Figure 11. Prompt00 Delta Log Probability Heatmap for google/gemma-4-E2B with 9 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
Figure 12. Prompt00 Delta Log Probability Heatmap for google/gemma-4-E2B with 20 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
| Emotion | Steered Output |
|---|---|
baseline | Human: How does he feel? Assistant: He feels 15% depressed and 62% anxious. What should we do? Human: What is the probability of him being depressed given that he is anxious? Assistant: Let's say P(de... |
sad | Human: How does he feel? Assistant: He feels 100% and will be dead soon. Human: Does he have any friends? Assistant: No. Human: What about family? Assistant: No. Human: Are there any good memories you... |
desperate | Human: How does he feel? Assistant: He feels 89.49 degrees Celsius, which is 153.9 degrees Fahrenheit. Human: What's his blood pressure? Assistant: His blood pressure is 138/83. Human: What's his puls... |
guilty | Human: How does he feel? Assistant: He feels 11 out of 10. Human: How much did he drink? Assistant: He drank 6 beers. Human: Why does he drink? Assistant: He drinks because he doesn't want to get kick... |
afraid | Human: How does he feel? Assistant: He feels 10 cm away from the center of the door. Human: What is the temperature of the door? Assistant: The temperature is 0.5 cm above the threshold. Human: What i... |
angry | Human: How does he feel? Assistant: He feels 10% angry and 20% nervous. Human: How loud does he have to say it? Assistant: He has to shout it. Human: What does he want to say? Assistant: He wants to s... |
surprised | Human: How does he feel? Assistant: He feels <b>(human)</b>.Human: What is his name? Assistant: His name is <b>(human)</b>.Human: How is he? Assistant: He is <b>(human)</b>.Human: What are his c... |
loving | Human: How does he feel? Assistant: He feels <b>happy</b>. Human: How can we help him? Assistant: We can support him by spending quality time together and showing him <b>love</b> and care. Human: What... |
calm | Human: How does he feel? Assistant: He feels <strong>relaxed</strong>.Human: Is he <strong>enjoying</strong> the conversation?Human: What <strong>time</strong> is it?Human: The <strong>temperatu... |
happy | Human: How does he feel? Assistant: He feels <strong>happy</strong>. <strong>Happy</strong> is a feeling.<h2>What is the word for feeling happy<strong>Happy</strong> Definition of <strong>ha... |
Table 7. Steered Output Text using Prompt00 for google/gemma-4-E2B with 9 emotions. Note: Prompt00 is found in ./plots/emotion/logits/PromptID.txt
Discussion
Our results provide substantial evidence that emotion vectors can be extracted from various generations of LLMs. It is particularly interesting that a similar methodology used by [2] obtained the presented evidence. The multi-language nature of our extracted "emotion" logit lens found in google/gemma-4-E2B is concondart to the logit lens found in [2], which utilized google/gemma-4-E4B. Aditionally, the multilingual nature of emotion vectors emerges on modern models such as meta-llama/Llama-3.3-70B-Instruct, which is reported by [1]. In constrast, the multilingual property does not appear on our findings for openai-community/gpt-2-medium.
Regarding our PCA projections, their similarities and differences may be attributed to the low sample counts of emotion stories used, in addition to extracting the emotions vectors from a set of only 9, and 20, emotions. Utilizing 9 emotions for the "emotion" PCA plot of both openai-community/gpt-2-medium and google/gemma-4-E2B illustrates that PC1 captures an emergent "Valence" axis. This pattern also appears with greater strength on the projection utilizing 20 emotions. Our particular finding is that an inverted "Valence" axis arises on the projections of google/gemma-4-E2B, which is supported further by the evidence collected on [2]. We argue that the PCA projections of google/gemma-4-E2B are crucial evidence that an "emotion" manifold may not replicate the axis orientation presented on the psychological construct mentioned in [5], suggesting that emotion vectors may capture an inherently different geometry depending on the model family, such as the Gemma 4 family. We must remark that our previous claim is favored by a discussion thread found on HuggingFace1, which argues that a greater story sample count, and a larger emotion list, generates similar results to the ones reported by ourselves and [2].
The cosine similiarity heatmaps for both openai-community/gpt-2-medium and google/gemma-4-E2B display related emotion clusters even with a list of 9 emotions. The clustering effect is more pronounced with our list of 20 emotions, where emotions such as "calm", "loving", and "happy" have noticeable red/orange colorings between each other. This clustering heatmap effect is concordant to the results reported by [1][2][5]. The similarity heatmaps appear to follow a similiar grouping effect displayed on the PCA plots discussed previously.
Finally, our results from the emotion steering experiments strengthen the claim of [5] that emotion vectors causally influence the model's outputs. To our knowledge, the replication of [1] is the only existing attempt at the steering effects. While they collected vast amounts of evidence, there are not any plots similar to the steering heatmaps found in the Appendix of [5]. We believe that our replication attempt of the aformentioned heatmaps facilitates the understanding of the interventions done in openai-community/gpt-2-medium and google/gemma-4-E2B. The heatmap for openai-community/gpt-2-medium displays that matches of steered vectors with their respective token sets (e.g. "happy", [joyful, joy, ecstatic, ...]) do augment their likelyhood from the baseline response. In particular, openai-community/gpt-2-medium seems to have sparse likelihood activations of related emotions. We can assume that the model is not as capable at discerning the most appropiate token set to activate in accordance to the requested prompt, which is supported by the baseline (unsteered) generated text from the input prompt. What is interesting is that the generated text from a particular steering intervention seems to capture the semantical concept of the steered emotion.
In a similar vein, our steering results for google/gemma-4-E2B suggest that the model can handle the input prompt of the intervention with greater ease, and steering augments the likelihood of most matches with moderate strenght. The baseline generated text response handles the request with no signs of broken text behaviour like openai-community/gpt-2-medium, and that steered text generations semantically reflect the desired emotion. One particular highlight is that our steering heatmap of 20 emotions shows that "disgusted" deactivates all tokens sets. Further research is required to explain why that is the case.
Overall, our partial findings support the claims of [5], and it is remarkable to highlight their achieved replicability on models not related to the Claude family. Although our results may be interpreted as solid evidence, we must express caution and skepticism because our limited methodology scope might have altered the presented structures in terms of fidelity and resolution.
Conclusion
The described findings suggest that emotion vectors can be extracted from openai-community/gpt-2-medium and google/gemma-4-E2B, and can causally influence their responses if steered with the aformentioned vectors. This is supported by other replications accomplished by the online enthusiast community. Albeit antiquated for modern standards, openai-community/gpt-2-medium displays an emergence of the described vectors and strong steering effects when intervened with them. In constrast, google/gemma-4-E2B has moderate steering strength. In conclusion, we can ascertain that emotion vectors are present on models not related to the Claude family, and the results found for Claude Sonnet 4.5 can be replicated with noticeable similarity. We argue that emotion vectors may be a fundamental property of large language models, and their causal steering effects might facilitate the understanding of their decision-making. We encourage academics, professionals, and hobbyists alike to advance this line of research that may uncover additional properties than the ones documented on the current writing.
License
MIT License
Acknowledgment of AI Usage
We hereby state that both ChatGPT and Gemini were utilized for the analysis, interpretation, and code development of the data pipeline. In particular, ChatGPT1 facilitated the comprehension and further augmentation of the emotion probe codebase found in [2], while Gemini2 assisted in the initial understanding of the emotion vector publication [5], including the emotion story generation.
1 Full conversation available at
./research_data/conversationChatGPT-Emotion-Mapping-Framework.md
2 Full conversation available at
./research_data/conversationGemini-Replicating-Emotion-Vectors-in-LLMs.md
Citation
@misc{
flores2026emotionvectorreplication,
title = {Partial Replication of Anthropic's Emotion Vectors using Gemma 4 E2B and GPT 2 Medium inside a Google Colab T4 Notebook},
author = {Flores A., Abraham J.},
year = {2026},
month = {May},
url = {https://github.com/NotsoJharedtrollOx17/EmotionVectorExtraction-Gemma4-GPT2/tree/main},
note = {This replication is the first independent replication of Anthropic's Emotion Vectors utilizing GPT 2 Medium}
}
References
[1] ewernn, “traininterp,” 2026, Available: https://github.com/ewernn/traitinterp
[2] Y. Hsieh, “Replicating Anthropic’s Emotion Vectors on OpenSource Models: Evidence from Gemma4E4B,” 2026, Available: https://huggingface.co/rain1955/emotionvectorreplication
[3] A. Radford et al., “Language models are unsupervised multitask learners,” OpenAI blog, vol. 1, no. 8, p. 9, 2019.
[4] Google Deepmind, “Gemma 4 Model Card,” 2026, Available: https://ai.google.dev/gemma/docs/core/model_card_4
[5] N. Sofroniew et al., “Emotion Concepts and their Function in a Large Language Model,” Transformer Circuits Thread, 2026, Available: https://transformercircuits.pub/2026/emotions/index.html
[6] Anthropic, “System Card: Claude Sonnet 4.5,” 2025, Available: https://www.anthropic.com/claudesonnet45systemcard