HyperAIHyperAI

Command Palette

Search for a command to run...

LLM
Transformer

Le Llama pense-t-il en anglais ? Sur le langage latent des transformeurs multilingues

Chris Wendler Veniamin Veselovsky Giovanni Monea Robert West

Résumé

Nous nous demandons si les modèles de langue multilingues entraînés sur des corpus déséquilibrés dominés par l'anglais utilisent l'anglais comme langue pivot interne — une question d'une importance capitale pour comprendre le fonctionnement des modèles de langue et l'origine des biais linguistiques. En nous concentrant sur la famille de modèles transformer Llama-2, notre étude utilise des requêtes non anglaises soigneusement construites, dotées d'une continuation mono-token correcte et unique. De couche en couche, les transformeurs appliquent progressivement une transformation qui envoie la représentation d'entrée du dernier token de la requête vers une représentation de sortie à partir de laquelle les probabilités du token suivant sont calculées. Le suivi des représentations intermédiaires dans leur espace de grande dimension révèle trois phases distinctes, au cours desquelles les représentations intermédiaires (1) démarrent loin des représentations des tokens de sortie ; (2) permettent déjà un décodage sémantiquement correct du token suivant dans les couches intermédiaires, mais attribuent une probabilité plus élevée à sa version anglaise qu'à sa version dans la langue d'entrée ; (3) migrent enfin vers une région de l'espace de représentation spécifique à la langue d'entrée. Nous reformulons ces résultats sous la forme d'un modèle conceptuel où les trois phases opèrent respectivement dans un « espace d'entrée », un « espace conceptuel » et un « espace de sortie ». Crucialement, nos preuves suggèrent que l'espace conceptuel abstrait est plus proche de l'anglais que des autres langues, ce qui pourrait avoir des conséquences importantes quant aux biais portés par les modèles de langue multilingues. Le code et les données sont disponibles ici : https://github.com/epfl-dlab/llm-latent-language.

One-sentence Summary

EPFL researchers track intermediate embeddings across layers of Llama-2 multilingual transformers, revealing a three-phase progression from input space through concept space to output space in which the concept space lies closer to English than to other languages, suggesting a key source of linguistic bias in multilingual models.

Key Contributions

  • Provides an empirical diagnostic for testing whether Llama-2 uses English as an internal pivot language by constructing non-English prompts with unique correct single-token continuations and tracking intermediate token embeddings across transformer layers.
  • Proposes a three-phase conceptual model of multilingual generation, where embeddings pass from input space through concept space to output space, and shows that the intermediate concept space lies closer to English than to the input language, suggesting a latent source of linguistic bias.
  • Releases code and data for the embedding-tracking analysis, enabling replication and further study of how multilingual language models process non-English inputs through language-dependent internal states.

Introduction

Most modern large language models are trained on corpora dominated by English, yet they perform well in many non-English languages. This raises an important question: do LLMs implicitly use English as an internal pivot language when processing non-English prompts? The answer matters because an implicit English pivot could introduce Anglocentric biases in vocabulary, grammar, metaphors, emotional tone, and reasoning, while its absence would suggest that models rely on other mechanisms for strong multilingual performance.

Prior work often assumes that such an internal English pivot exists, and earlier methods explicitly use English as a translation or reasoning bridge. However, directly testing this assumption is difficult because LLMs represent internal states as high-dimensional numerical vectors rather than discrete language tokens. Mechanistic interpretability tools offer some visibility into model internals, but methods such as the tuned lens may obscure the question by learning mappings that erase the very signal of an intermediate English state.

The authors address this gap by using the logit lens on Llama-2 models. They decode intermediate token probabilities and track which language dominates at different layers. They find that middle layers often produce English versions of the intended next token before the model finally generates the correct non-English output. They also analyze latent embeddings directly and argue that the model’s behavior is better explained by an English-leaning concept space in middle layers, rather than a literal translation step back to English.

Dataset

  • The authors create a small, task-based prompt dataset rather than a large natural-language corpus. It is built to probe Llama-2's internal states by asking the model to produce a next token that is easy to infer and clearly attributable to a target language.

  • Main source: Llama-2's vocabulary. For Chinese, they select single-token Chinese words, mostly nouns, whose English translations are also single tokens. This lets the next-token probabilities for the Chinese word and its English analog be compared directly.

  • Additional languages: German, French, and Russian. The Chinese and English words are translated into these languages, and any translated word that shares a token prefix with the English version is removed to prevent ambiguous language detection.

  • Scale: 139 Chinese, 104 German, 56 French, and 115 Russian words.

  • Task composition: three prompt types are constructed from these words. Translation prompts show four word pairs and ask for the missing translation. Repetition prompts ask the model to repeat the last word. Cloze prompts ask the model to fill a masked target word in a translated sentence.

  • Prompt construction: for translation and repetition, demonstrations are randomly sampled from the remaining words in the same language. For cloze, GPT-4 first generates an English sentence starting with the target word; the target word is masked, the sentence is translated into the target language, and two demonstrations are sampled from the remaining words.

  • Prompt schema: each example includes the target language, a series of prompt tokens, a set of demonstrations or a masked sentence, and an expected next token that should reveal the latent language.

  • Usage: the authors use the dataset to map latent vectors and next-token distributions to specific languages, avoiding generic tools like token distributions alone because many tokens are language-ambiguous. The prompts are used for probing and evaluation across Chinese, German, French, and Russian, not as a training mixture.

Method

