Source-linked AI summary
Unveiling Language-Specific Features in Large Language Models via Sparse Autoencoders
Boyi Deng, Yu Wan, Yidan Zhang, Baosong Yang, Fuli Feng
TL;DR
Existing neuron- and activation-based approaches to studying multilingual LLM mechanisms face reliability challenges. This paper uses sparse autoencoders to identify language-specific features and assess their monolinguality; ablating them selectively affects language capabilities, and using them to gate steering vectors improves language control.
Problem
Neuron-based and internal-activation-based methods for studying multilingual LLM mechanisms face reliability challenges from superposition and layer-wise activation variance.
Source: §1 · p. 1Method
The paper uses SAEs to analyze multilingual capabilities, proposes a feature-monolinguality metric, and uses language-specific features to gate steering vectors.
Source: §1 · p. 2Results
Some SAE features relate to language-specific tokens and linguistic context; ablating them selectively reduces target-language capabilities, with synergistic effects for some feature combinations.
Source: §1 · p. 2Takeaways & Limitations
Language-specific SAE features can serve as gating signals that improve control over the language generated by LLMs.
Source: §1 · p. 2The evaluation covers 10 languages but does not yet include certain low-resource languages.
Source: Limitations · p. 9
Abstract
from arXiv · showhide
The mechanisms behind multilingual capabilities in Large Language Models (LLMs) have been examined using neuron-based or internal-activation-based methods. However, these methods often face challenges such as superposition and layer-wise activation variance, which limit their reliability. Sparse Autoencoders (SAEs) offer a more nuanced analysis by decomposing the activations of LLMs into a sparse linear combination of SAE features. We introduce a novel metric to assess the monolinguality of features obtained from SAEs, discovering that some features are strongly related to specific languages. Additionally, we show that ablating these SAE features only significantly reduces abilities in one language of LLMs, leaving others almost unaffected. Interestingly, we find some languages have multiple synergistic SAE features, and ablating them together yields greater improvement than ablating individually. Moreover, we leverage these SAE-derived language-specific features to enhance steering vectors, achieving control over the language generated by LLMs. The code is publicly available at https://github.com/Aatrox103/multilingual-llm-features.
1 Introduction
Growing multilingual deployment makes it important to understand how LLMs represent language, but existing neuron- and activation-based analyses have reliability challenges. The paper uses SAEs to identify language-specific features, tests their effects on capabilities, and applies them to steering vectors.
1 Introduction
- Neuron-based analyses can be unreliable because of superposition, while activation-based analyses can err across layers because activation distributions vary.The authors motivate a more reliable and interpretable approach to analyzing multilingual capabilities.Source: §1 · p. 1
- SAEs decompose activations into sparse combinations of features and support token-level analysis and separate training for each layer.The authors argue that these properties make SAEs more interpretable and reliable than existing approaches.Source: §1 · pp. 1–2
- SAE features relate to language-specific tokens and linguistic context; ablating them reduces capabilities in the target language, and some features have synergistic effects when ablated together.The combined effects can exceed those of individual feature ablations.Source: §1 · p. 2
- The authors propose a metric for feature monolinguality and find SAE features with strong language-specific characteristics.They also use a code-switching dataset to examine the association between features and language-specific linguistic context.Source: §1 · p. 2
- Using language-specific SAE features as steering-vector gates yields better control over the language generated by LLMs.The authors present this as evidence of the features' practical potential.Source: §1 · p. 2
2 Preliminary
This section introduces SAEs, the multilingual data and models used, and preliminary evidence that SAE features can be language-associated.
SAEs
- SAEs decompose layer activations into sparse combinations of learned feature directions, with each decoder-matrix column treated as a feature.The paper uses residual-stream activations as the input because they are considered more interpretable.Source: §2 · p. 2
Datasets
- Flores-10 is a ten-language subset of Flores-200, a parallel corpus of English sentences translated into 200 languages.The ten languages are English, Spanish, French, Japanese, Korean, Portuguese, Thai, Vietnamese, Chinese, and Arabic.Source: §2 · p. 2
Models
- The study uses Gemma Scope SAEs for Gemma 2 2B and 9B, and Llama Scope SAEs for Llama-3.1-8B.Source: §2 · p. 2
Preliminary observations
- In layer 20 of Gemma 2 2B, top-four features have higher ν than a random feature, and the top-ranked feature is significantly higher in most languages.The random feature's value is too small to be visible.Source: Figure 1 · p. 3
- Feature 13788 has high mean activation in Chinese in layer 10 of Gemma 2 2B, suggesting it may be related to Chinese.Source: Figure 2 · p. 3
3 Language-Specific Features
The section identifies language-specific features by comparing their activations across languages, then examines how Spanish prefixes affect feature activation for non-Spanish nouns.
3.1 Finding Language-Specific Features
- The proposed ν metric compares a feature's mean activation for one language with its mean activation across the other languages, then ranks features by ν.Source: §3.1 · p. 3
3.2 Monolinguality Analysis
- Top-ranked features show strong monolingual characteristics, with the top-1 feature sufficient in most scenarios.The analysis calculates ν using the first 100 Flores-10 data points per language; some languages also have a notably high-ranked second feature.Source: §3.2 · p. 3
- Adding a Spanish prefix raises Spanish-feature activation for French and Korean nouns, though it remains below the Spanish-prefix-plus-Spanish-noun combination.Source: Figure 3 · p. 4
4 Language-Specific Features Extend Beyond Language-Specific Tokens
Language-specific features respond to linguistic context, not only to the language of individual tokens. In code-switching tests, a Spanish prefix shifts non-Spanish nouns’ language-feature activations toward Spanish and away from their original language.
4.1 Experimental Settings
- The code-switching test uses generated sentences ending in a noun, which is replaced by its equivalent in another language.For each language, the authors generate five sentences with eight noun-substitution variants and compare ending-noun feature activation with and without a prefix.Source: §4.1 · p. 4
4.2 Results
- Spanish prefixes raise Spanish-feature activation on French and Korean nouns while lowering their original-language feature activation, especially in deeper layers.The Spanish-feature increase and original-feature decrease are larger for French than Korean nouns; Spanish-prefix nouns still show more Spanish-feature activation than non-Spanish nouns alone.Source: §4.2 · pp. 4–5
4 Language-Specific Features Extend Beyond Language-Specific Tokens
- Language-specific features are associated with linguistic context as well as language-specific tokens, as code-switching results indicate.The reported Spanish-prefix effects are more pronounced on French than Korean nouns, a difference the authors suggest may reflect linguistic similarity.Source: §4 · p. 4, §4.2 · p. 5
5 Ablating Language-Specific Features Leads to Language-Specific Changes
Directional ablation of language-specific features affects target-language text more than text in other languages, with effects varying across layers. Ablating multiple features together can produce a language-specific synergistic effect.
5.1 Model Interventions
- Directional ablation removes a feature’s projection from the residual-stream activation, then continues the forward pass with the modified activation.The intervention is applied to the top two language-specific features for each target language, layer, and model.Source: §5.1 · p. 5, §5 · p. 5, §5.2 · p. 5
5.2 Ablation of Language-Specific Features
- Ablating top-2 language-specific features has a much larger CE-loss impact on target-language text than on other languages, with effects varying significantly by layer.The authors conclude that ablation can reduce a specific language capability while leaving other language capabilities less affected.Source: §5.2 · pp. 5–6
5.3 Synergistic Language Features
- Joint ablation of the top two French features has a greater-than-additive CE-loss impact in French, but not in Spanish or Japanese.Spanish effects are large in some layers, where the rank-2 French feature is also among Spanish’s top two; Japanese effects are nearly zero across layers.Source: Figure 6 · p. 6, §5.3 · p. 6
6 Enhancing Steering Vectors Using Language-Specific Features
The paper uses language-specific SAE features to gate steering vectors during inference. The SAE-enhanced method performs better than standard steering vectors on cross-lingual continuation in most cases and offers a better balance on adversarial language identification.
6.1 Experimental Settings
- Evaluation covers language identification and cross-lingual continuation, measuring target-language identification CE loss, continuation success rate, and CE loss on other languages.For continuation, a language-identification model verifies whether generated text is in the target language.Source: §6.1 · p. 6
6.2 Methods
- SAE feature activations gate whether a steering vector is added to a token, targeting language-specific tokens and limiting excessive adjustments across layers.The method adds the vector when either of the top two features for the vector’s source language is active.Source: §6.2 · p. 7
6.3 Results
- On adversarial language identification, SAE performance improves as more layers are modified while SV performance declines, and SAE has a smaller increase in other-language CE loss.In most cases, SAE across three consecutive layers has lower other-language CE loss than SV across one layer.Source: Figure 8 · p. 7, §6.3 · pp. 7–8
- SAE 3L outperforms SV 1L on cross-lingual continuation in both success rate and CE loss in most cases, though some cases trade lower CE loss for lower success rate.The paper reports this comparison across languages and models and notes that the two metrics can trade off.Source: Table 1 · p. 8, §6.3 · p. 8
7 Related Works
Related work studies multilingual mechanisms through neuron-based and intermediate-activation methods, while SAEs decompose activations into potentially interpretable feature directions.
Related Work
- Neuron-based studies identify or modify language-specific neurons, but superposition can make these methods complex and unreliable.The cited work includes findings that removing some neurons decreases performance in certain languages.Source: §7 · p. 8
- Logit-lens methods use the output unembedding matrix to infer intermediate token distributions, but layer-varying residual-stream distributions can make results unreliable outside the last few layers.Prior work reports both English and Japanese use in intermediate layers.Source: §7 · p. 8
- SAEs decompose model activations into feature directions in a higher-dimensional latent space that may be more interpretable than individual neurons.Prior examples include features associated with apostrophes and features indicating entity recognition.Source: §7 · p. 8
8 Conlusion
The study uses SAEs to analyze multilingual capabilities and introduces a monolinguality metric, finding features strongly tied to specific languages. Directional ablation and steering-vector experiments further demonstrate their role in language-specific capabilities and control.
8 Conlusion
- Language-specific SAE features are strongly tied to particular languages, and directional ablation confirms their significant role in language-specific capabilities.Source: §8 · pp. 8–9
- Ablating multiple features together yields greater improvements than ablating individual features.Source: §8 · p. 9
- SAE-derived features improve steering vectors, with better performance and robustness reported.Source: §8 · p. 9
Limitations
The study identifies limits in language coverage, steering-vector performance, and SAE training data. Its experiments use specified SAEs and a 10-language Flores-10 subset.
Limitations
- The method covers 10 languages but not certain low-resource languages; SAE steering vectors fall short in some cases, and the SAEs were not trained on curated multilingual data.The authors identify these as areas for future work.Source: Limitations · p. 9
A Implementation Details
- Experiments use no generation sampling; Gemma Scope SAEs are selected by the second-smallest L0 value per layer, while Llama Scope uses a specified model.Source: A Implementation Details · p. 12
B Flores-10
- Flores-10 comprises 10 languages; the first 100 dev examples per language identify features and generate steering vectors, while 500 non-overlapping examples evaluate steering.Source: B Flores-10 · p. 12
C Additional Results of ν
Additional results report that top-ranked features show strong monolingual characteristics, often captured by the top feature alone. Further appendix sections report directional-ablation and code-switching results as similar to earlier figures.
C Additional Results of ν
- Top-ranked features show strong monolingual characteristics, and the top-1 feature usually suffices to capture them across the reported layer levels and models.Source: C Additional Results of ν · p. 12
D Additional Results for Directional Ablation
- Additional directional-ablation results show a larger CE-loss impact on target-language texts than on texts in other languages.The passage reports this pattern for three LLMs.Source: D Additional Results for Directional… · p. 12
E Additional Results for Code-Switching
- Additional code-switching results are reported as similar to those in Figures 3 and 4.Source: E Additional Results for Code-Switching · p. 12
F Additional Results for Multiple Features
The appendix reports additional multiple-feature results as similar to Figure 6. Figures 34–42 cover CE-loss changes across languages after Spanish, French, and Thai feature ablations in three LLMs.
F Additional Results for Multiple Features
- The additional multiple-feature results are described as similar to Figure 6.Source: F Additional Results for Multiple… · p. 12
- For Gemma 2 2B, figures show CE-loss changes across languages after Spanish, French, or Thai feature ablation.Source: Figure 34 · p. 38, Figure 35 · p. 39, Figure 36 · p. 40
- For Gemma 2 9B, figures show CE-loss changes across languages after Spanish, French, or Thai feature ablation.Source: Figure 37 · p. 41, Figure 38 · p. 42, Figure 39 · p. 43
- For Llama-3.1-8B, figures show CE-loss changes across languages after Spanish, French, or Thai feature ablation.Source: Figure 40 · p. 44, Figure 41 · p. 45, Figure 42 · p. 46