LLM & Transformer Fundamentals·Question 23 of 109Intermediate

Beyond letter counting, what failure modes does tokenization cause? Think arithmetic, multilingual text, and code.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Arithmetic. Numbers tokenize inconsistently: "1234" might be one token while "1235" splits as "12"+"35", and the same quantity chunks differently depending on surrounding text. Place-value alignment - the core of digit-wise algorithms - is destroyed when operands have inconsistent boundaries. This is why several model families force single-digit tokenization for numbers (each digit its own token), which measurably improves arithmetic: consistent structure lets the model learn positional algorithms. Comma formatting ("1,234,567") adds another layer of chunking chaos.

Full worked answer

Arithmetic. Numbers tokenize inconsistently: "1234" might be one token while "1235" splits as "12"+"35", and the same quantity chunks differently depending on surrounding text. Place-value alignment - the core of digit-wise algorithms - is destroyed when operands have inconsistent boundaries. This is why several model families force single-digit tokenization for numbers (each digit its own token), which measurably improves arithmetic: consistent structure lets the model learn positional algorithms. Comma formatting ("1,234,567") adds another layer of chunking chaos.

Multilingual inefficiency. Tokenizers are trained on a corpus; the merges reflect its language mix. English-heavy vocabs fragment other scripts - Hindi, Thai, Khmer, and others can cost 2-5× more tokens than English for equivalent content (byte-level fallback can reduce rare script characters to multiple byte tokens each). Consequences are concrete: users of those languages pay more per request, exhaust context windows sooner, hit output-token limits earlier, and get worse quality because the model reasons over fragmented units. It's an equity issue baked in before any learning happens - and a reason Llama 3 and newer tokenizers expanded vocab with explicitly multilingual data.

Code. Whitespace is syntax in Python, and tokenizers handle indentation via whitespace-run tokens (e.g. a token for 4 spaces, 8 spaces...). Models can confuse indentation levels - an off-by-one-level bug is a tokenization-adjacent failure. Tabs vs spaces tokenize entirely differently. Identifier splitting (getUserById → get+User+By+Id) is usually semantically reasonable, but rare identifiers fragment unpredictably. Modern code-aware tokenizers added dedicated whitespace and indentation handling, which was a real contributor to code-generation quality gains.

General diagnostic habit interviewers want: when an LLM fails at something character- or format-precise - spelling, string manipulation, character offsets in structured output, off-by-one edits - check the tokenization first. Pasting the failing input into a tokenizer visualiser resolves a surprising fraction of "model is dumb" bug reports.

What a good answer covers

  • Numbers tokenize inconsistently
  • Place-value alignment - the core of digit-wise algorithms - is destroyed when operands have inconsistent…
  • This is why several model families force single-digit tokenization for numbers (each digit its own…
  • Comma formatting ("1,234,567") adds another layer of chunking chaos
  • Tokenizers are trained on a corpus; the merges reflect its language mix

Key terms: Arithmetic · Multilingual inefficiency · Code · General diagnostic habit

Interviewer follow-ups to expect

  1. Why does single-digit number tokenization improve arithmetic?

  2. If your product targets Southeast Asian languages, what would you check before choosing a model?

  3. How would tokenization affect a code-diff-generation feature?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep