Removing Chinese leakage from a local model's Japanese medical answers by editing only the output layer (Qwen3.8 Flash Nextに混ざる中国語を、出力層の書き換えで消した: 27%→0%)
A · Strong evidence A CAPH TECH experiment with full method, byte-level verification of what changed, a confidence interval and explicit limits; small sample and published partly to show the company's own tool.
Summary based on the full text·Original: about 10 minutes to read
In short
A Zenn post (November 2026) from CAPH TECH, a small Japanese software firm, on fixing a local model that mixes Chinese into Japanese medical answers. Qwen3.8-Flash-Next in 4-bit MLX on a 128 GB Mac produced simplified characters and Chinese words in 27% of 60 medical answers, mostly in long free-text explanations for patients. Replacing the output-layer rows of 25,451 Chinese-only tokens with a copy of an unused row removed the leakage with no other weights changed. The team then verified at byte and output level that nothing else had moved, using its open tool Kestrom.
Key numbers
- 16 of 60 (27%) → 0Japanese medical answers containing Chinese text, original vs edited model
- about 17%-39%95% interval around the original 27% leakage rate, given 60 questions
- 13 of 20free-text patient explanations with Chinese leakage in the original model, vs 3 of 40 multiple-choice explanations
- 25,451output-layer rows replaced (Chinese-only tokens), out of 248,320 rows
- 116 filesmodel files byte-identical to the original apart from the banned rows
As reported by the source.
Japanese·Web page·opens zenn.dev
What it reports
- Examples: "误って" instead of "誤って", "给水管" in the line after a correct "給水管", Chinese words such as "这样的" and "啤酒" inside Japanese text.
- Test set: 60 questions, 40 from seven medical subjects of JMMLU (explain the answer in Japanese) and 20 free-text tasks such as patient explanations and referral letters. Thinking on, recommended sampling, up to 8,192 tokens.
- Original model: 16 of 60 flagged automatically, 14 of 60 (23%) after reading (two false positives); 3 of 40 multiple-choice vs 13 of 20 free-text. Qwen3.5-9B gave 15 of 60 under slightly different conditions.
- Ban list: 21,601 tokens with characters outside JIS X 0213, plus 3,850 tokens that appear 20 or more times in Chinese Wikipedia and at no more than 1% of that rate in Japanese Wikipedia, with genuine Japanese terms removed by hand.
- Method: the 25,451 rows were overwritten with a byte copy of row 248077, one of 243 output rows not mapped to any token; the edit copies only the output-layer file (about 650 MB) and links the rest (nearly 100 GB).
- Edited model: 0 of 60 with leakage (one automatic false positive on the correct Japanese "尿沈渣"); banned tokens never in the top 20 at any of 36,969 positions; median answer length 754 vs 714 characters.
- Verification: all 116 files identical except the banned rows; greedy outputs without thinking matched the original exactly on all 60 prompts. Reloading the model was needed for reproducible comparisons, since 49 of 60 answers changed when re-sent without reload.
How they got it
A controlled before-and-after on the same prompts and settings, with automatic flagging checked by reading every answer, a byte-range diff of model files and greedy-decoding comparisons. Implementation was done with Claude Code.
Limits
- 60 questions, medical domain only; the authors give the 95% interval.
- Banning is per token: with Qwen3.5-9B some Japanese words written only with banned tokens were truncated (6 times in 300 questions); not seen here, but not ruled out.
- The scores of banned tokens could not be measured, only their absence from the top 20; the assumption that the unused row scores low is unverified.
- Tested only on the MLX version under mlx-serve, not GGUF builds.
- The editing tool has a paid commercial licence for larger firms.
Why it matters for companies
Companies running open-weight models locally for patient, customer or legal text in Japanese or other languages can face this leakage, and it is worst in exactly the long explanatory answers that reach the public. A narrow output-layer edit is cheaper than fine-tuning and can be verified precisely, which matters for regulated content. The reload finding is also practical: comparisons between model versions on a serving stack with prompt caching can show differences that are not caused by the model.
Key passages in translation
Japanese original
出力層の重みのうち、中国語の語(トークン)に当たる25,451行だけを書き換えると、同じ条件で混入はなくなりました。他の重みは1バイトも変えていません。
Rewriting only the 25,451 output-layer rows corresponding to Chinese tokens removed the mixing under the same conditions. No other weight changed by even one byte.
Japanese original
選択問題では40問中3問でしたが、自由記述では20問中13問で混ざりました。長い説明文ほど混ざりやすいようです。
It was 3 of 40 for multiple-choice questions, but 13 of 20 for free-text answers. Longer explanations seem more prone to mixing.
Japanese original
60問は少ない数です。元の27%は、95%の区間でおおよそ17%〜39%の幅があります。
Sixty questions is a small number. The original 27% has a 95% interval of roughly 17% to 39%.
Summary based on the full text. Read the original for the full argument and data.Read the original on zenn.dev
- Tags
- Local models