Qwen3.8-27B β Korean CJK-Output Suppression (M2)
Reduces, at the weight level, the phenomenon where Hanja/kana leak into the middle of a
sentence when answering in Korean. Only 54,902 CJK-token rows of lm_head are replaced.
μΈκΈ°κ°ζι«η ν΄μ μλ¬Ό ν
λ§νν¬ β base (a very popular marine-life theme park)
μ€ν 6μεεη(κ²½κ³) μκ°λλ β base (the time slot around 6pm)
νμΌ λ²μ ε·ε λ§μ§λ§ μμ μκ°μ β base (the file version number and last-modified time)
β οΈ This repo has no weights β it's a recipe
Only one tensor, lm_head.weight, changes, and 31 of the 32 files (55.6GB total) are
byte-identical to the original. Rather than making another 55GB copy, it's better to download
the original and run the script here β it follows the base whenever it's updated, and diff
shows exactly what changed.
hf download Qwen/Qwen3.8-27B --local-dir ./Qwen3.8-27B
python apply_mask.py --model-dir ./Qwen3.8-27B --mask mask_m2-medium.json
Takes a few minutes on CPU (no GPU needed). The script verifies the margin before writing,
and after writing it reloads and asserts that no unintended tensor changed. --dry-run lets you
measure only, without writing.
| File | What |
|---|---|
apply_mask.py |
Script applied to the original (measure β verify β patch 1 shard β verify on reload) |
mask_m2-medium.json |
Adopted mask β 54,902 tokens |
mask_m1-conservative.json |
Conservative mask β 34,187 tokens (kana + simplified-only) |
mask_m3-full.json |
Full mask β 58,888 tokens (β breaks Hanja glosses, see below) |
build_masks.py |
Script that rebuilds the 3 masks from the tokenizer |
What changes
Measured paired, 3,369 prompts, same engine (temperature=0.0, max_tokens=400).
| Contamination rate | True errors* | |
|---|---|---|
Qwen/Qwen3.8-27B |
2.55% | 1.81% |
| M1 applied | 1.51% | 0.83% |
| M2 applied (recommended) | 0.68% | 0.18% |
| M3 applied | 0.06% | β |
* True errors excluding legitimate Korean Hanja glosses (κ°ν(ιζΈ―)). McNemar p < 0.0001,
5.7x the run-to-run noise floor of 0.33pp.
Korean Hanja glosses are preserved. On 12 prompts that explicitly requested Hanja, M1 and
M2 generate 12/12 identically to base. CJK input is also read unchanged β embed_tokens
and the tokenizer are not touched.
coding (HumanEval) base 92.19% = M2 92.19%, delta 0.0pp (n=64).
β οΈ At n=64 the minimum detectable difference is 13.29pp, so this is formally
INSUFFICIENT_N β read it as "not detected," not as "no regression."
Method
Replaces the target rows of lm_head.weight with a large negative multiple of the mean
hidden-state direction.
W_i := -alpha * mu_h / ||mu_h||^2 (alpha = 200)
lm_head has no bias, so zeroing a row only makes its logit 0, not βinf. The moment every
other candidate is negative, 0 becomes the argmax. mu_h is measured as the mean final
hidden state over 6 Korean sentences (PROBE_TEXTS in apply_mask.py; across two independent
measurements ||mu_h||Β² reproduced within 0.4%, at 9845.958 / 9887.059). The resulting logit is
β217.0 versus a max of 16.5.
β Using "the mean W row of Hangul tokens" as a proxy for mu_h was tried and rejected
(cos(mu_h, mu_W) = 0.048, essentially orthogonal). A forward pass is required.
What was cut and what was kept
By character, 72.3% of contamination is traditional/shared Hanja that Korean also uses, so
"cut simplified-only" alone isn't enough. But by token, 355 of 498 contamination events are
whole Chinese-word tokens like ζ¨ηΒ·θ΄΅ε
¬εΈΒ·ε
·δ½ζΆι΄. Korean Hanja glosses are split
into individual characters (κ°ν(ιζΈ―) β ι, ζΈ―).
So M2 cuts kana + simplified-only + pure-Hanja tokens of 2+ characters (54,902 of them) and
keeps single-Hanja tokens. The cost is Korean Sino-Korean words that happen to be single tokens,
like λͺ©μ Β·μ¬κ³ .
M3 (full, 58,888 tokens) brings contamination down to 0.06%, but Hanja glosses collapse from
12/12 to 3/12, and even the remaining 3 produce wrong Hanja (ε΅ζ¬βε, μμΉμ§λ§βε£Ίι½).
It's included for comparison only and is not recommended.
Using this on another model
Token ids are tied to the tokenizer. For a different checkpoint, rebuild the mask.
python build_masks.py --model <your/model> # requires transformers, opencc
Limitations
- β οΈ Serve at low
temperature. Temperature drives the contamination rate by 5x β on the same model, same prompts,T=1.0gives 9.33% vsT=0.0gives 1.92%. All numbers in this card are atT=0.0. - The floor of pruning is not 0. Even under the full mask, 2/3,369 remained, and the
culprits were
ιΒ·θ©. Rare Hanja have no standalone token in the vocabulary and are assembled from byte fragments (ιβ[98248, 243]), and those byte tokens cannot be cut β cutting them breaks arbitrary UTF-8 handling. - Capability verification was done on the coding axis only.
longctxΒ·kmmluΒ·englishwere not measured. - The Hanja-cost probe has n=12, so the confidence interval is wide ([75.75, 100]).
- Applying the same recipe to a 0.8B model failed to reproduce (proxy 0.20% vs true-weight
1.33%, 3.4x the run-to-run floor). The leak was
γ»in code context, not Korean context. The 27B model shows zero contamination on the same code-context probe, but don't assume this holds unchanged on small models. Why only 0.8B breaks through is still unknown. - This is sanitization, not style improvement. Humanness / Korean prose-style axes are out of scope.
Prior work
β The approach itself is not novel.
dnotitia/smoothie-qwen already distributes
pre-adjusted Qwen3 0.6Bβ235B checkpoints in the same direction (adjusting Qwen's lm_head to
suppress Chinese).
What this repo adds is the M1/M2/M3 mask curve, designed around Korean Hanja-gloss preservation as an explicit design axis, and the three observations noted above (temperature drives it 5x Β· the floor isn't 0 because of byte assembly Β· the same recipe doesn't reproduce on 0.8B).
Related: SASFT (ICLR 2026) Β· Korean token pruning Β· TLPO (ACL 2026)
Other languages
Repos that redesign the same technique per target language. On 2026-09-01 the remaining five languages were also measured (300 prompts each, paired T=0/1.0 measurement).
| Language | Repo | Criterion | Measurement |
|---|---|---|---|
| Korean | (this repo) | simplified/kana + pure-Hanja 2+ chars | β 3,369 prompts |
| Japanese | ja | Shift-JIS repertoire | β³ 5.0β0.33% (borderline) |
| Traditional Chinese | zh-TW | Big5 repertoire | β 40.0β1.33% (T=1.0) |
| Cantonese | yue | Big5-HKSCS repertoire | β 20.33β0.67% (T=1.0) |
| Vietnamese | vi | full CJK (zero legitimate use) | β³ 2.0β0.0% (borderline) |
| Arabic | ar | iso8859-6 + tashkil/digit exceptions | β contamination not observed (null) |
β Do not reuse this repo's mask on another language as-is. 11 of 12 common Japanese words
get cut by this M2 mask β the rule "pure-Hanja token of 2+ characters = Chinese word" only holds
under Korean orthography. build_masks_multi.py holds the per-language rules.
License
apache-2.0 β same as the base model Qwen/Qwen3.8-27B. This repo distributes only the mask
and scripts, and does not redistribute weights.
Model tree for ThakiCloud/Qwen3.8-27B-ko-cjk-suppressed
Base model
Qwen/Qwen3.8-27B