HyperAIHyperAI

Command Palette

Search for a command to run...

ラマは英語で思考しているのか?――多言語Transformerの潜在言語について

Chris Wendler Veniamin Veselovsky Giovanni Monea Robert West

概要

不均衡な英語優位コーパスで訓練された多言語言語モデルが、英語を内部的な媒介言語として使用しているかどうかという問いは、言語モデルの動作原理や言語的バイアスの起源を理解するうえで重要な問題である。本研究はLlama-2ファミリーのTransformerモデルに焦点を当て、一意な正しい単一トークンの続きが存在するように慎重に設計された非英語プロンプトを用いて検証を行った。Transformerはレイヤーからレイヤーへ入力埋め込みから出力埋め込みへと段階的に写像し、その出力埋め込みから次トークン確率が計算される。高次元空間内における中間埋め込みの推移を追跡した結果、三つの明確な段階が観察された:(1) 中間埋め込みは当初、出力トークン埋め込みから遠く離れた位置から始まる;(2) 中間層では既に意味的に正しい次トークンのデコードが可能になるが、入力言語でのバージョンよりも英語でのバージョンに高い確率を与える;(3) 最終的に入力言語に固有の埋め込み空間領域へと移動する。これらの結果は、三つの段階がそれぞれ「入力空間」「概念空間」「出力空間」で動作するという概念的モデルとして定式化される。重要なことに、抽象的な「概念空間」が他の言語よりも英語に近い位置にあることが示唆され、多言語言語モデルが抱えるバイアスに対して重要な帰結をもたらしうる。コードとデータは 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.


AIでAIを構築

アイデアからローンチまで — 無料のAIコーディング支援、すぐに使える環境、最高のGPU価格でAI開発を加速。

AI コーディング補助
すぐに使える GPU
最適な料金体系

HyperAI Newsletters

最新情報を購読する
北京時間 毎週月曜日の午前9時 に、その週の最新情報をメールでお届けします
メール配信サービスは MailChimp によって提供されています