Language Confusion Gate: Language-Aware Decoding Through Model Self-Distillation

## Abstract

Abstract Large language models (LLMs) often experience language confusion, which is the unintended mixing of languages during text generation. Current solutions to this problem either necessitate model retraining or cannot differentiate between harmful confusion and acceptable code-switching. This paper introduces the Language Confusion Gate (LCG), a lightweight, plug-in solution that filters tokens during decoding without altering the base LLM. The LCG is trained using norm-adjusted self-distillation to predict appropriate language families and apply masking only when needed. Our method is based on the findings that language confusion is infrequent, correct-language tokens are usually among the top predictions, and output token embedding norms are larger for high-resource languages, which biases sampling. When evaluated across various models, including Qwen3, GPT-OSS, Gemma3, Llama3.1, LCG decreases language confusion significantly, often by an order of magnitude, without negatively impacting task performance. 1 1 1 Code is available at https://github.com/collinzrj/language_confusion_gate

## 1 Introduction

Large language models have made remarkable strides in multilingual understanding and generation, with state-of-the-art systems like Qwen3 and GPT-5 now supporting over 100 languages and achieving strong performance on benchmarks such as FLORES-200 (Team et al., 2022) and XLSum (Hasan et al., 2021). These models demonstrate impressive cross-lingual transfer capabilities, enabling applications ranging from translation to multilingual creative writing. However, despite their sophistication, even the most advanced LLMs occasionally make seemingly elementary errors: generating text that mixes languages inappropriately. This phenomenon, known as language confusion (Marchisio et al., 2024), occurs when a model outputs tokens from an unintended language family (e.g., inserting Chinese characters into an Hebrew sentence), undermining reliability and user experience. We show three examples of language confusion mistakes on left side of Figure [1](https://arxiv.org/html/2510.17555v1#S1.F1).

While recent improvements have reduced confusion rates in some models, the trend of Large Reasoning Models seem to reintroduce the problem. As discussed in Guo et al. (2025), DeepSeek-R1 exhibited significant language mixing during training, and applying a language consistency reward led to measurable performance degradation, indicating a trade-off between language consistency and reasoning capability. Wang et al. (2025) shows that the reasoning capability of LLM degrades when thinking in low resource languages, which explains why a reward purely based on outcome correctness encourages language confusion.

Further, our evaluation reveals that language confusion remains widespread, even among leading commercial systems. For instance, GPT-5-Chat exhibits 0.57% Chinese/Japanese (CJ) character confusion and 0.67% Latin-script confusion, while Qwen3-235B-A22B-Instruct-2507 suffers 2.27% CJ and 5.07% Latin confusion. These results confirm that language confusion is far from solved and affects both open-source and proprietary models.

The challenge of mitigating language confusion is the lack of an automatic way of evaluation, rule-based detectors struggle in distinguishing erroneous mixing from legitimate code-switching, a common and often necessary linguistic behavior. In many practical scenarios such as writing English code with Chinese comments, using technical terms like ReLU or Python in non-English text, or explaining foreign phrases, the ability to blend languages enhances expressivity and utility. Consequently, simply restricting LLM to output in a single language doesn’t work. Furthermore, the high number of supported languages requires us to find a method that can be easily scaled to a large number of languages.

To address this, we analyze generation behavior at confusion points and make three key observations: (1) language confusion occurs rarely—suggesting the model generally knows the correct language; (2) at the confusion point, the correct-language token typically ranks within the top-5 candidates, indicating that LLM knows the correct answer; and (3) A mechanistic observation that output layer token embedding norm imbalance makes LLM biased towards high-resource languages.

Leveraging these insights, we propose the Language Confusion Gate (LCG): a lightweight, plug-in intervention that dynamically filters inappropriate tokens at decoding time without modifying the base LLM. LCG consists of a small two-layer MLP trained via self-distillation on the frozen model’s own top-$k$/$p$ predictions, with norm adjustment used to debias inclination to high-resource language tokens. At inference, the gate predicts which language families (Chinese/Japanese, Latin, Symbols, Low Resource Languages) are permissible at each step, and applies masking only when necessary.

Figure: Figure 1: Left: examples of language confusion in three LLMs on the left. Right: LCG takes the LLM’s hidden state, predicts permissible language families (CJ, Latin, Symbols, LowRes), and dynamically masks logits for disallowed tokens only when necessary to correct the confusion on the left without altering the base model.
Refer to caption: x1.png

Results show that LCG reduces language confusion by an order of magnitude across multiple models and tasks. For example, on FLORES-NO-LATIN benchmark, our method reduces Chinese/Japanese confusion from 1.0% to 0.0% and Latin confusion from 4.4% to 0.4% in Qwen3-30B-A3B.

We make three key contributions that build upon our analysis of language confusion in LLMs:
Firstly, we propose the Language Confusion Gate (LCG), an efficient intervention mechanism that dynamically filters inappropriate tokens during generation without modifying the base LLM.
Second, we introduce norm-adjusted self-distillation, leveraging mechanistic insights about token embedding norm imbalance to train the gate using the model’s own debiased top-k/p predictions.
Third, we collect and open-source specialized training and evaluation datasets, and evaluate LCG on open-source models covering diverse architectures and both thinking and no-think modes.

## 2 Related Works

Language confusion has emerged as a critical challenge in multilingual large language models (LLMs).
Marchisio et al. (2024) formalized the concept of language confusion and introduced the Language Confusion Benchmark (LCB), providing the first standardized evaluation framework for measuring cross-lingual interference in LLMs. Their analysis revealed that confusion often occurs at specific “confusion points” in the generation process, motivating targeted intervention strategies. They show that greedy decoding can help reduce language confusion but not eliminate it, at the cost of potentially degraded LLM performance.

Building on this foundation, Nie et al. (2025) conducted mechanistic interpretability analysis to identify neurons responsible for language switching behavior. They found that suppressing these critical neurons during inference reduces unwanted language mixing, suggesting that confusion is localized in the model’s internal representations. Similarly, Ji et al. (2025) focused on Korean-language setups where Chinese character intrusion was observed, proposing a post-hoc smoothing method that identifies and suppresses Chinese tokens during decoding. Other approaches have explored different mitigation strategies.

Li et al. (2025) took a unique perspective by studying whether language mixing between English and Chinese could actually benefit reasoning performance. Rather than targeting suppressing language confusion, they trained a gating mechanism to predict when mixing helps or harms task performance, selectively encouraging or discouraging it accordingly. In contrast, Lee et al. (2025) proposed training models to prefer language-consistent responses through Odds Ratio Preference Optimization (ORPO), aligning model outputs with preferences for linguistic coherence.

While these works represent important progress, they face limitations in practical deployment: some require model retraining or fine-tuning, others lack the ability to distinguish legitimate code-switching (e.g., technical terms or bilingual education contexts) from erroneous confusion. Our work addresses these gaps by introducing a lightweight, plug-in intervention that operates at confusion points without modifying the base model, while preserving valid multilingual behaviors.

## 3 Closer Look into Language Confusion

### 3.1 Confusion Point

Large language models (LLMs) generate text autoregressively by producing a probability distribution over the vocabulary at each step. The next token is usually sampled using a hybrid of top-k and top-p (nucleus) sampling. As demonstrated in Marchisio et al. (2024) and Nie et al. (2025), a confusion point arises when a token with a language different from the last token appears within the sampling tokens. We define the token in the different language as confusion token.

To better understand behavior of LLMs at confusion points, we use the FLORES-NO-LATIN dataset as described in Section [5.2](https://arxiv.org/html/2510.17555v1#S5.SS2) to trigger language confusion in Qwen3-8B. We inspect the token probability distribution of LLM at the confusion point, and we find that the confusion token is the top-1 token 56.74% of the time, which makes greedy decoding ineffective to prevent language confusion. Further, we find that language consistent tokens appear within top-3 99.29% of the time. This suggests that language switching errors are not due to a complete absence of correct-language candidates in the model’s output distribution, but rather to the model assigning insufficient probability mass to them relative to competing tokens from the confused language. This observation motivates a logits based intervention strategy without modifying weights of the model. We can simply mask tokens in the undesired language families.

### 3.2 Token Embedding Norm Analysis.

The magnitude of output token embeddings plays a critical role in language confusion by favoring tokens from high-resource languages.

Language models compute hidden states at each generation step and project them to vocabulary-sized logits through a linear layer $W_{out}\in\mathbb{R}^{d_{model}\times|V|}$:

$$ $\text{logits}={W_{out}}^{\top}h$ $$

$W_{out}$ is a collection of individual column vectors, $[e_{0},e_{1},...,e_{|V|-1}]$, where each vector $e_{i}$ represents the output embedding for a specific token in the vocabulary, we define these as output token embeddings.
Then we can decompose $\text{logit}_{i}$ as

$$ $\text{logits}_{i}=h\cdot e_{i}=||h||\cdot||e_{i}||\cdot\mathrm{cos_sim}(h,e_{i}).$ $$

That is, the logit of each token $\text{logit}_{i}$ is the dot product between the hidden state $h$ and that token’s embedding $e_{i}$, and thus be decomposed into its geometric components: magnitude (norm) and direction (cosine similarity).

Since the norm of the hidden state, $||h||$, is constant for all tokens at a given generation step, this decomposition reveals a critical, often-overlooked factor: the output token embedding norm, $||e_{i}||$. It shows that a token can achieve a high logit simply by having a large embedding norm. This creates a systemic bias where tokens from high-resource languages develop larger norms, which sometimes causes language confusion.

We categorize the vocabulary by language family: CJ (Chinese/Japanese), Latin, and Low-Res (low-resource languages). For each language family, we compute the fraction of tokens whose embedding norms lie in the top 5% of all token norms in the model’s vocabulary.
As shown in Table [1](https://arxiv.org/html/2510.17555v1#S3.T1), the results confirm a significant imbalance: high-resource languages like Latin and CJ consistently dominate the high-norm group, while low-resource languages are heavily underrepresented.

**Table 1: Percentage of tokens in each language family with embedding norms among top 5% of all token embedding norms.**
| Model | CJ% | Latin% | Low-Res% |
| --- | --- | --- | --- |
| Qwen3-8B | 10.74 | 4.61 | 0.14 |
| Qwen3-30B-A3B | 6.52 | 5.50 | 0.07 |
| Llama3.1-8B | 4.38 | 5.95 | 1.34 |
| Gemma3-12B | 0.94 | 5.04 | 2.40 |
| GPT-OSS | 0.00 | 7.00 | 0.00 |

Figure: Figure 2: Top-10 Logits before and after applying norm at a confusion point on Qwen3-8B
Refer to caption: x2.png

Adjusting the logits by the token embedding norm: $\text{logit}_{adj,i}=\frac{h\cdot e_{i}}{||e_{i}||}=||h||\cdot\mathrm{cos_sim}(h,e_{i})$ removes the embedding norm bias, allowing tokens to be ranked purely by their cosine similarity with the hidden state as shown in Figure [2](https://arxiv.org/html/2510.17555v1#S3.F2). We can see that the initial highly ranked language confusion tokens disappear from the top 10 tokens. This shows that norm-adjusted top-k tokens provides a signal for correct next-token language family, and we can use this signal to train a gate that predicts language family of next token as discussed in Section [4](https://arxiv.org/html/2510.17555v1#S4).
Norm bias can account for a subset of such errors but cannot fully explains language confusion. For example, it can’t explain language confusion between English and Chinese since they both have high norm, or between low resource languages since they both have low norm, so it can’t be directly used for intervention.

### 3.3 Language Confusion v.s. Natural Language Mix

Language mix, or code-switch, has been observed and discussed in both NLP and linguistic area (Doğruöz et al., 2021; Winata et al., 2023). We show several examples that language mixing in the context is necessary. 1) the use of English abbreviations or terms like Python, Java, iPhone. 2) Coding tasks. The user may prompt in Chinese to ask LLM to write code, while most programming languages are based on English characters. 3) Language study. We show examples of natural code-switch contexts in Appendix [F](https://arxiv.org/html/2510.17555v1#A6). The user may ask the language model to explain phrases in another language in English. In that case, the ability to use several language in a response should be preserved, so simply constrain the LLM to output in single language won’t work.
In that case, simply enforcing a rule-based language consistency constraint won’t work, since we have two objectives: suppressing unnormal language confusion while maintaining normal code-switch capabilities.

### 3.4 Does SOTA commercial LLMs show language confusion?

Even state-of-the-art commercial LLMs exhibit non-negligible language confusion, confirming it as a widespread challenge across both open-source and proprietary models.
We evaluate commercial models using our FLORES-NO-LATIN as described in Section [5.2](https://arxiv.org/html/2510.17555v1#S5.SS2) (Table [2](https://arxiv.org/html/2510.17555v1#S3.T2)). The results reveal that language confusion is widespread—even among state-of-the-art closed models. Notably, we are not sure that if a similar intervention mechanism like Language Confusion Gate has been applied to any commercial models, but we can observe that all models show non-negligible Latin Confusion and CJ Confusion (except Claude-Sonnet-4). We show the full table covering more Commercial LLM confusion rates in Appendix [D](https://arxiv.org/html/2510.17555v1#A4).

**Table 2: Language Confusion Rates on the FLORES-NO-LATIN Benchmark for Leading Commercial LLMs. This table displays the percentage of responses containing erroneous Chinese/Japanese (CJ%) and Latin (Latin%) characters, alongside the task-specific BLEU score. These results highlight that language confusion is a persistent issue across various SOTA models.**
| Model | CJ% | Latin% | BLEU |
| --- | --- | --- | --- |
| GPT-5-Chat | 0.57 | 0.67 | 10.66 |
| Claude-Sonnet-4 | 0.00 | 0.35 | 21.77 |
| Gemini-2.5-Pro | 0.04 | 0.50 | 19.11 |
| DeepSeek-v3.1 | 0.67 | 1.06 | 18.11 |
| Qwen3-235B-Instruct | 2.27 | 5.07 | 15.43 |

## 4 Method

### 4.1 Language Confusion Gate

We propose a lightweight intervention mechanism to address language confusion without modifying the base LLM architecture or requiring model retraining.
Our approach introduces Language Confusion Gate as shown in Figure [1](https://arxiv.org/html/2510.17555v1#S1.F1): a two layer MLP that determines language families allowed at each generation step, then masks inappropriate tokens from the logits during sampling.
The gate itself is a two layer MLP that takes the LLM’s final hidden state $\mathbf{h}_{t}$ as input and produces language family logits $\mathbf{z}_{t}=\mathrm{MLP}(\mathbf{h}_{t})\in\mathbb{R}^{4}$.
At each generation step, for each new token, the gate predicts one or more language families allowed for next token, and mask tokens in banned language. Intervention only happens when the tokens could be sampled under current top-k, top-p, and temperature parameters contain language families disallowed by the gate. Since language confusion happens rarely, it has minimal impact on overall generation.

#### Classify Tokens into Language Families.

To enable the Language Confusion Gate, we classify each token in the entire vocabulary into one of four mutually exclusive families: Chinese and Japanese (CJ), for tokens primarily composed of Chinese and Japanese characters; Latin, for tokens representing Latin scripts; Symbols, for punctuation, numbers, and special characters; and Low Resource Languages (Low-Res), the category for all other tokens.

The classification is performed using a prioritized heuristic. For each token in the vocabulary, we first attempt to decode it from its byte-pair encoding (BPE) into Unicode characters. If the resulting characters contain any Chinese or Japanese script, the token is classified as CJ. If not, and the characters consist only of Latin script and symbols, it is classified as Latin. If a token decodes exclusively to symbols, it is classified as Symbols. All other tokens that decode to valid characters from other scripts are categorized as Low-Res.

A known challenge with BPE is that some tokens may represent incomplete Unicode characters. In these cases, we analyze the partial byte sequence to infer its language family based on Unicode’s continuous block structure. We discuss in more detail this method in Appendix [A](https://arxiv.org/html/2510.17555v1#A1). If the family cannot be reliably determined, the token is conservatively classified as Symbols. Applying this methodology to the Qwen3 tokenizer (151,936 total tokens) yields the following distribution: 27,658 CJ, 94,666 Latin, 10,355 Symbols, and 19,257 Low-Res tokens.

### 4.2 Training

#### Norm-adjusted self-distillation.

We train the gate with norm-adjusted self-distillation, use the model’s own language prediction as pseudo-targets, and remove the systemic advantage of high-norm tokens with norm-adjustment.

For the logit vector $\mathbf{logits}\in\mathbb{R}^{|V|}$ produced at a given step, we compute norm-adjusted logits, $\mathbf{logits}_{\text{adjust}}$, by dividing each token’s logit by the norm of its output embedding vector $||\mathbf{e}_{v}||_{2}$.

With these debiased logits, we create multi-label pseudo-targets $\mathbf{y}^{*}_{t}$ for each generation step $t$. First, we identify a set of high-confidence candidate tokens, $S_{k,p}(\mathbf{logits}_{\text{adjust}})$, by applying top-k/top-p filtering to the norm-adjusted logits. Then, we determine which language families are present in this candidate set. The pseudo-target for language family $i$ is set to 1 if any token from that family appears in the set, and 0 otherwise. This is formally expressed as:

$$ $y_{t,i}^{*}=\mathbf{1}\big[S_{k,p}(\mathbf{logits}_{\text{adjust}})\cap\mathcal{F}_{i}\neq\emptyset\big],$ $$

where $\mathcal{F}_{i}$ is the set of tokens belonging to language family $i$ (as defined in Section [4.1](https://arxiv.org/html/2510.17555v1#S4.SS1.SSS0.Px1)).

We train the gate to predict the pseudo-targets using a standard binary cross-entropy (BCE) loss:
$\mathcal{L}=\sum_{i=1}^{n}\text{BCE}(y_{t,i}^{*},\sigma(z_{t,i}))$,
where $\sigma$ is the sigmoid function and $n$ is the number of language families. We freeze weights of the LLM during training.

### 4.3 Intervention Rules

During inference, we apply the LCG to dynamically mask tokens from disallowed language families at each generation step. To mitigate potential side effects, we supplement the gate’s prediction with several intervention rules:

Symbols and Low-Res tokens are never masked. It’s very rare for high-resource language to mix low-resource languages, so we never mask Low-Res tokens. We never mask symbols since they don’t cause language confusion.

No intervention if the gate’s prediction is contradicted by high-confidence model output. If neither of the two high-probability candidate sets defined by (top-$k=5$, top-$p=0.999$) or (top-$k=20$, top-$p=0.95$) contains any token from the gate-predicted language family, we refrain from applying any mask.

Persistence of the previous token’s language. To maintain linguistic coherence, we always allow the language family of the immediately preceding non-symbol token.

## 5 Experiments

### 5.1 Experimental Setup

#### Models.

Our experiments include both standard (“no-think”) and reasoning-focused (“thinking”) large language models to ensure the LCG is effective across different architectures and capabilities. For no-think models, we applied our intervention to Qwen3-30B-A3B-Instruct-2507 (Yang et al., 2025), Qwen3-8B, Llama 3.1-8B (Dubey et al., 2024), and Gemma3-12B (Team et al., 2025). For thinking models, we evaluated our intervention on Qwen3-30B-A3B-Thinking-2507, Qwen3-8B, and GPT-OSS-20B (OpenAI, 2025). Notably, Qwen3-8B is a hybrid model and was used in both experimental setups. In experiments, we refer the gate trained with norm-adjusted self-distillation LCG-adjusted, while the gate trained only with self-distillation without norm-adjustment LCG-unadjusted.

#### Training Data for the Gate.

We trained the LCG on a composite dataset of approximately 78,000 samples covering over 200 languages to ensure it learns to handle a wide variety of linguistic contexts. This same dataset was used to train the gate for both thinking and no-think models. The data was aggregated from several sources, including the Aya Dataset (Singh et al., 2024) for diverse topics, the FLORES+ Dataset (NLLB Team et al., 2024) to generate translation pairs for low-resource languages, the DeepSeek Distill Dataset (Lightblue KK., 2024) for multilingual reasoning contexts, and the Alpaca (Taori et al., 2023) datasets (Chinese & English) to maintain strong performance in high-resource languages.

### 5.2 Evaluation Strategy

Our evaluation is designed to confirm that LCG reduces language confusion without degrading task performance. We use different benchmarks for “thinking” and “no-think” models to align with their distinct behavioral patterns.

#### Evaluation Datasets.

We evaluate no-think models using the translation dataset FLORES+ for Arabic, Hebrew, Korean, and Thai, and the INCLUDE benchmark (Romanou et al., 2024), a multilingual knowledge and reasoning dataset for Arabic, Hebrew, Greek, Russian, and Vietnamese. For thinking models, we use Python problems from Humaneval-XL (Peng et al., 2024) in Arabic and Hebrew, repeating each prompt 10 times to reliably detect confusion in reasoning-intensive tasks. Across all datasets, we measure both language confusion rate and standard task performance.

#### Evaluation Metrics.

We define the language confusion rate as the percentage of model responses that contain at least one character from an unintended language script. Our evaluation focuses on two primary types of confusion: Chinese/Japanese (CJ) confusion and Latin confusion.

CJ confusion is straightforward to measure using a rule-based detector, as legitimate code-switching into Chinese or Japanese characters is exceedingly rare in the target languages of our benchmarks. Consequently, we evaluate CJ confusion across all datasets.

In contrast, Latin confusion presents a more nuanced challenge due to the frequent and valid use of Latin-script tokens in contexts such as programming code or mathematical notation. To address this, we partition the FLORES+ dataset into two subsets:
FLORES-NO-LATIN: translations whose ground-truth references contain no Latin characters, so any Latin script in model output is considered erroneous.
FLORES-WITH-LATIN: translations where Latin characters appear in the reference and are thus permissible.
This partitioning is performed by examining ground-truth translations from English into five target languages: Arabic, Hebrew, Korean, Thai, and Chinese, and flagging those that include Latin-script characters. We restrict our Latin confusion evaluation to the FLORES-NO-LATIN subset, where rule-based detection reliably identifies unintended language mixing.

#### Rationale for Not Using LCB.

We use established multilingual benchmarks for our evaluation instead of the Language Confusion Benchmark (LCB) (Marchisio et al., 2024) for two reasons: (1) We observed that some LCB queries require natural code-switching, which could lead to unreliable confusion metrics. (2) Its language detector sometimes produce wrong results, which may result in false positives. Our methodology of using standard benchmarks with targeted filtering provides a more robust and practical evaluation.

### 5.3 Evaluation Results

We evaluate the Language Confusion Gate (LCG) across both standard (“no-think”) and reasoning-focused (“thinking”) models to assess its effectiveness in mitigating unintended language mixing and validate the importance of norm adjustment. To examine LCG’s impact on legitimate code-switching behavior, we conduct comparative analysis against reference models. Furthermore, we benchmark LCG against established baseline methods to demonstrate its advantages in reducing language confusion while maintaining appropriate multilingual capabilities.

#### Experiments on No-Think Models Intervention.

**Table 3: Effectiveness of LCG Intervention on “No-Think” Models. No LCG is the case without intervention. BLEU scores are for FLORES-NO-LATIN; accuracy is for INCLUDE.**
|  | Qwen3-30B | Llama3.1-8B | Gemma3-12B | Qwen3-8B |
| --- | --- | --- | --- | --- |
| FLORES-NO-LATIN |  |  |  |  |
| CJ% (No LCG) | 1.0 | 3.0 | 0.2 | 4.5 |
| CJ% (LCG-unadjusted) | 0.2 | 2.0 | 0.1 | 0.5 |
| CJ% (LCG-adjusted) | 0.0 | 0.4 | 0.1 | 0.1 |
| Latin% (No LCG) | 4.4 | 8.4 | 1.0 | 12.1 |
| Latin% (LCG-unadjusted) | 0.7 | 5.7 | 0.6 | 6.2 |
| Latin% (LCG-adjusted) | 0.4 | 2.9 | 0.5 | 2.0 |
| BLEU (No LCG) | 13.2 | 11.3 | 16.9 | 12.1 |
| BLEU (LCG-unadjusted) | 13.3 | 12.2 | 17.0 | 11.9 |
| BLEU (LCG-adjusted) | 13.4 | 12.3 | 17.1 | 12.1 |
| INCLUDE |  |  |  |  |
| CJ% (No LCG) | 2.21 | 0.87 | 0.00 | 1.67 |
| CJ% (LCG-unadjusted) | 0.22 | 0.51 | 0.00 | 0.44 |
| CJ% (LCG-adjusted) | 0.11 | 0.07 | 0.00 | 0.18 |
| Accuracy (No LCG) | 71.12 | 46.12 | 64.95 | 61.43 |
| Accuracy (LCG-unadjusted) | 71.55 | 46.12 | 65.02 | 62.84 |
| Accuracy (LCG-adjusted) | 70.83 | 46.34 | 65.75 | 61.76 |

LCG drastically reduces language confusion in standard (no-think) models by an order of magnitude, while maintaining task performance.
We evaluate the intervention effectiveness of the language confusion gate on nothink models on the FLORES+ dataset and the INCLUDE dataset. On the FLORES+ dataset (Table [3](https://arxiv.org/html/2510.17555v1#S5.T3)), the gate drastically reduces both CJ and Latin confusion. For example, Qwen3-30B-A3B-2507 reduces CJ confusion from 1.0% to 0.0%, and Latin confusion from 4.4% to 0.4%, while maintaining stable BLEU scores.
Llama3.1-8B and Qwen3-8B show high language confusion rate without intervention, with LCG-adjusted intervention, Llama3.1-8B’s Latin% drops from 8.4% to 2.9% and Qwen3-8B’s Latin% falls from 12.1% to 2.0%.
Results on the INCLUDE dataset (Table [3](https://arxiv.org/html/2510.17555v1#S5.T3)) also show significant reductions in CJ confusion—from 2.21% to 0.11% in Qwen3-30B without degradation in task accuracy.

#### Ablation of norm-adjustment.

We compare the LCG-unadjusted against the LCG-adjusted and find that LCG-adjusted consistently achieves better performance. As shown in Table [3](https://arxiv.org/html/2510.17555v1#S5.T3), LCG-adjusted further reduces both CJK and Latin confusion while preserving or slightly improving BLEU scores. For instance, on Llama3.1-8B, Latin confusion drops from 5.7% (LCG-unadjusted) to 2.9% (LCG-adjusted), and on Qwen3-30B, it decreases from 0.7% to 0.4%. This demonstrates that training with norm-adjustment produces a gate with higher accuracy, leading to more precise suppression of language confusion. Thus, LCG-adjusted represents our final, optimized intervention.

#### Experiments on Thinking Model Intervention.

**Table 4: Effectiveness of LCG Intervention on “No-Think” Models measured on Humaneval-XL.**
|  | No LCG | LCG-adjusted |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| Model | CJ% | Pass@1 | Pass@10 | CJ% | Pass@1 | Pass@10 |
| Qwen3-8B | 1.50 | 67.94 | 86.67 | 0.06 | 67.19 | 84.36 |
| Qwen3-30B | 0.12 | 80.56 | 91.96 | 0.00 | 79.44 | 90.78 |
| GPT-Oss | 0.38 | 59.88 | 86.23 | 0.06 | 60.19 | 87.52 |

LCG can also effectively reduce language confusion on thinking models. For reasoning-capable models, we evaluate on the humaneval-xl dataset (Table [4](https://arxiv.org/html/2510.17555v1#S5.T4)). Our intervention successfully eliminates Chinese character confusion—reducing it from 0.38% to 0.06% in GPT-OSS and from 0.12% to 0.00% in Qwen3-30B—while maintaining competitive Pass@1 and Pass@10 scores. This indicates that the gate effectively prevents language confusion during complex reasoning tasks without degrading the model’s reasoning capability.

#### Impact on normal code-switch.

A critical challenge in mitigating language confusion is ensuring that the intervention does not penalize legitimate code-switching, which is a natural and often necessary aspect of multilingual communication.
We find that although LCG reduces the frequency of legitimate code-switching, it preserves the model’s code-switch ability.
We measured LCG’s impact on the FLORES-WITH-LATIN dataset, a subset of the FLORES benchmark where ground-truth translations contain Latin characters, indicating possibility of code-switch.

In our first experiment, we ran the Qwen3-8B No LCG on the FLORES-WITH-LATIN dataset to generate translations. From these outputs, we select cases where the model’s use of English was judged by human annotators to be natural, appropriate code-switch. We then applied Qwen3-8B LCG-adjusted on to these outputs to determine whether it would permit the English tokens at each confusion point. We find that Qwen3-8B LCG-adjusted allows the English code-switch in 86.7% of these human-validated examples, indicating that it largely preserves legitimate code-switch.

In our second experiment, we ran the models with LCG on the FLORES-WITH-LATIN dataset. We define the “code-switch rate” as the percentage of responses that contain Latin characters. We compare the models’ rates before and after intervention to two baselines: the rate in the ground-truth answers (“Answer Rate”) and the rate of a strong baseline model: Claude Sonnet 4. Notice that these two baselines are just references for comparison but not a ground truth optimal code-switch rate.

As shown in Table [5](https://arxiv.org/html/2510.17555v1#S5.T5), LCG does reduce the rate of code-switching across all models. For instance, the code-switch rate for Qwen3-8B from 46.34% to 25.90%. However, the post-intervention rates remain higher than the Claude Sonnet 4 baseline (23.29%) and not much lower than the ground-truth answer rate (38.36%). This suggests that while LCG makes models more cautious about mixing languages, it does not eliminate their ability to perform necessary code-switching. The intervention effectively moderates the behavior, preserving the model’s capacity for legitimate language blending while suppressing erroneous confusion. We show examples that our LCG avoids language confusion and maintains natural code-switch in Appendix [G](https://arxiv.org/html/2510.17555v1#A7).

**Table 5: Impact of LCG on legitimate code-switching behavior. In addition to these numbers, at the token level, LCG-adjusted allows English tokens at 86.7% of the confusion points.**
| Model | No LCG | LCG-adjusted | Answer Rate | Claude Sonnet 4 |
| --- | --- | --- | --- | --- |
| Llama3.1-8B | 42.51 | 31.60 | 38.36 | 23.29 |
| Qwen3-8B | 46.34 | 25.90 | 38.36 | 23.29 |
| Gemma3-12B | 30.94 | 25.57 | 38.36 | 23.29 |

#### Comparison with baseline intervention mechanisms.

Figure: Figure 3: Comparison of LCG with baseline methods. CJ% and Latin% show CJ confusion rate and Latin confusion rate respectively.
Refer to caption: x3.png

We compared our LCG-adjusted approach with three baseline intervention mechanisms: in-context learning (ICL), greedy decoding, and ORPO tuning as described in Lee et al. (2025). We show the prompt we used for ICL in Appendix [C](https://arxiv.org/html/2510.17555v1#A3). For the ORPO method, we prepare a multilingual dataset, and synthesize samples with language confusion as rejected samples similar as Lee et al. (2025).
The results in Figure [3](https://arxiv.org/html/2510.17555v1#S5.F3) demonstrate that, LCG most effectively reduce the language confusion rate while preserving model performance.

For instance, with the Qwen3-8B model, ICL only offers a marginal improvement, reducing the Chinese/Japanese character confusion (CJ%) from 4.5% to 4.2%. Greedy decoding provides similarly limited benefits, lowering the CJ% to just 4.2%. Since greedy decoding is the most conservative sampling strategy, this result implies that merely tuning other decoding parameters like temperature or top-p would also be insufficient to resolve the language mixing issue.

In contrast, our LCG-adjusted mechanism achieves a substantial and consistent reduction in errors across all models. For Qwen3-8B, it decreased the CJ% from 4.5% down to 0.1% and the Latin% from 12.1% to 2.0%. This shows our learned gate is a more targeted and effective solution than simple prompting or decoding-based interventions.

LCG also outperforms training-based methods. For instance, while ORPO achieves performance comparable to LCG on Llama3.1-8B, it performs significantly worse on Qwen3-8B when evaluated on the FLORES-NO-LATIN dataset. Moreover, we observe that ORPO can degrade the model’s general capabilities: on Qwen3-8B, INCLUDE accuracy drops from 61.4 to 57.3, and on Llama3.1-8B, it declines from 46.1 to 43.2. This suggests that ORPO may sacrifice overall language understanding in its attempt to reduce language confusion.

## 6 Conclusion

The Language Confusion Gate (LCG) is a lightweight, plug-in intervention that effectively mitigates language confusion without altering the base model’s parameters. Its primary advantage is its practicality: as a small MLP with a sparse intervention rate, it adds minimal computational overhead and avoids the performance trade-offs common in methods that require retraining. Further, LCG is compatible with speculative decoding as discussed in Appendix [E](https://arxiv.org/html/2510.17555v1#A5).
However, the current approach is limited by its script-level granularity. By grouping tokens into broad families like “Latin” or “Low-Res”, the gate cannot resolve more nuanced confusion between languages that share the same script (e.g., Spanish vs. English) or between two different low-resource languages. Future work could explore more fine-grained, language-specific gates, which would require a more detailed token classification scheme to address these more subtle forms of language confusion.

## Reproducibility Statement

To ensure the reproducibility of our results, we have uploaded all code necessary for training and evaluating the models described in this paper to the supplementary materials. The provided codebase includes detailed instructions for data preprocessing, model training, hyperparameter settings, and evaluation procedures. All experiments can be replicated using the included scripts and configurations.

## LLM Usage

The authors acknowledge the use of large language model (LLM) technology to assist in the preparation of this manuscript. Specifically, an LLM was employed to aid in refining language, improving clarity, and polishing the prose of certain sections.

## References

- Doğruöz et al. (2021)
A. Seza Doğruöz, Sunayana Sitaram, Barbara E. Bullock, and Almeida Jacqueline Toribio.
A survey of code-switching: Linguistic and social perspectives for language technologies.
In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), *Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)*, pp. 1654–1666, Online, August 2021. Association for Computational Linguistics.
doi: 10.18653/v1/2021.acl-long.131.
URL [https://aclanthology.org/2021.acl-long.131/](https://aclanthology.org/2021.acl-long.131/).
- Dubey et al. (2024)
Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al.
The llama 3 herd of models.
*arXiv e-prints*, pp. arXiv–2407, 2024.
- Guo et al. (2025)
Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, Qihao Zhu, Shirong Ma, Peiyi Wang, Xiao Bi, et al.
Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning.
*arXiv preprint arXiv:2501.12948*, 2025.
- Hasan et al. (2021)
Tahmid Hasan, Abhik Bhattacharjee, Md Saiful Islam, Kazi Samin, Yuan-Fang Li, Yong-Bin Kang, M. Sohel Rahman, and Rifat Shahriyar.
Xl-sum: Large-scale multilingual abstractive summarization for 44 languages, 2021.
URL [https://arxiv.org/abs/2106.13822](https://arxiv.org/abs/2106.13822).
- Ji et al. (2025)
SeungWon Ji, Jungyup Lee, Jemin Kim, Sang Park, and SeungJae Lee.
Smoothie-qwen: Post-hoc smoothing to reduce language bias in multilingual llms, 2025.
URL [https://arxiv.org/abs/2507.05686](https://arxiv.org/abs/2507.05686).
- Lee et al. (2025)
Nahyun Lee, Yeongseo Woo, Hyunwoo Ko, and Guijin Son.
Controlling language confusion in multilingual llms, 2025.
URL [https://arxiv.org/abs/2505.19116](https://arxiv.org/abs/2505.19116).
- Li et al. (2025)
Yihao Li, Jiayi Xin, Miranda Muqing Miao, Qi Long, and Lyle Ungar.
The impact of language mixing on bilingual llm reasoning, 2025.
URL [https://arxiv.org/abs/2507.15849](https://arxiv.org/abs/2507.15849).
- Lightblue KK. (2024)
Lightblue KK.
reasoning-multilingual-r1-llama-70b-train, 2024.
URL [https://hf-mirror.com/datasets/lightblue/reasoning-multilingual-R1-Llama-70B-train](https://hf-mirror.com/datasets/lightblue/reasoning-multilingual-R1-Llama-70B-train).
Accessed: 2025-09-21.
- Marchisio et al. (2024)
Kelly Marchisio, Wei-Yin Ko, Alexandre Berard, Théo Dehaze, and Sebastian Ruder.
Understanding and mitigating language confusion in LLMs.
In Yaser Al-Onaizan, Mohit Bansal, and Yun-Nung Chen (eds.), *Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing*, pp. 6653–6677, Miami, Florida, USA, November 2024. Association for Computational Linguistics.
doi: 10.18653/v1/2024.emnlp-main.380.
URL [https://aclanthology.org/2024.emnlp-main.380/](https://aclanthology.org/2024.emnlp-main.380/).
- Nie et al. (2025)
Ercong Nie, Helmut Schmid, and Hinrich Schütze.
Mechanistic understanding and mitigation of language confusion in english-centric large language models, 2025.
URL [https://arxiv.org/abs/2505.16538](https://arxiv.org/abs/2505.16538).
- NLLB Team et al. (2024)
NLLB Team, Marta R. Costa-jussà, James Cross, Onur Çelebi, Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula, Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews, Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzmán, Philipp Koehn, Alexandre Mourachko, Christophe Ropers, Safiyyah Saleem, Holger Schwenk, and Jeff Wang.
Scaling neural machine translation to 200 languages.
*Nature*, 630(8018):841–846, 2024.
ISSN 1476-4687.
doi: 10.1038/s41586-024-07335-x.
URL [https://doi.org/10.1038/s41586-024-07335-x](https://doi.org/10.1038/s41586-024-07335-x).
- OpenAI (2025)
OpenAI.
gpt-oss-120b & gpt-oss-20b model card, 2025.
URL [https://arxiv.org/abs/2508.10925](https://arxiv.org/abs/2508.10925).
- Peng et al. (2024)
Qiwei Peng, Yekun Chai, and Xuhong Li.
Humaneval-xl: A multilingual code generation benchmark for cross-lingual natural language generalization.
*arXiv preprint arXiv:2402.16694*, 2024.
- Romanou et al. (2024)
Angelika Romanou, Negar Foroutan, Anna Sotnikova, Zeming Chen, Sree Harsha Nelaturu, Shivalika Singh, Rishabh Maheshwary, Micol Altomare, Mohamed A Haggag, Alfonso Amayuelas, et al.
Include: Evaluating multilingual language understanding with regional knowledge.
*arXiv preprint arXiv:2411.19799*, 2024.
- Singh et al. (2024)
Shivalika Singh, Freddie Vargus, Daniel Dsouza, Börje F Karlsson, Abinaya Mahendiran, Wei-Yin Ko, Herumb Shandilya, Jay Patel, Deividas Mataciunas, Laura OMahony, et al.
Aya dataset: An open-access collection for multilingual instruction tuning.
*arXiv preprint arXiv:2402.06619*, 2024.
- Taori et al. (2023)
Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto.
Stanford alpaca: An instruction-following llama model.
[https://github.com/tatsu-lab/stanford_alpaca](https://github.com/tatsu-lab/stanford_alpaca), 2023.
- Team et al. (2025)
Gemma Team, Aishwarya Kamath, Johan Ferret, Shreya Pathak, Nino Vieillard, Ramona Merhej, Sarah Perrin, Tatiana Matejovicova, Alexandre Ramé, Morgane Rivière, et al.
Gemma 3 technical report.
*arXiv preprint arXiv:2503.19786*, 2025.
- Team et al. (2022)
NLLB Team, Marta R. Costa-jussà, James Cross, Onur Çelebi, Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula, Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews, Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzmán, Philipp Koehn, Alexandre Mourachko, Christophe Ropers, Safiyyah Saleem, Holger Schwenk, and Jeff Wang.
No language left behind: Scaling human-centered machine translation, 2022.
URL [https://arxiv.org/abs/2207.04672](https://arxiv.org/abs/2207.04672).
- Wang et al. (2025)
Yiming Wang, Pei Zhang, Jialong Tang, Haoran Wei, Baosong Yang, Rui Wang, Chenshu Sun, Feitong Sun, Jiran Zhang, Junxuan Wu, et al.
Polymath: Evaluating mathematical reasoning in multilingual contexts.
*arXiv preprint arXiv:2504.18428*, 2025.
- Winata et al. (2023)
Genta Winata, Alham Fikri Aji, Zheng Xin Yong, and Thamar Solorio.
The decades progress on code-switching research in NLP: A systematic survey on trends and challenges.
In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), *Findings of the Association for Computational Linguistics: ACL 2023*, pp. 2936–2978, Toronto, Canada, July 2023. Association for Computational Linguistics.
doi: 10.18653/v1/2023.findings-acl.185.
URL [https://aclanthology.org/2023.findings-acl.185/](https://aclanthology.org/2023.findings-acl.185/).
- Yang et al. (2025)
An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, et al.
Qwen3 technical report.
*arXiv preprint arXiv:2505.09388*, 2025.

## Appendix A Details of the Token Classification Algorithms

A known challenge with Byte-Pair Encoding (BPE) is that some tokens may represent incomplete Unicode characters, making them difficult to classify directly. When a BPE token cannot be decoded into a valid Unicode string, we employ a more sophisticated method to infer its language family by analyzing its underlying byte structure. This approach allows us to conservatively classify even partial tokens.

Our methodology relies on the continuous block structure of the Unicode standard. Even if a token only contains the first few bytes of a multi-byte character, those bytes can significantly narrow down the range of possible code points it could belong to. The process is as follows:

- 1.
Byte Sequence Decomposition. First, the ambiguous token is converted back into its raw byte sequence. This sequence is then fed into a UTF-8 state machine that breaks it down into logically complete or partial UTF-8 units. The key is to identify what we term a “left partial” token: a byte sequence that correctly starts a multi-byte character but is incomplete.
- 2.
Inferring Code Point Bounds. With a “left partial” sequence identified, its first two bytes are used to determine the possible range of Unicode code points it could represent if completed. Based on the rules of UTF-8 encoding, we calculate the lowest and highest possible code points that can be formed. For a 3-byte sequence, the final code point is formed from bit patterns across all three bytes. Since the third byte is missing from our partial token, we can calculate the full range of possibilities by assuming the third byte is at its minimum valid value (0x80) and then its maximum valid value (0xBF).
- 3.
Overlapping with Language Blocks. Finally, we check if this inferred Unicode range overlaps with any predefined language blocks. The calculated bounds are compared against a map of known Unicode ranges, which contains the official start and end code points for scripts like CJK Ideographs, Hiragana, and Katakana.

If a token is identified as a “left partial” and its inferred Unicode range overlaps with any of the CJK blocks, it is classified as a CJ token. This robust, byte-level analysis allows us to handle the ambiguity of partial BPE tokens and improve the accuracy of our language family classification.

## Appendix B Compute resources required for Experiments

All of the training and evaluation experiments we talked about could be run on two NVIDIA-A100 GPUs, for which smaller models like Qwen3-8B, Llama3.1-8B and Gemma3-12B could be trained on single NVIDIA-A100 GPU. It takes about 12 hours to trained the largest model Qwen3-30B-A3B we experimented with on 2 A100 GPUs.

## Appendix C ICL Prompt

As discussed in Section [5.3](https://arxiv.org/html/2510.17555v1#S5.SS3.SSS0.Px5), we tried to use a prompt to teach LLM what is language confusion, and provide an example to let it avoid. We show the ICL prompt we use in Figure [4](https://arxiv.org/html/2510.17555v1#A3.F4).

Figure: Figure 4: Prompt we used for ICL as described in Section [5.3](https://arxiv.org/html/2510.17555v1#S5.SS3.SSS0.Px5)
Refer to caption: x4.png

## Appendix D Commercial LLMs confusion rate

We show the full list of commercial LLMs we tested with FLORES-NO-LATIN in Table [6](https://arxiv.org/html/2510.17555v1#A4.T6).

**Table 6: Full list of language confusion rate of commercial chat LLMs**
| Model | CJ (%) | Latin (%) | BLEU |
| --- | --- | --- | --- |
| GPT-5-Chat | 0.57 | 0.67 | 10.66 |
| GPT-5-mini | 0.04 | 1.06 | 18.07 |
| GPT-5-nano | 0.04 | 1.24 | 16.79 |
| Qwen3-235B-Instruct | 2.27 | 5.07 | 15.43 |
| Qwen3-30B-Instruct | 0.92 | 4.68 | 13.42 |
| Claude-Sonnet-4 | 0.00 | 0.35 | 21.77 |
| Gemini-2.5-Pro | 0.04 | 0.50 | 19.11 |
| Gemini-2.5-Flash | 0.07 | 0.82 | 19.93 |
| DeepSeek-v3.1 | 0.67 | 1.06 | 18.11 |
| DeepSeek-v3-0324 | 0.14 | 0.57 | 20.72 |
| GLM-4.5 | 0.14 | 0.99 | 13.35 |
| GLM-4.5-air | 0.14 | 1.31 | 15.18 |
| Grok-4 | 0.18 | 1.21 | 20.75 |
| Doubao-1.6 | 0.99 | 1.74 | 14.09 |

## Appendix E Compatibility with speculative decoding

The Language Confusion Gate (LCG) is designed to be a lightweight module that integrates seamlessly with modern inference optimizations, including speculative decoding. This appendix details why LCG is compatible with this technique and does not compromise its efficiency gains.

#### Speculative Decoding Overview.

Speculative decoding accelerates inference by using a smaller, faster “draft” model to generate a candidate sequence of several tokens. The larger, more powerful “target” model then processes this entire sequence in a single, parallel forward pass to verify the draft tokens. This allows multiple tokens to be accepted for the cost of a single forward pass of the large model, significantly improving throughput.

#### Integration of LCG.

LCG’s compatibility stems from its ability to be integrated directly into the target model’s verification step with minimal overhead. The process works as follows:

- 1.
Draft Generation: The small draft model generates a candidate sequence of tokens as it normally would.
- 2.
Target Verification: The large target model performs its single forward pass on the input combined with the draft sequence, producing hidden states and logits for each token position in parallel.
- 3.
LCG Masking: At each position, the LCG takes the corresponding hidden state generated by the target model and computes a language mask. Because the LCG is a small MLP, this step is extremely fast and can be performed in parallel for all draft tokens.
- 4.
Logit Modification: The LCG’s mask is applied to the target model’s logits for each token. Since intervention is rare, the logits are often left unchanged, ensuring minimal impact on the model’s standard behavior.
- 5.
Final Validation: The standard speculative decoding algorithm proceeds with its validation check, but it uses the LCG-modified logits to accept or reject the draft tokens.

Because the LCG is a fast, parallelizable operation that adds negligible computational cost to the target model’s pass, it does not create a bottleneck or negate the speed improvements offered by speculative decoding. This ensures that language confusion can be mitigated without sacrificing inference performance.

## Appendix F Examples of natural code-switch

We show examples of user queries that require LLM to naturally blend two languages in Figure [5](https://arxiv.org/html/2510.17555v1#A6.F5).

Figure: Figure 5: Left: User asking in Arabic to write a python program that computes factorial. Right: User asking in English to let LLM introduce a Chinese poem.
Refer to caption: x5.png

## Appendix G Examples of intervention v.s. no intervention

We show examples of Qwen3-8B responses to a query with and without LCG intervention in Figure [6](https://arxiv.org/html/2510.17555v1#A7.F6). The example on the left shows an example that incorrect language mixing is avoided, and the example on the right shows an example that correct code-switch is maintained.

Figure: Figure 6: Comparison between language confusion and natural code-switch.
Refer to caption: x6.png

## Peer Reviews

confidence: 3
contribution: 3
initial_rating: 8
presentation: 4
questions: 1. Could authors measure if there is any effect on inference speed?
2. Is there potentially a cleaner way to obtain the expected class of the next token? For example rule-based/heuristics-based on logits/last hidden states. Would like to see such a simple baseline to be experimented with to justify a two-layer MLP is needed.
3. Does the incorporation of LCG affect the length of reasoning traces?
soundness: 3
strengths: 1. Authors propose an effective fix on the problem of language confusion based on reliable observations.
2. Method is simple and intuitive.
3. That the method does not require modifying the base model alleviates the concern of the potential forgetting happening.
summary: Authors propose language confusion gate (LCG), which uses a 2-layer MLP to predict the language class of next generated tokens and mask the unwanted language tokens. Results show that language confusion behaviors are reduced by 10x by applying the proposed method.
weaknesses: 1. In section 5.4, there is slight performance degradation on Qwen series after adjusting for LCG (no degradation on GPT-OSS though). Further error analysis on this matter is needed. For example, some qualitative analysis on some reasoning traces: does LCG suppress the diversity/exploration in language models?
2. In light of the above, more experiments could be done evaluating general capabilities after applying LCG.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. Could the token classification method be optimized to handle more fine-grained language distinctions rather than just broad families?

2. What is the specific computational overhead of LCG in large-scale inference?
soundness: 3
strengths: 1. The proposed LCG is a practical and lightweight solution, avoiding the need for model retraining and adding minimal computational overhead.

2. The norm-adjusted self-distillation method effectively mitigates the bias towards high-resource languages caused by token embedding norm imbalance.

3. The work distinguishes between harmful language confusion and legitimate code-switching, ensuring the model retains necessary multilingual expression capabilities.
summary: This paper addresses the language confusion issue in LLMs, where models inappropriately mix languages during generation. It proposes the LCG (Language Confusion Gate), a lightweight plug-in module that filters tokens during decoding without modifying the base LLM. Trained via norm-adjusted self-distillation, LCG predicts possible language families and applies masking when necessary. Experiments across various models show that LCG reduces language confusion while maintaining task performance.
weaknesses: 1. LCG only classifies tokens into broad language families (CJ, Latin, Symbols, Low-Res), failing to resolve confusion between languages sharing the same script (e.g., Chinese vs. Japanese).

2. The evaluation’s reliance on rule-based detectors for language confusion may have limitations, especially in complex multilingual contexts.

3. The paper does not discuss the generalization of LCG to more low-resource languages beyond the tested ones.

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 2
questions: 1. How do you perform the threshold calibration for the sigmoid function in the MLP? What is the criteria to determine that?
2. Do you try any multilingual tasks, where the model need to respond in at least two different languages? Does the proposed method help in that scenarios?
soundness: 3
strengths: 1. The paper introduces a norm-adjusted self-distillation training signal for a language-family gate. I consider it as a very simple idea distinct from weight edits or reward finetuning.

2. The paper demonstrates empirical gains of the proposed method across open and closed models.
summary: The paper proposes the Language Confusion Gate (LCG), injecting a lightweight MLP layer into LLM to reduce unintended mixing of scripts/languages during LLM decoding. This is based on the observations (i) language confusion is rare and the correct-script token is usually ranked in the top-k, (ii) embedding-norm imbalance favors high-resource scripts. The MLP layer is trained to predict which language families should be permitted at each step and mask others in the logits LCG reduces both Chinese/Japanese and Latin confusion by up to an order of magnitude on translation and QA settings (FLORES+, INCLUDE) and on “thinking” models for code generation (HumanEval-XL), with negligible or no degradation in BLEU/accuracy/Pass@k. This method works for both thinking and non-thinking models.
weaknesses: 1. The paper calculates “code-switch rate” on FLORES-WITH-LATIN but does not include human judgments or llm-as-a-judge on the responses. It could offer more evaluation on whether the improved responses are also preferred by humans. 

2. Are there cases that the proposed method do not help to correct the language confusion and could even increase the problem? It would be helpful to showcase some negative cases as well.

---

confidence: 4
contribution: 3
initial_rating: 8
presentation: 3
questions: - Could you provide statistics indicating how many tokens are disallowed at certain timestamps? 

Line 206 contains a typo
soundness: 4
strengths: This paper identifies a rare, but important, failure mode for LLMs. They provide interesting analysis to motivate studying and solving this problem, then introduce several specific technical innovations to address it. 

S1. This paper is extremely well motivated. I was initial skeptical of the prevalence of the problem, but the paper expands on prior work by Marchisio et al. showing that the problem setting is realistic. Sections 2 and 3 are particularly effective in exploring why harmful language confusion happens (e.g. showing that the language confusion token is the top-1 choice 56% time). 

S2. Paper introduces high resource language (HRL) norm bias. The authors show that output tokens with very high norm are naturally higher in the distribution (230-241), and that HRL tokens are over-represented in the top 5% of token output norms. In 264-265 the authors are very precise about the claims, stating they do not claim that this phenomena accounts for all confusion and thus cannot be used as a direct signal. Rather they use this to normalize measurements when training the classifiers. 

S3. The classifier and gating mechanism are very carefully designed - section 4.3 lists deterministic rules of when the classifier can override the expected token prediction. These ensure that the masking does not prevent fluent outputs. 

S4. The evaluations are broad and relevant, including both translation focused tasks derived from FLORES and tasks suitable for reasoning models. The evaluations also carefully distinguish between harmful and intentional code mixing (e.g. WITH-LATIN scenario).

S5. Appendix A details the analysis of partial unicode characters present in model vocabulary - these are details often missed in other papers that study tokenization. The examples in the appendix and discussion of connections between token gating and speculative decoding are also interesting. 

Overall this is a very strong and well-executed paper.
summary: This paper introduces the Language Confusion Gate, which is a mechanism to prevent language confusion. Language confusion is the scenario in which a model mistakenly uses tokens from an inappropriate language - such as including Latin text in a language that does not typically have code switching (e.g. Chinese or Japanese). This paper distinguishes between "harmful confusion and acceptable code-switching." The authors carefully construct test scenarios by analyzing token distributions, properties of unicode, and task relevant exceptions such as english technical terms in otherwise non-english text. The authors construct a classifier trained on final hidden states, accounting for interesting observations about HRL token norms, and use this classifier to gate allowed tokens at model decoding. This method is effective at reducing harmful confusion, permitting intentional language mixing, and maintains task performance. I found the analysis of why language confusion happens (top logit distributions, insufficiency of greedy decoding, high norm bias) particularly interesting and insightful.
weaknesses: None of these weaknesses should be taken as a reason to avoid publication.

- It would be interesting to see how experimental results change if the additional deterministic intervention rules were not used to further control the gating mechanism 

- If there exist a lightweight way to do experiments going beyond the CJ/Latin split, it would be quite interesting to see those results. Perhaps leveraging further unicode metadata? However this is not necessary, it would simply further strengthen the paper. 

- Further investigation of the high-norm tokens would also be interesting. Could these be tied to token frequencies in pretraining data, for models with known data (e.g. olmo models?). Also, the causality direction between high norms <> HRL tokens could be further investigated.


Decision: Accept (Poster)