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

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Zhang, Collin, Huang, Fei, Yuan, Chenhan, Lin, Junyang
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866915564226609152
author Zhang, Collin
Huang, Fei
Yuan, Chenhan
Lin, Junyang
author_facet Zhang, Collin
Huang, Fei
Yuan, Chenhan
Lin, Junyang
contents 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. Code is available at https://github.com/collinzrj/language_confusion_gate.
format Preprint
id arxiv_https___arxiv_org_abs_2510_17555
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Language Confusion Gate: Language-Aware Decoding Through Model Self-Distillation
Zhang, Collin
Huang, Fei
Yuan, Chenhan
Lin, Junyang
Computation and Language
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. Code is available at https://github.com/collinzrj/language_confusion_gate.
title Language Confusion Gate: Language-Aware Decoding Through Model Self-Distillation
topic Computation and Language
url https://arxiv.org/abs/2510.17555