Skip to content

Note on Claude Models Occasionally Outputting Korean, Japanese, and Other Non-Target Languages

Symptoms

When using Claude's official models, or calling Claude models through gahorouter, the following situations occasionally occur:

  • You ask for an answer in Chinese, but the model suddenly mixes in Korean, Japanese, or English midway
  • The first half is in Chinese, while the second half abruptly switches to Korean, Japanese, or another language
  • Language switching is more likely to occur during code explanation, log analysis, long-context conversations, or processing of multilingual materials
  • The user did not actively request a language switch, yet the model's output language changed

Conclusion

This is not gahorouter injecting Korean, Japanese, or other-language content in between. It is a "language drift" phenomenon that occasionally arises in Claude's official models themselves.

Large language models like Claude are trained on vast amounts of multilingual data. When generating content, the model does not first lock in a single language and use it throughout; instead, it continuously predicts the next most likely Token based on the current context. When code, abbreviations, foreign-language terms, logs, or multilingual materials appear in the context, or when there is a degree of randomness in sampling, the model may slide from a Chinese context into the language space of English, Japanese, Korean, or others.

gahorouter is primarily responsible for unified model access, routing, forwarding, billing, and stability assurance. It does not actively change Chinese content into Korean or Japanese, nor does it insert other-language content into the model's replies. gahorouter keeps the content returned by the upstream model exactly as is, to avoid introducing new uncertainty by modifying the model output without authorization.

Why Language Drift Happens

1. The model's training data is itself a multilingual mixture

Large models such as Claude, GPT, and Gemini are all exposed to vast multilingual corpora, including Chinese, English, Japanese, Korean, code, web pages, papers, forums, documentation, and more. These languages are not completely isolated from one another; they coexist within the same model generation space.

When generating, the model predicts the probability distribution of the next Token based on context. Therefore, the model does not "only pick words from a Chinese vocabulary"; rather, it makes selections within an enormous multilingual candidate space.

2. Code, abbreviations, and variable names easily break language boundaries

Much language drift occurs in the following scenarios:

  • Analyzing code or explaining error logs
  • Processing English variable names or API documentation
  • Context containing a mix of Chinese and English
  • User input containing common words such as OK, error, token, model, response
  • Prompts containing multilingual examples

This content looks like "code" or "ordinary English words," but in the model's vector representation space, it may be related to multiple language regions at the same time. If the probabilities of Tokens related to Chinese, English, Japanese, and Korean are very close, the model may, due to sampling randomness, choose another language direction.

3. The first drifting Token affects subsequent output

Large models generate text by advancing Token by Token. If at some step the model outputs a Japanese or Korean Token, then in the next step the model incorporates that Token into the context as well, further raising the probability of continuing to output that language.

It is as if the model reaches a language fork during generation: it should have continued along the Chinese route, but a certain Token causes the model to slide onto the Japanese or Korean route. Once the drift begins, the following sentences may keep generating in that direction, until a new semantic turning point is reached that allows a return to Chinese.

4. Sampling randomness amplifies this phenomenon

The model does not always choose only the highest-probability word; instead, it selects among high-probability candidates according to a sampling strategy.

  • The lower the temperature, the more stable and conservative the output
  • The higher the temperature, the more divergent the output, and the more prone it is to language drift
  • Long context, multilingual context, and code context further increase the probability of drift

How to Reduce Language Drift

1. Use /config to set the language to Simplified Chinese

If you are using Claude Code or a Claude client that supports configuration, we recommend setting the language to Simplified Chinese via /config. This can help, to some extent, establish a Chinese output tendency for the model and reduce the probability of switching to other languages midway.

Note that setting the language via /config can mitigate the problem but does not necessarily eliminate it 100%, because language drift may still be affected by context, code content, and sampling strategy.

2. Explicitly require fixed Chinese output in the Prompt

We recommend adding an explicit language constraint in the System Prompt or user Prompt:

text
You must always answer in Simplified Chinese. Unless the user explicitly
requests a translation or asks to keep the original text, do not output
English, Japanese, Korean, or any other language. Even if the input contains
code, English terms, logs, or error messages, you must explain in Chinese.

A stronger constraint version:

text
All answers must be in Simplified Chinese. Code, commands, variable names,
function names, and error messages may remain in their original language,
but explanations, analyses, summaries, and step descriptions must all be in
Chinese. Do not output English, Japanese, Korean, or other languages outside
of code blocks. If foreign-language content appears in the context, it must
also be translated or explained in Chinese.

3. Lower the temperature

For API calls, we recommend setting the temperature lower, for example:

json
{
  "temperature": 0.2
}

For scenarios that require stable output, such as customer support, knowledge-base Q&A, code explanation, and product documentation, setting too high a temperature is not recommended.

4. Wrap code and logs in code blocks whenever possible

If the input contains code, logs, errors, JSON, YAML, Shell commands, and similar content, we recommend placing it consistently within code blocks:

text
Please explain the cause of the following error in Chinese:

```bash
Error: connection timeout when requesting model endpoint
```

This helps the model distinguish which content is the original material and which content is the body text that needs to be explained in Chinese.

5. Re-anchor the language when drift occurs

If the model has already started outputting another language, you can simply append a sentence:

text
Please answer the previous message again in Simplified Chinese; do not use
Japanese, Korean, or English.

If this happens repeatedly, we recommend starting a new conversation and stating the language requirement clearly in the first Prompt.

If the methods above still fail to alleviate the issue and language drift occurs frequently, please contact our staff, and we will help investigate the specific cause.