TL;DR
Large Language Models (LLMs) occasionally suffer from "language confusion," where they unintentionally mix scripts—like dropping Chinese characters into a Hebrew sentence. This paper introduces the Language Confusion Gate (LCG), a lightweight MLP plug-in that filters out these "confused" tokens during decoding. It reduces errors by up to an order of magnitude without requiring expensive model retraining or sacrificing reasoning performance.
The Problem: Confusion vs. Code-Switching
Even state-of-the-art multilingual models like GPT-5 and Qwen3 occasionally make elementary mistakes by generating text in the wrong language family. This is particularly prevalent in reasoning models, where a trade-off often exists between reasoning capability and language consistency.
Fixing this issue presents two main challenges:
- Distinguishing Confusion from Code-Switching: We do not want to stop a model from using English technical terms (like "ReLU" or "Python") in a non-English response, as that is legitimate code-switching.
- The "Loud" Language Bias: High-resource languages (like English or Chinese) tend to dominate the model's output because their token embeddings have larger mathematical norms. This essentially makes them "louder" during the sampling process, pulling the model toward them even when it should be generating text in another language.
Introducing the Language Confusion Gate (LCG)
To address these challenges, the authors propose the Language Confusion Gate (LCG), a two-layer Multi-Layer Perceptron (MLP) that acts as a plug-in for the LLM's decoding stage.
Architecture and Smart Intervention
The LCG takes the LLM’s final hidden state as input and predicts which of four language families are permissible for the next token: Chinese/Japanese (CJ), Latin, Symbols, or Low-Resource languages.
To avoid breaking the model, the LCG follows strict intervention rules. It never masks symbols or low-resource languages, it yields to the base model if the model is highly confident in a specific token, and it maintains "persistence" by always allowing the language of the immediately preceding token to ensure linguistic flow. As a result, the LCG acts as a scalpel rather than a sledgehammer, intervening in only about 0.3% to 0.4% of generated tokens.
Norm-Adjusted Self-Distillation
The most novel part of the LCG's training is norm-adjustment. Because tokens from high-resource languages have larger embedding norms, the model is naturally biased toward them.
To train the LCG, the researchers use the model’s own top-k predictions but "debias" them by dividing the logits by the token embedding norms. This allows the LCG to learn the intended language family based on semantic direction rather than raw logit magnitude, effectively neutralizing the "loud language" bias.
Key Results and Performance
The authors trained the LCG on a composite dataset of ~78,000 samples (including Aya, FLORES+, and Alpaca) and evaluated it across rigorous benchmarks like FLORES and Humaneval-XL.
- Massive Error Reduction: On the FLORES-NO-LATIN benchmark, LCG reduced Latin-script confusion in Qwen3-30B from 4.4% to 0.4%, and Chinese/Japanese confusion from 1.0% to 0.0%.
- Preserved Reasoning: In reasoning models, the gate successfully eliminated Chinese character intrusion during complex tasks without affecting the Pass@1 success rate on coding problems.
- Legitimate Mixing: The LCG allowed 86.7% of human-validated legitimate code-switching instances to pass through, proving it can distinguish between an error and a technical term.
- Efficiency: The computational overhead is negligible, adding only about 0.4% (0.04ms) to the time taken for each generation step.
Limitations and Future Work
The primary limitation of the LCG is its granularity. Because it operates at the script level, it cannot distinguish between languages that share the same script. For example, it cannot prevent a model from accidentally mixing Spanish and Italian (both Latin script) or two different languages that both use Cyrillic. Future work could involve training more fine-grained, language-specific gates to handle these intra-script confusion cases.
Summary updated