60-second card
Tokens and context
LLMs read and write tokens, and can only see a limited number at once: the context window.
- One English token is about ¾ of a word.
- The prompt and the reply share the context window.
- APIs charge per token, often more for output tokens.
window, prompt = 8000, 6500
print(window - prompt, round(750 / 0.75))Prints
1500 1000Remember: Long documents must fit in the window, or be retrieved in pieces.
Common mistake: Filling the window with documents and leaving no room for the answer.