Predict how cl100k_base tokenizes '1024', '2048', and '100000', and explain how inconsistent splitting causes LLM arithmetic failures.
Using tiktoken with cl100k_base, tokenize the following number strings: - '1024' - '2048' - '100000' Predict whether each is a single token or splits, and describe how inconsistent number tokenization causes LLMs to fail at multi-digit arithmetic.
cl100k_base caps digit runs at three digits, so even 1024 splits into ['102','4']; that non place value chunking is why LLMs fail at exact arithmetic.
Imagine doing long addition, but instead of seeing each digit, you only get colored cards. The number 1024 is one blue card; the number 100000 is two green cards glued in a weird spot. You were taught to add by lining up the ones, tens, and hundreds, but the cards do not split along those lines. Worse, the number right next to 1024 might come as totally different cards, so a trick that worked for one number is useless for its neighbor. That is how a language model sees numbers. It rarely gets clean single-digit pieces, so it cannot line up place values, and it ends up guessing from patterns it memorized rather than actually calculating.
Detailed answer & concept explanation~7 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: three-digit chunk cap + no place-value primitive + carries crossing chunk boundaries + right to left grouping + tool-use mitigation.
Real products, models, and research that use this idea.
- ChatGPT routes exact arithmetic to a Python code interpreter rather than computing multi-digit math in token space.
- OpenAI's o200k_base tokenizer caps numeric runs to one to three digit chunks, making number splitting more consistent than cl100k_base.
- Llama 4 models split digits individually in their numeric handling, a deliberate choice to give the model a stable place-value primitive.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you design a tokenizer change that materially improves multi-digit arithmetic?
QWhy does spacing digits like '4 7 1' sometimes help the model add correctly?
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 the model adds digit by digit; cl100k hands it multi-digit chunks split at three-digit boundaries, not place-value boundaries, so it pattern-matches instead of computing.
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.