The authors leverage Llama-2, an autoregressive decoder-only transformer. The architecture represents each input token xi∈Vx_i \in Vxi​∈V as a latent vector hi(0)∈Rdh_i^{(0)} \in \mathbb{R}^{d}hi(0)​∈Rd from a learned embedding dictionary. Across mmm layers, each latent is updated through a residual transformer block fjf_jfj​,

hi(j)=hi(j−1)+fj(h1(j−1),…,hi(j−1)),h_i^{(j)} = h_i^{(j-1)} + f_j(h_1^{(j-1)}, \ldots, h_i^{(j-1)}),hi(j)​=hi(j−1)​+fj​(h1(j−1)​,…,hi(j−1)​),

where each fjf_jfj​ contains masked self-attention, a feed-forward network, and root mean square normalization. Because of this normalization, each latent lies on a ddd-dimensional hypersphere of radius d\sqrt{d}d​. During pretraining, the transformer blocks are tuned so that the final latent hi(m)h_i^{(m)}hi(m)​ can predict the next token. At inference, the final latent is multiplied by the unembedding matrix U∈Rv×dU \in \mathbb{R}^{v \times d}U∈Rv×d, producing logits zi=Uhi(m)z_i = U h_i^{(m)}zi​=Uhi(m)​, and the softmax operation yields

P(xi+1=t∣x1,…,xi)∝ezit.P(x_{i+1}=t \mid x_1,\ldots,x_i) \propto e^{z_{it}}.P(xi+1​=t∣x1​,…,xi​)∝ezit​.

For interpretation, the authors leverage the logit lens. Since all layer latents have the same shape, an intermediate latent can be treated as if it were a final-layer latent. Applying the unembedding matrix to hn(j)h_n^{(j)}hn(j)​ gives a premature next-token distribution at position nnn and layer jjj. To interpret these distributions as language-specific, the authors build prompts that force a clear next token and attach the target token unambiguously to one language. They use three controlled tasks: translation, repetition, and cloze completion. Each prompt contains few demonstrations, followed by a target context that makes the next word predictable. The target vocabulary is filtered so that the correct next token in the target language and its English counterpart are single-token entries, while words that share token prefixes with the English form are excluded. This makes it possible to read language evidence directly from the token probabilities.

The method then converts intermediate logits into language probabilities. For a target language ℓ\ellℓ, with tℓt_\elltℓ​ denoting the correct single-token word in that language, the authors define

P(lang=ℓ∣hn(j)):=P(xn+1=tℓ∣hn(j)).P(\text{lang}=\ell \mid h_n^{(j)}) := P(x_{n+1}=t_\ell \mid h_n^{(j)}).P(lang=ℓ∣hn(j)​):=P(xn+1​=tℓ​∣hn(j)​).

These values are not normalized across languages, so their sum may be below one. This construction lets the pipeline compare, layer by layer, whether the latent is leaning toward the input language, English, or another language.

To explain the depth-wise evolution, the authors characterize the latent trajectory through embedding space. They track entropy of the logit-lens distribution, token energy, and estimated language probabilities across layers. Token energy measures how much a latent is aligned with output token embeddings, which indicates how ready the latent is for next-token prediction. The analysis is described through three phases. In the first phase, the latent builds a richer feature representation of the current input and remains largely unrelated to output token space, producing high entropy and low token energy. In the second phase, the latent enters an abstract concept space, where it becomes closer to output embeddings that express the concept across languages, producing low entropy while still retaining contextual and language information. English tokens tend to receive higher probability in this phase because English output embeddings are closer to the concept representation after the model’s English-dominated pretraining. In the third phase, the latent maps the concept onto a concrete output token in the target language, discarding information that is less useful for immediate prediction, which raises token energy. This three-stage view is visualized below, where the latent trajectory is represented on a hypersphere while layerwise entropy, token energy, and language probabilities are shown alongside.

Experiment

The experiments examine Llama-2 models on translation, cloze, and repetition tasks across languages and sizes, using the logit lens to inspect layer-wise next-token probabilities and geometric latent analyses to characterize intermediate representations. The results show a consistent pattern where early layers are broadly noncommittal, middle layers increasingly favor English-associated representations, and later layers shift toward the target language, while dimensionality-reduction paths reveal an apparent detour through an English-like subspace. Together, these findings support an English-biased internal organization, but suggest that the pivot is better understood as semantic concept space rather than purely lexical English, with the effect varying by task and tokenization.

The logit lens shows that intermediate layers decode an English form of the target meaning, while the final layer ranks the correct Chinese word, suggesting an English detour in the latent space. The surrounding context links stronger English detours to less favorable tokenization coverage, noting that single token target words reduce this effect. Intermediate layers reveal English flower related tokens before the final Chinese output. Language specific token availability is associated with a less pronounced English detour.

Using logit lens probing, the experiments examine how target meanings are represented across layers when producing Chinese output. They find that intermediate layers often surface English or English related tokens before the final layer selects the correct Chinese word, supporting the presence of an English detour in the latent space. This detour appears weaker when language-specific tokens are more available, especially for single-token targets, indicating that tokenization coverage influences the internal translation pathway.


Créer de l'IA avec l'IA

De l'idée au lancement — accélérez votre développement IA avec le co-codage IA gratuit, un environnement prêt à l'emploi et le meilleur prix pour les GPU.

Codage assisté par IA
GPU prêts à l’emploi
Tarifs les plus avantageux

HyperAI Newsletters

Abonnez-vous à nos dernières mises à jour
Nous vous enverrons les dernières mises à jour de la semaine dans votre boîte de réception à neuf heures chaque lundi matin
Propulsé par MailChimp