Code-Switching Reveals Language Anchoring in Multilingual LLMs

Jeonghyun Park, Seunghyun Yoon, Yonghyun Jun, Hwanhee LeearXiv 2026

TL;DR

Multilingual Large Language Models (MLLMs) frequently suffer performance drops when processing code-switched (mixed-language) text due to an internal geometric shift driven by the sentence's grammatical structure. To fix this, the authors introduce CANVAS, a lightweight, training-free inference intervention that dynamically steers mixed-language hidden states back toward a monolingual "source" anchor, consistently recovering downstream task accuracy across diverse model families.

What Problem Does This Paper Address?

In our globalized world, multilingual speakers frequently engage in code-switching (CS)—the practice of alternating between two or more languages within a single conversation or sentence (e.g., inserting English technical terms into a native Korean sentence structure). While modern MLLMs excel at processing clean, monolingual inputs, their performance degrades significantly when faced with these structured, mixed-language forms.

Prior research has documented this fragility, but it hasn't explained why it happens from a geometric perspective inside the model's representation space. This paper tackles two core questions:

  1. How are code-switched inputs geometrically positioned relative to their monolingual counterparts?
  2. Can we use these geometric insights to design an inference-time fix that restores model performance without expensive retraining?
Figure 1: Locating code-switched inputs in the mul- tilingual representation space. Source- and target- framed CS variants preserve different grammatical structures for the same information need, plotted along- side their matched monolingual anchors.

Methods

The authors approach the problem through a combination of representation probing and targeted activation steering:

  • Anchor Bias: They introduce a geometric metric called Anchor Bias to measure whether a code-switched hidden state aligns closer to its source language (e.g., English) or target language (e.g., Korean) monolingual reference.
  • Grammar-Forced Probing: To isolate variables, they use pairs of sentences containing the exact same words but organized under different grammatical backbones: source-framed (English structure with foreign words inserted) vs. target-framed (foreign structure with English words inserted).
  • CANVAS (Contextual Anchor-based Neural Vector Alignment Steering): This is their proposed inference-time intervention. During the prefill stage, CANVAS:
  • Partitions the input tokens into source, target, and neutral sets using lightweight script rules or language detectors.
  • Extracts a layer-specific source canvas and target anchor by mean-pooling the hidden states of those tokens.
  • Computes an instance-specific alignment score to determine how much the representation has drifted.
  • Softly interpolates target-language hidden states toward the source canvas, applying this correction only in the upper 30% of the transformer layers where abstract semantic anchoring stabilizes.

Datasets

The authors evaluated their approach across two main benchmarks spanning 9 target languages paired with English (Bengali, Spanish, French, Hindi, Korean, Marathi, Toba Batak, Urdu, and Chinese):

  1. CodeMixQA: Built by mapping fact-seeking queries from SimpleQA Verified into grammar-forced code-switched pairs. This dataset provides a highly controlled environment for representation-level diagnosis.
  2. PingPong: A human-authored, multi-party benchmark for multi-turn code-switched dialogues, used to test how well CANVAS generalizes to noisy, long-context, and even trilingual settings.

Key Insights and Ideas

  • The Grammar-Frame Effect: MLLM representations are heavily dictated by the sentence's grammatical backbone rather than its vocabulary mix. Source-framed sentences remain close to the source anchor, whereas target-framed sentences shift sharply toward the target language space.
  • Anchoring Predicts Performance: This geometric shift directly correlates with behavioral failures. Target-framed inputs exhibit much larger Question Answering (QA) performance drops because they drift away from the source-side processing pathways that better preserve factual knowledge.
  • Late-Stage Window of Opportunity: As shown in the layer-wise analysis, the divergence in language anchoring is small in early layers but becomes highly pronounced in the final 30% of the model. This abstract, late-stage commitment means interventions don't need to rewrite the entire prompt representation from scratch.
Figure 2: Per-layer anchor bias across model depth. Raw ABℓon question-content tokens, averaged across examples, plotted against layer index for each model. Positive: source-anchored; negative: target-anchored.
  • Routing Alignment in MoEs: In Mixture-of-Experts (MoE) models, this anchoring behavior extends to discrete routing choices. The router selects different expert pathways based on the grammatical frame, confirming that language anchoring is deeply embedded in the model's sparse computation paths.

Key Results

  • Consistent QA Recovery: CANVAS consistently improves QA F1 scores across all evaluated MLLMs (including Llama 3.1/3.3, Qwen 3.5, Aya Expanse, Mixtral, and Phi-3.5) and code-switching conditions. The largest gains occur in the most challenging target-framed settings.
  • Closing the Gap with Frontier Models: Applying CANVAS to a moderate-capacity open model like Qwen3.6-35B-A3B brings its code-switched performance within 0.18 F1 of GPT-5.4-mini and actually pushes it ahead of DeepSeek-V3.2, demonstrating that smart representation steering can rival raw parameter scaling.
  • Generalization Beyond QA: The intervention successfully transfers to multi-turn dialogues (PingPong), retrieval-augmented generation (RAG) setups, and non-English source anchors (e.g., using Spanish as the pivot language).
  • Low Overhead: CANVAS operates entirely online during prefill without requiring external model calls or parameter updates, adding a modest average latency factor of just 1.13x.
Figure 3: Latent displacement along the SRC–TGT axis. We project token states onto a 2D subspace where the horizontal axis captures the global SRC–TGT direction. Faded points indicate individual instances, large markers denote condition centroids, and arrows show the directional shift induced by CANVAS.

Limitations and Future Work

While highly effective, the authors note a few limitations:

  • Simplified Axis: The framework models code-switching along a paired source-target axis, which compresses richer, multi-lingual conversational dynamics. Natural code-switching can involve complex local syntax blends and discourse contexts that a single anchor direction cannot fully capture.
  • Token Tagging Bottleneck: For languages that share the same script and are morphologically similar (like Spanish and French), standard language detectors struggle to cleanly partition tokens, which degrades steering precision.

Future work includes developing more granular, multi-anchor steering mechanisms and improving runtime token-level language identification for closely related language pairs.

Summary updated

BibTeX
@misc{park2026code,
  author = {Jeonghyun Park and Seunghyun Yoon and Yonghyun Jun and Hwanhee Lee},
  title = {{Code-Switching Reveals Language Anchoring in Multilingual LLMs}},
  year = {2026},
  eprint = {2606.19668},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.19668},
}
Figure