Cross-lingual Functional Vectors for Emotion Detection in Large Language Models
Organizations: Japan Advanced Institute of Science and Technology
Abstract
Function vectors (FVs) have recently emerged as a promising mechanism for steering the behavior of large language models (LLMs) by injecting task-specific latent direction representations derived from in-context demonstrations. While prior studies have shown that FVs can recover task behavior in structured in-context learning settings, their effectiveness on semantically complex tasks and their ability to generalize across languages remain underexplored. We investigate the cross-lingual transferability of FVs using multilingual multi-label emotion recognition as a challenging semantic classification benchmark. Specifically, we examine whether FVs extracted from a source language can steer task behavior in another language under both standard clean and perturbed zero-shot settings without providing demonstrations during inference. Across diverse cross-lingual settings, applying FVs substantially improves performance, suggesting that FVs capture language-agnostic, task-relevant signals rather than purely language-specific lexical patterns, and highlighting their potential as a lightweight and transferable mechanism for multilingual task adaptation. We observe that each LLM exhibits a relatively stable optimal range of attention heads for constructing effective FVs, and the pattern remains consistent across languages. In addition, FVs can partially replicate the task-steering effects of standard few-shot in-context learning while avoiding the computational overhead of processing multiple demonstrations, making them effective for large-scale practical applications. Our code is available at https://github.com/yingjie7/cross_lingual_fvs.
Figures & tables
| Language | Train | Dev | Test | Total |
|---|---|---|---|---|
| Chinese (ZH) | 2,642 | 200 | 2,642 | 5,484 |
| German (DE) | 2,603 | 200 | 2,604 | 5,407 |
| English (EN) | 2,768 | 116 | 2,767 | 5,651 |
| Spanish (ES) | 1,996 | 184 | 1,695 | 3,875 |
| Russian (RU) | 2,679 | 199 | 1,000 | 3,878 |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| w/o FV | 36.4 | 16.9 | 18.4 | 41.4 | 52.5 |
| (+FVs) | |||||
| EN | 53.7 ±1.4 | 44.1 ±0.6 | 44.2 ±0.6 | 62.4 ±1.0 | 72.1 ±2.8 |
| DE | 50.5 ±0.8 | 41.9 ±0.9 | 43.3 ±0.6 | 60.3 ±1.4 | 70.7 ±3.5 |
| ZH | 51.5 ±1.1 | 41.3 ±1.4 | 43.5 ±0.2 | 60.5 ±1.2 | 71.2 ±1.2 |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| w/o FV | 0.6 | 0.5 | 0.0 | 8.0 | 1.8 |
| (+ FVs) | |||||
| EN | 48.6 ±1.7 | 38.2 ±0.9 | 41.4 ±0.7 | 51.8 ±2.6 | 58.9 ±3.2 |
| DE | 45.4 ±1.8 | 35.6 ±1.2 | 40.7 ±1.3 | 49.4 ±1.8 | 57.8 ±2.9 |
| ZH | 46.3 ±1.7 | 36.2 ±1.0 | 42.2 ±0.7 | 51.0 ±1.5 | 58.8 ±3.2 |
| (Example 1) |
| Sentence: “My heart dropped and I just replied ‘No.’ ” |
| Gold Label: fear |
| Zero-shot Output (without FVs): yellow |
| Zero-shot Output (with FVs): fear |
| (Example 2) |
| Sentence: “I slammed my fist against the door and yelled, Open up!” |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| Previous works | |||||
| PAI ∗ | 82.3 | 73.9 | 70.9 | 84.8 | 88.2 |
| JNLP ∗ | 80.4 | 69.9 | 68.1 | 83.0 | 89.1 |
| This work | |||||
| w/o FV | 66.6 | 64.1 | 54.1 | 71.6 | 73.9 |
| Demo. Lang. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| EN | 66.6 | 45.2 | 49.0 | 68.8 | 65.9 |
| DE | 61.6 | 64.1 | 53.7 | 70.5 | 74.0 |
| ZH | 52.9 | 45.3 | 54.1 | 54.0 | 67.7 |
| ES | 59.2 | 53.3 | 50.4 | 71.6 | 77.4 |
| RU | 51.8 | 44.9 | 53.0 | 55.9 | 73.9 |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| w/o FV | 36.4 | 16.9 | 18.4 | 41.4 | 52.5 |
| (+ FVs) | |||||
| EN | 52.9 ±1.3 | 43.7 ±0.6 | 43.7 ±0.4 | 61.6 ±1.1 | 71.2 ±1.5 |
| DE | 52.2 ±0.8 | 43.3 ±0.6 | 44.6 ±0.7 | 62.2 ±0.9 | 74.4 ±1.4 |
| ZH | 50.3 ±0.3 | 42.4 ±1.8 | 44.3 ±0.6 | 61.6 ±0.8 | 73.3 ±1.0 |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| You are a multi-label emotion classification system. Each sentence contains zero or more emotions from the following list: anger, fear, joy, sadness, surprise, or none. |
| ### Emotions: anger, fear, joy, sadness, surprise, or none |
| ### Input: For many months I learned to shower keeping my elbows close to prevent water from hosing off the ends and totally drenching the place. |
| ###Answer: fear |
| … {{demonstrations}} … |
| ### Colors: yellow, red, blue or none |
| ### Nation: China, USA, Germany, England or none |
| ### Emotions: anger, fear, joy, sadness, surprise, or none |
| ### Input: Ich kenne keinen Staat, der Menschen, die unter seiner Herrschaft leben so unmenschlich behandelt wie. |
| ###Answer: |
| You are a multi-label emotion classification system. Each sentence contains zero or more emotions from the following list: anger, fear, joy, sadness, surprise, or none. |
| ### Emotions: anger, fear, joy, sadness, surprise, or none |
| ### Input: Ich kenne keinen Staat, der Menschen, die unter seiner Herrschaft leben so unmenschlich behandelt wie. |
| ###Answer: |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| w/o FV | 14.1 | 12.9 | 8.4 | 29.1 | 35.5 |
| (+ FVs) | |||||
| EN | 40.9 ±4.2 | 30.4 ±4.5 | 38.7 ±2.0 | 49.1 ±2.3 | 46.7 ±5.6 |
| DE | 42.8 ±6.3 | 34.4 ±4.3 | 40.0 ±2.0 | 49.7 ±4.1 | 51.4 ±4.9 |
| ZH | 44.3 ±4.4 | 34.5 ±2.4 | 40.4 ±1.6 | 49.2 ±2.0 | 49.2 ±3.6 |
| FVs Src. | Target Language | ||||
|---|---|---|---|---|---|
| EN | DE | ZH | ES | RU | |
| w/o FV | 36.1 | 18.9 | 12.7 | 31.0 | 21.9 |
| (+ FVs) | |||||
| EN | 39.6 ±2.7 | 29.1 ±2.1 | 35.3 ±1.2 | 44.4 ±2.7 | 42.4 ±5.9 |
| DE | 41.0 ±1.6 | 29.5 ±1.7 | 35.3 ±1.4 | 45.7 ±1.5 | 47.7 ±5.6 |
| ZH | 41.3 ±1.4 | 29.4 ±0.5 | 33.3 ±2.9 | 44.2 ±0.3 | 45.4 ±2.8 |