Finding Other Languages Hidden in Korean and English Prompts with 0.68M Parameters
If you run an LLM service designed to answer only in Korean and English, you meet prompts like these. A Korean question has one line of Russian in the middle. An English request ends with a Spanish proverb. Someone pastes a whole Chinese sentence and asks for a translation. Policy says such inputs should take a separate path, but a language identifier that assigns one language to the whole sentence often misses a short foreign segment inside a Korean sentence. This post is for the LLM service engineers and safety policy owners who design those guardrails.
On November 24, 2026, ThakiCloud released a small model on Hugging Face that answers only that one question. It is Thaki-LangMix-KoEn-0.7M-Research, with 684,655 parameters in a 2.8MB file. On 48,085 test rows never used for training or selection, English monolingual false positives were 0.29% and recall on Korean sentences mixed with another language was 90.35%. On the same rows, fastText lid.176 reached 22.86% Korean mixed-language recall.
Leaving Korean and English mixing alone and catching only other-language segments is something a character-level tagger can do well on a CPU. False positives are higher on casual English chat, though, so this release is a research checkpoint, not a product. Below we go through what the model does, where the numbers come from and what to know before using it.
Thaki-LangMix-KoEn-0.7M-Research is a 684,655-parameter character tagger that finds segments outside Korean and English.
It labels every character, not the whole sentence
The model assigns one of seven labels to each character of the input: NEU (characters without a language, such as digits, spaces and punctuation), KO, EN, ZH, JA, XLAT and XOTH. XLAT is another language written in Latin script, such as French or Spanish, and XOTH is another script, such as Cyrillic, Arabic or Thai. Separately, a sentence head outputs one probability that the sentence mixes in another language. There is no tokenizer; the only inputs are the characters and their Unicode script.
The final decision comes from a rule stored in the checkpoint. Counting letters only, it flags a text when a run of at least 2 letters has P(ZH)+P(JA)+P(XOTH) of 0.9 or more, or a run of at least 8 letters has P(XLAT) of 0.9 or more, and at the same time the sentence head’s mixed probability is 0.2 or more. These values were chosen on the development split. A sentence that mixes only Korean and English is not flagged. A Korean sentence that borrows English words such as sprint, login API and timeout is normal input under this policy.
Three self-written sentences from the pre-release smoke test. In the release record, all 22 probe sentences matched their intended flag.
Inputs longer than 512 characters are truncated to the first 512, the same condition used in training and evaluation. The only packages you need are torch and numpy.
# pip install torch numpy
from huggingface_hub import hf_hub_download
d = hf_hub_download("ThakiCloud/Thaki-LangMix-KoEn-0.7M-Research", "ckpt_cmtl.pt")
hf_hub_download("ThakiCloud/Thaki-LangMix-KoEn-0.7M-Research", "thaki_langmix.py", local_dir=".")
from thaki_langmix import LangMix
m = LangMix(d)
m.scan("My grandmother always said no hay mal que por bien no venga when things went wrong.")
m.flag_batch(["Could you summarize the main differences between these two database designs?",
"Write a short birthday message for my coworker who loves hiking."]) # [False, False]
The checkpoint loads with torch’s restricted unpickler, torch.load(..., weights_only=True), and needs no extra globals. In the fallback path for other torch versions, the reference code allows numpy scalar types only and refuses anything else.
Same architecture, different training data
The improvement over the previous round came from the training data, not from a new architecture. The tagger itself is simple: a character embedding concatenated with a script embedding, followed by five dilated convolution layers. Dilated convolution widens the spacing each layer looks at, so a small number of parameters can cover a long context.
Training the same tagger on the new data alone cut English false positives from 1.81% to 0.23%. The new data is Tatoeba sentences plus hard negatives. Hard negatives are normal inputs that a model tends to get wrong, collected on purpose for training; here they were names, abbreviations, code and loanwords. A sentence like “I met Jean-Pierre and Sofia at the Barcelona office” is English even if some words look French or Spanish.
The sentence head mainly protects recall. If you tighten the rule to lower false positives with the character tagger alone, recall drops too. With a stricter split rule the previous tagger gets English false positives down to 0.09%, but Korean mixed-language recall also falls to 80.25%. This checkpoint flags only when both the run rule and the sentence-head condition are met.
The convolutional tagger is the same. What changed is the training data and a decision rule that adds a sentence-head condition to the run rule.
0.29% English false positives on an unseen test set
We evaluated on ITEST21, the test set of our internal development round R21. It has 48,085 rows and was not used for training or selection. Rows were deduplicated against all training and development pools and earlier test sets by normalized sentence hash and 64-character shingles. Shingling cuts text into fixed-length pieces to find overlapping parts. Rates are row-level and brackets are Clopper-Pearson 95% intervals. On monolingual cells the flag rate is the false-positive rate; on mixed cells it is recall.
| Cell | Rows | Flagged | Rate | 95% CI |
|---|---|---|---|---|
| English monolingual (false positives) | 16,950 | 49 | 0.29% | 0.21~0.38% |
| Korean monolingual (false positives) | 12,046 | 10 | 0.08% | 0.04~0.15% |
| Korean + other language (recall) | 4,527 | 4,090 | 90.35% | 89.45~91.19% |
| English + other language (recall) | 5,062 | 4,431 | 87.53% | 86.59~88.43% |
Compared with the previous round’s tagger, English false positives fell by 1.52pp (percentage points), with a cluster-bootstrap 95% interval of −1.73 to −1.32pp. A cluster bootstrap resamples rows from the same source row or conversation as one group to measure the uncertainty of a difference. Korean mixed-language recall fell by 2.8pp in exchange.
Before release, we ran the public thaki_langmix.py on the full ITEST21 set in a separate CPU job and compared it with the original training-run code. Over 48,085 rows the maximum absolute difference in probabilities was 0.0 and there were 0 flag mismatches. The four cells above also matched the stored values. In other words, you can get the same numbers from the code you download.
Sentence-level language identifiers missed most mixed segments
We compared other detectors on the same ITEST21 rows. Lower is better for false positives, higher is better for recall.
| Detector | EN FP | KO FP | KO-mix recall | EN-mix recall |
|---|---|---|---|---|
| this model | 0.29 | 0.08 | 90.35 | 87.53 |
| previous round’s tagger (single rule) | 1.81 | 0.16 | 93.15 | 90.50 |
| previous tagger, stricter split rule | 0.09 | 0.07 | 80.25 | 79.71 |
| existing lightweight in-house detector (not released) | 0.26 | 0.28 | 55.86 | 38.29 |
| fastText lid.176 (threshold chosen on development) | 0.47 | 0.18 | 22.86 | 42.26 |
| GlotLID v4 (threshold 0.5) | 0.50 | 0.26 | 19.95 | 26.89 |
On English false positives alone this model is not the lowest. The previous tagger with a stricter rule and the in-house lightweight detector are similar or lower.
Judged on English false positives alone, this model is not the best option. Against the lightweight in-house detector the difference interval is −0.08 to +0.14pp, so they are at the same level. The difference is in recall: at the same false-positive level, mixed-language recall is 34.5pp higher for Korean and 49.2pp higher for English. The general-purpose language identifiers fastText lid.176 and GlotLID v4 reached 22.86% and 19.95% Korean mixed-language recall on this task of catching foreign segments inside Korean sentences.
The previous round’s tagger has the highest Korean mixed-language recall (93.15%); this model is at 90.35%. General language identifiers were around 20%.
There are finer cells as well. Recall for 1~3 token insertions into Korean is 76.93%. Recall for other Latin-script languages (XLAT) inserted into Korean is 76.0%, and into English 63.5%.
A p50 of 1.23ms on one CPU thread
CPU cost was measured in a CPU-only container limited to 8 vCPUs, with PyTorch 2.9, 1,000 rows, batch size 1 and the median of 3 runs.
| Setting | p50 | p95 | p99 | Throughput (batch 256, flags) |
|---|---|---|---|---|
| 1 thread | 1.23 ms | 2.40 ms | 6.47 ms | 1,079 rows/s |
| 8 threads | 1.04 ms | 1.82 ms | 7.04 ms | 4,350 rows/s |
The checkpoint is 2,839,835 bytes and takes about 1.15 seconds to load. Added resident memory, counting torch import, loading and running together, is about 486MB with 1 thread and about 482MB with 8 threads. Almost all of that is the PyTorch runtime; the model’s own share is small.
The lightweight in-house detector runs at about 0.1ms p95 with 8MB of memory. This model is roughly 25 times slower and needs PyTorch. You gain 34.5pp and 49.2pp of mixed-language recall in exchange for more latency and memory, so on a path with a tight per-request budget in milliseconds, weigh this cost first.
False positives are higher on casual English chat
After the release decision we ran one more report-only check whose reading we had written down in advance (preregistered). Report-only means the result is reported but not used for the verdict. The targets were English conversational prompts the model had never seen: first user turns marked English in WildChat-4.8M shard 37, and NVIDIA HelpSteer2 prompts. Rows overlapping training, development or earlier test pools were removed by sentence hash and 64-character shingles. Labels are PROGRAMMATIC: “marked English and monolingual by script.” No human or LLM labeled them.
| Evaluation layer | Rows | This model | Previous round’s tagger | Lightweight in-house detector |
|---|---|---|---|---|
| WildChat shard 37, English | 1,332 | 0.90% (12 rows; CI 0.47~1.57%) | 4.73% | 0.45% |
| HelpSteer2 prompts, English | 5,994 | 0.17% (10 rows; CI 0.08~0.31%) | 2.34% | 0.03% |
On WildChat shard 37 the preregistered reading “upper bound at most 1%” was not met (upper bound 1.57%).
On both the WildChat and HelpSteer2 layers, false positives are clearly lower than the previous round’s tagger: −3.83pp on WildChat (interval −4.89 to −2.70) and −2.17pp on HelpSteer2 (interval −2.56 to −1.78). But the preregistered reading “WildChat upper bound at most 1%” was not met. On HelpSteer2 the model is slightly worse than the lightweight in-house detector (+0.13pp, interval +0.02 to +0.25). The previous tagger with the stricter split rule scores 0.30% and 0.00% on these two layers.
A rule-based breakdown of the 12 WildChat flags shows that 6 contain real foreign-language text, 2 are code and 4 are abbreviations, names, short context or other. So the English labels of this layer are not entirely clean either. A small natural-mix layer collected from shard 37 (113 rows, Silver rule labels) was caught at 99.1%.
On a set we had already opened, the number is larger. On the English WildChat layer of the previous round’s test set (shards 82~83), this model flags 2.54% of English monolingual prompts, or 1.65% over that set’s whole English monolingual cell. Because we opened this set before this round, we report it as report-only. On the same set a simpler rule on our previous model scores 2.10%, so there this checkpoint is not the best English filter. By our error breakdown, about 21% of those “false positives” contain real foreign text. The 0.29% on ITEST21 comes from English rows that are mostly edited text such as news, Wikipedia and instructions, and the real-chat layer inside it (WildChat shard 36) is 0.54%. Expect a higher false-positive rate on casual chat than on edited text.
Limits to know before using it
- False positives on casual English chat are high. 2.54% on the already-opened WildChat English set, and 0.90% on the new shard 37 (upper bound 1.57%). Wiring it straight into English chat traffic as a blocking rule can catch normal requests.
- Korean mixed-language recall is lower than the previous round. It is 90.35%, down from 93.15%. That is within the preregistered non-inferiority margin (−5pp), but the drop is real.
- Short insertions are caught less often. 1~3 token insertions are caught 76.93% of the time. A single foreign word is often missed by design.
- Other Latin-script languages need a run of 8 letters. So short French or Spanish phrases inside Korean are missed more often (76.0% in Korean, 63.5% in English).
- Mixed test rows are mostly synthetic. They were built by code from monolingual sources. The natural-mix layer uses Silver rule labels and the tagger looks at the same signal, so it is weak evidence.
- It is not a general language identifier. It answers only “is there a segment outside Korean and English” and does not reliably identify languages beyond its seven classes.
- All labels are automatic. There are no human labels and no LLM labels. Labels are PROGRAMMATIC (the source is monolingual or the insertion is synthetic) or Silver (rule).
The internal round verdict is MODEL_GO. That means it passed all preregistered gates of round R21 on the R21 test set; it is not a product release decision. That is why the name ends in Research.
Weights and code have different licenses
Parts of the repository carry different licenses, and they are not combined into one. ckpt_cmtl.pt, which holds the weights, character vocabulary and stored rule, is CC BY-SA 4.0. The inference code thaki_langmix.py and evaluation code evaluate_langmix.py are MIT. The documentation and self-written probe sentences are CC BY-SA 4.0.
We chose CC BY-SA 4.0 for the weights because some training sources, Wikipedia and Wikisource, are share-alike. We do not claim that the licenses of the training data pass to the weights or that they do not; we took the conservative option. Commercial users should note that the weights carry the SA condition.
The network was trained from random initialization, with no base model, on 137,398 rows. The training sources are listed below; the data itself is not in the repository.
- WildChat-4.8M (
allenai/WildChat-4.8M, revisionc827c6df): first user turns from shards 68, 80 and 81 (training) and shard 69 (development). ODC-BY 1.0. Zhao, Ren, Hessel, Cardie, Choi and Deng, WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024), Allen Institute for AI. - MASSIVE 1.1 (Amazon): train split (training), dev split (development), 51 locales. CC BY 4.0. FitzGerald et al., MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages (2022).
- Wikipedia (
wikimedia/wikipedia, revisionb04c8d1c,20231101.koshard 0,20231101.enshard 9) and Korean Wikisource (wikimedia/wikisource, revisionf31a033f,20231201.koshard 0). CC BY-SA and GFDL. Wikipedia and Wikisource contributors, Wikimedia Foundation. - Tatoeba: per-language sentence exports downloaded 2026-11-24 (eng, kor and 18 Latin-script languages). CC BY 2.0 FR. Tatoeba (https://tatoeba.org) and its contributors.
Synthetic mixed rows, hard negatives and word lists were generated by code from the sources above. The Leipzig Corpora Collection was used for evaluation only, never for training or selection. No AI-Hub data, gated datasets, non-commercial or no-derivatives data, LLM-generated text, human annotation or paid API was used for training or selection. Evaluation-only sources and the comparison baselines (fastText lid.176, GlotLID v4) are listed separately in NOTICE.md, and nothing derived from them is in the weights.
In Paxis, it fits the branching step in front of a policy gate
This checkpoint is not yet a feature in Paxis. We released a research checkpoint, and whether it goes into a product depends on resolving the limits above first.
There is still a place where it would fit. Paxis is ThakiCloud’s Agent-Native Cloud, and it passes an agent’s inputs and actions through policy gates and audit logs. “Allow only Korean and English” is a common condition at such a gate. At a little over 1ms on one CPU thread and 2.8MB on disk, this model suits branching inputs in front of the gate without a GPU. It also runs as is in on-premises or air-gapped environments where an external language identification API is not available. Given the false positives on casual English chat, though, it belongs first where mistakes are cheap: routing “this input has another-language segment” to separate handling, or marking it in the audit log, rather than blocking.
Closing
Thaki-LangMix-KoEn-0.7M-Research is a 684,655-parameter character tagger that allows Korean and English mixing and catches only other-language segments. On an unseen test set it had 0.29% English false positives and 90.35% Korean mixed-language recall, far higher mixed-language recall than general language identifiers. The improvement came from changing the training data. On casual English chat, however, false positives are higher, reaching 2.54% on the already-opened WildChat English set. That is why we released it as a research checkpoint this time.
The first experiment to run is measuring false positives on your own traffic. Put your service’s English and Korean monolingual prompts and mixed prompts into JSONL with text, y and cell fields, run the repository’s evaluation script, and you get the same Clopper-Pearson intervals and cluster bootstrap.
python evaluate_langmix.py --ckpt ckpt_cmtl.pt --data my_rows.jsonl
The model and code are in the Hugging Face repository.
Sources and data
- Model: ThakiCloud/Thaki-LangMix-KoEn-0.7M-Research (Research, released 2026-11-24, commit
15338ee3). Weights CC BY-SA 4.0, code MIT. All numbers in this post come from the model card (README.md, MODEL_CARD.ko.md); the match of the 22 self-written probe sentences comes from the release verification record. - Training data attribution: the repository’s NOTICE.md. Training and evaluation data and dataset text are not included in this post or the repository. The example sentences in the figure are self-written sentences from the repository’s
probes.json, not dataset text. - Related posts: LLM Guard Flagged 91% of Korean Prose as Code. v2 Gets It to 0% · Why We Didn’t Ship a Model That Scored F1 0.99