On the Similarity of Circuits across Languages: a Case Study on the Subject-verb Agreement Task

Javier Ferrando, Marta R. Costa-jussà

TL;DR

Researchers have discovered that large language models (LLMs) use nearly identical internal "circuits" to handle grammar across different languages. By studying Gemma 2B, the authors found a language-independent "subject number" signal that can be used to cross-lingually manipulate a model's grammatical predictions. For example, a "plurality" direction found in English can be used to force a Spanish sentence to output a plural verb.

The Problem: Are Grammatical Circuits Universal?

Mechanistic Interpretability (MI) acts as the "neuroscience" of AI, aiming to reverse-engineer the specific algorithms—or "circuits"—that models use to perform tasks. While researchers have successfully mapped circuits for tasks like indirect object identification or simple math, most studies have focused exclusively on English.

This paper asks a fundamental question about the universality of these internal structures: Does a model learn a different "algorithm" for every language, or does it develop a single, language-agnostic mechanism for universal grammatical concepts?

To answer this, the authors focus on Subject-Verb Agreement (SVA)—the rule dictating that a singular subject takes a singular verb (e.g., "the executive has") and a plural subject takes a plural verb (e.g., "the executives have"). They investigate whether the internal machinery for this task is shared between English and Spanish.

Subject-Verb Agreement Task Setup

Methodology and Datasets

The researchers applied several standard "circuit-breaking" techniques to the Gemma 2B model:

  • Activation Patching: A causal intervention where internal activations from a "clean" prompt (e.g., singular subject) are swapped into a "corrupted" prompt (e.g., plural subject) to see which specific components restore the correct prediction.
  • Direct Logit Attribution (DLA): Measuring how much individual components contribute directly to the final probability of the correct word.
  • Activation Steering: Taking a mathematical direction (a vector) found in one context and adding it to the model's internal state in another context to see if it changes the model's output.
  • Principal Component Analysis (PCA): Identifying the most significant "directions" of information flow within the model's residual stream.

These methods were applied to contrastive SVA datasets in both languages. For English, they used a subset of the CausalGym benchmark. For Spanish, they used GPT-4 to generate structurally similar contrastive pairs, ensuring words were not split into multiple sub-tokens to keep the analysis clean.

Key Insights and Results

1. The "Subject Number" Signal is Universal

The model doesn't simply store "English plural" and "Spanish plural" as separate concepts. Instead, it utilizes a dedicated 1-dimensional subspace—a specific direction in its internal representation space—that encodes the abstract concept of "plurality" regardless of the language being processed.

2. Circuit Consistency Across Languages

The activation patching maps for English and Spanish were remarkably similar. In both languages, the same specific layers (13-17) and components emerged as critical for solving the SVA task.

Activation Patching Heatmaps

3. Identifying the MVP Components

The researchers isolated specific components responsible for reading and writing this grammatical information:

  • The Writer: Attention head 7 in layer 13 (L13H7) acts as the primary "writer" of the subject number signal. It gathers information from the subject token and writes it into the residual stream.
  • The Reader: A specific neuron (Neuron 2069) in the 13th MLP layer acts as a key "reader" or logic gate. When it detects the "plural" signal from the attention head, it fires to promote plural verb forms in the final output.

4. Cross-Lingual Causal Steering

The most striking finding is that the "plurality" direction extracted purely from English sentences is highly effective at steering Spanish sentences. By adding the "English plural" vector to the Spanish model activations at layer 13, the researchers successfully flipped the model's prediction from a singular verb (e.g., era) to a plural one (e.g., eran). Furthermore, this intervention was highly surgical; it changed the verb's number without significantly degrading the probability of other likely tokens.

Limitations and Future Work

While these findings strongly support the existence of universal, cross-lingual circuits, the study has limitations:

  • Model Scope: The research was limited to Gemma 2B. It remains to be seen if much larger models (like Llama 3 70B or GPT-4) or much smaller ones exhibit the same degree of circuit sharing.
  • Language Distance: English and Spanish are both Indo-European languages with similar SVA structures. The results might differ for linguistically distant languages (e.g., Japanese or Arabic) where agreement rules operate differently.
  • Task Simplicity: SVA is a relatively straightforward grammatical rule. Future work is needed to investigate if more complex reasoning or semantic tasks also share universal circuits across languages.

Summary updated

BibTeX
@inproceedings{ferrando2024similarity,
  author = {Javier Ferrando and Marta R. Costa-jussà},
  title = {{On the Similarity of Circuits across Languages: a Case Study on the Subject-verb Agreement Task}},
  booktitle = {MI @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=uS8YXfnsqC},
}
Figure