Before the tokenizer even starts splitting, normalization runs. What does it do and why?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Normalization is the preprocessing step the tokenizer runs before pre-tokenization: Unicode normalization, lowercasing, accent stripping, whitespace collapsing. It makes equivalent strings produce identical token ids.
Imagine the same word 'cafe' can be typed two different ways on your keyboard: one way uses a single special character with the accent baked in, and the other way uses the plain letter 'e' followed by an invisible accent mark. To you, both look identical. To the tokenizer, they are different sequences of bytes and could end up with different token ids, which means the model would treat them as two different words. Normalization is the cleanup step that fixes this: it rewrites both forms into a single canonical form before tokenization even starts. Some normalizers also lowercase everything, strip accents entirely, or collapse repeated whitespace. The exact recipe is part of the tokenizer's configuration and has to match between training and inference. Modern OpenAI tokenizers do almost no normalization; some other tokenizers do a lot.
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.
5 min: define normalization as the first stage of the tokenizer pipeline, name the four Unicode normalization forms, explain why NFC matters for byte identity, contrast tiktoken's minimal normalization with Hugging Face's explicit normalizer config, and warn that training and inference normalization must match.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming all tokenizers normalize the same way. tiktoken does almost nothing; Hugging Face tokenizers vary widely. Mismatched normalization between training and inference produces silent drift in token sequences.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.