Source-linked AI summary
On the Multilingual Ability of Decoder-based Pre-trained Language Models: Finding and Controlling Language-Specific Neurons
Takeshi Kojima, Itsuki Okimura, Yusuke Iwasawa, Hitomi Yanaka, Yutaka Matsuo
TL;DR
How decoder-based PLMs handle multilingualism at the neuron level remains unclear, especially for language-specific neurons. The paper identifies such neurons across languages and models and intervenes on them during inference. These neurons cluster in the first and last few layers, and intervention changes target-language occurrence in generated text.
Problem
How decoder-based PLMs handle multilingualism at the neuron level remains unclear, with few studies examining language-specific neurons in these models.
Source: §1 · p. 1Method
Results
Language-specific neurons mainly occur in the first and last few layers across languages, model sizes, and variants, and intervention changes target-language occurrence.
Source: §6 · p. 9Takeaways & Limitations
The identified neurons provide an inference-time means of changing the probability of target-language occurrence in generated text.
Source: §6 · p. 9The analysis covers six languages and publicly available open models; closed models and encoder-decoder PLMs remain outside its scope.
Source: §7 · p. 9
Abstract
from arXiv · showhide
Current decoder-based pre-trained language models (PLMs) successfully demonstrate multilingual capabilities. However, it is unclear how these models handle multilingualism. We analyze the neuron-level internal behavior of multilingual decoder-based PLMs, Specifically examining the existence of neurons that fire ``uniquely for each language'' within decoder-only multilingual PLMs. We analyze six languages: English, German, French, Spanish, Chinese, and Japanese, and show that language-specific neurons are unique, with a slight overlap (< 5%) between languages. These neurons are mainly distributed in the models' first and last few layers. This trend remains consistent across languages and models. Additionally, we tamper with less than 1% of the total neurons in each model during inference and demonstrate that tampering with a few language-specific neurons drastically changes the probability of target language occurrence in text generation.
1 Introduction
Although decoder-based PLMs show multilingual abilities, few studies have examined how language-specific neurons contribute to them. This study analyzes such neurons across models and languages and tests whether intervening on them changes generated-language probabilities.
1 Introduction
- The study asks how decoder-based PLMs exhibit multilingual abilities, including models trained on English-dominant corpora that nevertheless acquire multilingual skills.The introduction contrasts explicitly multilingual pretraining with the incidental inclusion of multiple languages in Llama2's training data.Source: §1 · p. 1
- Because decoder-based models must recover language-specific information during generation, their language-specific processing is a distinct open question from encoder-focused work.The introduction notes that few studies have examined language-specific neurons in decoder-based PLMs.Source: §1 · p. 1
- The identified language-specific neurons are concentrated in the first and last few layers across languages and model variants, and intervening on them changes target-language occurrence during generation.The study examines XGLM, BLOOM, and Llama2 across six languages.Source: §1 · p. 2
2 Related Work
Prior multilingual-neuron research has mainly examined language-universal neurons in encoder-based models, while decoder-based work has focused on shared neurons. Neuron interventions for full-text generation remain less studied than word editing or classification.
2 Related Work
- Research on multilingual internal behavior has mainly identified language-universal neurons in encoder-based PLMs, while decoder-based studies have focused on multilingually shared neurons.Prior studies had not focused on identifying language-specific neurons in either model line.Source: §2 · p. 2
- Neuron interventions have been used for word editing or classification, but full-text generation control has received less study; the authors adopt Cuadros et al. (2022) as an analytical tool.That approach controls generation in Transformer-based decoder models.Source: §2 · p. 2
3 Method
The method adapts an existing neuron-identification and control approach to sentence-level language-specific concepts. It ranks neurons by language-prediction performance, selects both high- and low-ranking neurons, and tests fixed-value interventions during inference.
3 Method
- The authors modify Cuadros et al. (2022)'s approach, originally designed for word-level concepts, to identify and control neurons associated with sentence-level language-specific concepts.Source: §3 · p. 2
3.1 Finding Language-specific Neurons
- For each target language, texts in that language are positive examples and texts in other languages are negative examples, with each neuron's average token activation used as its text-level output.The [PAD] token position is excluded from aggregation as noise.Source: §3.1 · pp. 2–3
- Neurons are ranked by average precision, and both the top- and bottom-1000 are treated as language-specific; embedding and projection layers are excluded.The authors include bottom-ranked neurons to account for strong negative correlations with language labels.Source: §3.1 · p. 3
3.2 Controlling Language-specific Neurons
- During inference, the top- and bottom-ranked neurons are overridden with fixed values set to the median of their outputs on target-language texts.Source: §3.2 · p. 3
4 Experiment Settings
Experiments use XGLM, BLOOM, and Llama2 across six languages, with per-language corpora assembled from PAWS-X and FLORES-200.
4.1 Models
- Experiments compare XGLM and BLOOM, described as multilingual models, with Llama2, trained almost entirely on English text.Llama2 included minimal text in other languages.Source: §4.1 · p. 3
4.2 Datasets
- The study analyzes English, German, French, Spanish, Chinese, and Japanese, limiting the language set to six because of computing resources.These languages were frequently targeted in prior multilingual-model studies and are among the top seven languages in XGLM pretraining data.Source: §4.2 · p. 3
- Per-language corpora combine randomly sampled texts from PAWS-X and FLORES-200 in a 1:1 ratio.PAWS-X supplies paraphrase-identification examples, while FLORES-200 supplies machine-translation examples; the authors cite their quality, variety, and language coverage as reasons for combining them.Source: §4.2 · pp. 3–4
- The experiment uses 500 texts per language, totaling 3,000 texts across the six languages.The authors describe 500 as a reasonable sample size given the tradeoff between computing resources and representation quality.Source: §4.2 · p. 4
5 Results and Discussion
The results identify language-specific neurons with consistent layer placement and little cross-language overlap, then test interventions on those neurons in text generation. Interventions raise target-language occurrence, but translation quality and prompt specification shape the effects.
5.1 Finding Language-specific Neurons
- Language-specific neuron sets overlap by less than 5% for every language pair in XGLM-564M.Table 3 reports the number of overlapping neurons between languages.Source: Table 3 · p. 4, §5.1 · p. 4
- Top- and bottom-ranked neurons concentrate in the first and last few layers, while median-ranked neurons are mainly in middle layers across languages and models.The authors interpret the middle layers as primarily handling language-independent semantic representations, with the first and last layers handling transfer to and from language-specific forms.Source: §5.1 · p. 4
5.2 Controlling Language-specific Neurons
- Neuron intervention increased target-language occurrence in unconditional and conditional generation, while translation-quality gains depended on the model.Conditional-generation accuracy rose for all three model families, but BLEU increased drastically for Llama2 and did not significantly improve for XGLM or BLOOM.Source: Table 4 · p. 6, §5.2.1 · p. 6, Table 5 · p. 7
5.2.1 Unconditional text generation
- Intervening in both top- and bottom-ranked neurons can control language when intervention in either group alone does not work for some languages.The top-k and bottom-k groups correlate with positive and negative activation values, respectively.Source: §5.2.1 · p. 6, Figure 5 · p. 6
5.2.2 Conditional text generation
- In conditional generation, accuracy improved across XGLM, BLOOM, and Llama2, but translation-quality gains were substantial only for Llama2.XGLM and BLOOM could be forced toward the target language without producing translations; examples included unrelated text or repeated English source text.Source: Table 5 · p. 7, §5.2.2 · pp. 7–8
5.2.1 Unconditional text generation
- Increasing intervention size to 1,000–10,000 neurons generally raises target-language occurrence, but larger interventions degrade text quality and can collapse output.This pattern is reported across languages and model variations.Source: Figure 6 · p. 6, §5.2.1 · p. 7
5.2.2 Conditional text generation
- For Llama-2-7b, interventions improved target-language occurrence and BLEU with ambiguous prompts, but usually changed little when prompts named the target language.The authors suggest explicit target-language wording may already activate specific neurons and offset intervention effects.Source: Table 6 · p. 8, §5.2.2 · p. 8
- Under an explicit Japanese-translation prompt, Chinese-neuron intervention increased Chinese text generation and BLEU; Llama-2-7b also showed relatively high Chinese–Japanese neuron overlap.The authors propose that similar firing patterns and shared character forms may contribute to the exception.Source: §5.2.2 · p. 8
6 Conclusion
The study identifies language-specific neurons in decoder-based multilingual PLMs and examines their inference-time effects; it points to further work on compression and fine-tuning.
6 Conclusion
- Language-specific neurons fire uniquely for each language in decoder-based multilingual PLMs.The study intervenes on these neurons during inference by replacing their output values with fixed activations, changing the probability of target-language occurrence.Source: §6 · p. 9
- These neurons mainly occur in the first and last few layers, across languages, model sizes, and model variants.Source: §6 · p. 9
- Future research directions include language-specific model compression and downstream fine-tuning methods intended to generalize to languages absent from training.One example is fine-tuning only the middle-layer parameters.Source: §6 · p. 9
7 Limitation
The appendix reports neuron-distribution and activation analyses, while the limitation section restricts the study to publicly available open models and six languages.
7 Limitation
- The study is limited to open models with publicly available parameters; it analyzes six languages, and encoder-decoder PLMs remain outside its scope.Source: §7 · p. 9
A Text Examples from Language-Specific Text Corpus
- Figure 7 gives language-specific corpus text examples from a corpus combining FLORES-200 and PAWS-X.Source: A Text Examples from Language-Specific… · p. 11
B.1.1 Histogram
- Figures 8–15 show histograms of language-specific neuron distributions across model layers.Source: §B.1.1 · p. 11
B.1.2 Estimation of Beta Distribution Parameters
- Middle-N neurons have estimated beta-distribution parameters α > 1 and β > 1, indicating language-independent neurons in middle layers.Source: §B.1.2 · p. 11
B.2 Overlapping language-specific neurons between languages.
- Tables 8a–8f count overlapping language-specific neurons between languages.Source: Table 8a
B.3 Activation Values of Top and Bottom-1000 Neurons
- Top- and bottom-1000 neurons tend to activate positive values for positive texts and negative values for negative texts, respectively.Source: §B.3 · p. 11
C.1 Effect of Intervention on Generated Language
- Table 9 summarizes target-language occurrence probabilities in generated text before and after intervention.Source: §C.1 · p. 11
C.2 Ablation Study of Changing the Number of Neurons for Intervention
The appendix presents intervention-count ablations, generated-text examples, and settings for unconditional and conditional generation.
C.2 Ablation Study of Changing the Number of Neurons for Intervention
- Figures 22–24 report the ablation study changing the number of neurons intervened on.Source: §C.2 · p. 11
C.3 Model-Generated Text Examples For Unconditional Setting
- Figures 25–35 present unconditional text examples, including outputs without intervention and with top-1000, bottom-1000, or varying numbers of intervened neurons.Source: §C.3 · p. 11
C.4 Detail Setting of Unconditional Text Generation
- Unconditional generation uses random sampling with a maximum output length of 64; XGLM and Llama2 set special tokens automatically, while BLOOM uses an explicitly set </s>.Source: §C.4 · pp. 11–12
D.1 Effect of Intervention on Conditional Text Generation
- Tables 10–12 summarize target-language occurrence probabilities in conditional generation before and after intervention.Source: §D.1 · p. 12
D.2 Model-Generated Text Examples For Conditional Setting
- Figures 36–40 show conditional text examples without intervention and with top-1000 or bottom-1000 neurons intervened on.Source: §D.2 · p. 12
D.3 Detail Setting of Conditional Text Generation
- Conditional generation uses greedy decoding with a maximum output length of 128; translation evaluation uses the first generated line as the translation.Source: §D.3 · p. 12
E Detail Setting of Datasets
The appendix specifies the datasets, BLEU-4 measurement procedure, and listed model license information.
E Detail Setting of Datasets
- The language-specific corpus combines PAWS-X dev and FLORES-200 test data; translation tasks are sampled from FLORES-200, IWSLT2017, and WMT test splits.The datasets were downloaded from HuggingFace.Source: E Detail Setting of Datasets · p. 12
F Detail Setting of BLEU-4 metrics
- BLEU uses NLTK with method2 smoothing; XGLM tokenizes texts to support score comparisons across models.The sentence_bleu function is used for unconditional generation and corpus_bleu for conditional generation.Source: F Detail Setting of BLEU-4 metrics · p. 12
G.1 Model
- The appendix lists BLOOM with bigscience-bloom-rail-1.0 and Llama2 with a Meta license.Source: §G.1 · p. 12
G.2 Dataset
The listed datasets have different reuse terms: PAWS-X is free to use, FLORES200 is CC-BY-SA-4.0, and IWSLT2017 is CC-BY-NC-ND-4.0.
G.2 Dataset
- PAWS-X is listed as having no license restriction and being free to use.The entry links to the dataset.Source: §G.2 · p. 12
- FLORES200 is listed under the CC-BY-SA-4.0 license.The entry links to the dataset.Source: §G.2 · p. 12
- IWSLT2017 is listed under the CC-BY-NC-ND-4.0 license.The entry links to the dataset.Source: §G.2 · p. 12
H Total computation for Experiments
The appendix reports the experiment run schedule and computational resources, alongside captions for neuron analyses, intervention studies, and generated-text results.
H Total computation for Experiments
- The production run involved 60 GPU runs per model: six languages, each with identification, six unconditional-generation settings, and three conditional-generation settings.Experiments used ABCI, provided by AIST; the passages mention GPU counts and approximate computing hours but do not supply their values.Source: H Total computation for Experiments · pp. 12–13
- Figures 8–13 each show a histogram of language neurons across layers, covering three xglm variants (564M, 1.7B, 2.9B) and three bloom variants (560m, 1b7, 3b).Source: Figure 8 · p. 15, Figure 9 · p. 16, Figure 10 · p. 17
- Figures 16–21 compare activation-value frequency distributions for the top-1000 and bottom-1000 neurons with the target language on versus off.The captions identify activation value on the x-axis and frequency on the y-axis.Source: Figure 16 · p. 25, Figure 17 · p. 26, Figure 18 · p. 27
- Figures 22–25 vary the number of neurons intervened on and show unconditional-generation examples; Table 9 measures generated-language accuracy with FastText.Table 9 distinguishes top-1000, bottom-1000, and combined interventions, but its caption gives no outcome values.Source: Table 9 · p. 31, Figure 22 · p. 32, Figure 25 · p. 35
- Figure 36 summarizes model-generated text examples from conditional text-generation settings, and Tables 10–12 report conditional text-generation results for IWSLT2017, WMT, and FLORES200.Figure 7 shows text examples from the language-specific text corpus, a mixture of FLORES-200 and PAWS-X.Source: Figure 7 · p. 14, Table 10 · p. 46, Table 11 · p. 47