A language model does not read words. It reads tokens, within a fixed budget, and most of its cost and many of its odd failures follow from that.
01 · The unit
A token is a piece of text, often smaller than a word.
Before a model sees text, a tokenizer splits it into pieces drawn from a fixed vocabulary. Common words are often a single token. Rarer words, names and numbers break into several. As a rough rule for English, a token is about four characters, or three quarters of a word.
Other languages and code usually need more tokens for the same meaning, so the same sentence can cost more in one language than in another.
02 · The budget
The context window holds the question, the evidence and the answer together.
A model has a context window: the most tokens it can handle in one request. Everything counts against it, including the instructions, any retrieved passages, the conversation so far and the reply being written.
This is why a long conversation eventually forgets its start, and why stuffing in every document is not a plan. The window is a shared budget, not a filing cabinet.
Spend the window on the few passages that matter, not on everything that might.
03 · The cost
Providers charge by token, and longer inputs also run slower.
Input and output tokens are usually priced separately, with output costing more. Latency grows with both the size of the prompt and the length of the reply.
In the standard transformer design, the work of attending across a sequence grows faster than linearly with its length, which is one reason long contexts are slow and expensive even when they fit.
04 · Practical habits
Measure it, trim it, and put the important part where it is noticed.
- Count before sendingUse the provider's tokenizer to count, instead of guessing from characters. Surprises are usually numbers, code and non-English text.
- Retrieve less, betterFewer, more relevant passages beat many loosely related ones, for both cost and accuracy.
- Mind the middleModels tend to use the start and end of a long prompt better than the middle, so put the instruction and the key evidence where they are not buried.
05 · Worked example
What a long conversation really costs.
A 6,000-word document is roughly 8,000 tokens, since a token is about three quarters of a word. Sending it once with a question costs about 8,000 input tokens.
In a chat that resends the whole history each turn, the cost grows with every message. Ten turns that each add 500 tokens send 500 on the first turn and 5,000 on the tenth, about 27,500 in total, though only 5,000 new tokens were written. Trimming or summarising old turns is how long conversations stay affordable.
06 · Pitfalls
Common token mistakes.
- Counting charactersCharacters are a guess. Numbers, code and non-English text use more tokens than they look like.
- Forgetting the replyThe answer uses part of the same window. Leave room, or it will be cut off mid-sentence.
- Sending everythingExtra passages do not make a better answer. They dilute the useful one and raise the cost.
- Ignoring a limit until it failsCount before sending and decide what to drop, instead of discovering the limit through an error.
What I took away
- Think in tokens: about four characters of English each.
- The window is shared by instructions, evidence, history and the reply.
- Count tokens, retrieve fewer and better passages, and keep the key part out of the middle.