Question presented to candidate: "Everything in LLM APIs is measured in tokens β the pricing page, the context limit, the rate limits. What is a token, how does text get split into them, and how do they affect what our feature costs and how fast it is?"
What a strong answer should cover:
- A token is the unit a model reads and writes: a word, part of a word, a punctuation mark or a byte sequence, produced by a tokenizer with a fixed vocabulary (tens of thousands to a few hundred thousand entries)
- How subword tokenizers such as BPE are built: start from characters or bytes, repeatedly merge the most frequent adjacent pair; common words become one token, rare words split into many pieces
- Rules of thumb and their limits: roughly 4 characters or three quarters of an English word per token (OpenAI), but code, numbers, rare words and many non-English languages take more tokens; counts differ between model families
- Cost: input and output tokens are priced separately and output is usually several times dearer; a worked monthly estimate from traffic, prompt size and answer size
- Limits and latency: the context window and rate limits are counted in tokens; each output token is one sequential decode step, so answer length drives response time
- Practical habits: count with the provider tokenizer or token-counting endpoint, cap
max_tokens, shrink prompts, cache repeated prefixes
Code / implementation expected: Optional β a small tokenizer or a cost calculation from token counts is a good way to show the arithmetic.