Click any words you think contain an error. Click again to unmark.
Training on NFC and serving with NFKC is a silent bug: NFKC folds compatibility characters that NFC keeps, so identical-looking text tokenizes to different IDs at inference.
Imagine you learned to read using a textbook where every word was spelled the long way, like 'f-i-r-e'. Then someone hands you a new book where some words use fancy joined-up letters you have never practiced. You can still sound it out, but you stumble, because it does not match how you learned. That is what happens here. The tokenizer was trained with one spelling cleanup rule (NFC) and then handed text cleaned with a stricter rule (NFKC) that rewrites ligatures, shrunk-down characters, and circled numbers. The text looks the same to a person, but the underlying letters differ, so the model stumbles on exactly those characters and nobody sees an error message.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: NFC vs NFKC compatibility step + why training direction matters + silent failure + Japanese/math/PDF hotspots + pin and snapshot fix.
Real products, models, and research that use this idea.
- Multilingual document RAG pipelines feeding PDF-extracted text, full of ligatures, into a model trained on a different normalization see accuracy drop on those documents only.
- Japanese NLP services that mix half-width and full-width katakana hit this when an upstream service normalizes differently than the tokenizer expects.
- Hugging Face tokenizers expose the normalizer explicitly, so teams pin NFKC or NFC in the tokenizer config to prevent serving-side drift.
What an interviewer would ask next. Try answering before peeking at the approach.
QGiven a deployed model you suspect has this bug, how do you confirm it without retraining?
QIf you must accept arbitrary user input, where in the stack do you enforce normalization?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming any two valid Unicode normalization forms are interchangeable; NFKC rewrites compatibility characters that NFC preserves, so token IDs and model behavior diverge silently.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.