Tokens
A tokenizer breaks text into pieces that a model can represent as numeric IDs. A piece can be a whole word, part of a word, punctuation or bytes.
Before you start: Start here; familiarity with text and basic arithmetic is enough.
Follow the mechanism
Text
Start with the exact Unicode input.
Start with an everyday explanation
Think of packing a sentence into numbered building blocks. Different sets of blocks can pack the same sentence differently. Counting words does not tell you how many blocks you need.
See a concrete example
If a hypothetical request uses 1,200 input tokens and reserves 300 output tokens, budget at least 1,500 tokens plus any additional framing. These are given counts, not a word-to-token estimate.
A claim to question
One English word is not always one token, and Hindi words do not have a fixed token count.
Try before revealing the answer
Compare a sentence, its Hindi translation and a JSON object in the token counter. Record the encoding and exact strings.
Show the worked answer
Keep the meaning and encoding fixed when comparing edits. Verify the actual token count; shorter character length can still produce more tokens.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
The vocabulary and normalization rules belong to a particular tokenizer. Count with the encoding used by your target model, including messages and any tool definitions.
Measure representative languages and code. Whitespace and Unicode can change segmentation. Input and generated output both consume context and may have different prices.
Reason through the example
If a hypothetical request uses 1,200 input tokens and reserves 300 output tokens, budget at least 1,500 tokens plus any additional framing. These are given counts, not a word-to-token estimate.
Implement and test
Compare a sentence, its Hindi translation and a JSON object in the token counter. Record the encoding and exact strings.
Inspect the reasoning and expected result
Keep the meaning and encoding fixed when comparing edits. Verify the actual token count; shorter character length can still produce more tokens.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
Why do two tokenizers sometimes return the same count?
A defensible answer
Different vocabularies can happen to segment a short sample into the same number of pieces. Compare token IDs and boundaries on diverse text before concluding the encodings are identical.
Prepare the follow-up
How would you budget a tool-calling conversation with several rounds?
Show follow-up reasoning
Count every round with the target encoding, including instructions, tool schemas, results and generated arguments. Reserve a bounded output budget and cap the number and size of tool results. Track actual usage against the estimate and stop before a context or spend limit is exceeded.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define tokens with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…