Lesson 1 · Unit 04
The context window
One window holds everything the model knows right now
What you practise
- System prompt, conversation and tools all share one window
- Cost and latency scale with tokens
- The model has no memory beyond it
- Prompt caching
Try a question from this lesson
Pick one
You tell a chat model your name. Twenty messages later it still uses it, yet its weights never changed. Where was your name kept?
Correct answer
In the conversation text, which the app sends again every turn
Why
Weights are frozen after training. The app keeps the transcript and sends all of it with every request, so your name is simply in the input again each time. The "memory" of a chat is the text in the window.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
One window, many tenants
Everything the model works from must fit in the context window at once: the system prompt (instructions from the app), descriptions of any tools, the conversation so far and the new message.
The answer is generated into the same window, so space must be left for it too.
+----------------------------+
| system prompt |
| tool descriptions |
| conversation so far |
| new user message |
| ... room for the answer |
+----------------------------+Concept
Prompt caching
Many requests start with the same tokens: the same system prompt and tool list. A provider can store the model's internal state for that prefix (the cached keys and values) and reuse it.
The reused part is cheaper and faster. It only works while the start of the prompt is exactly identical: the cache matches from the first token and ends at the first difference.
9 more exercises in the app
- 3× type the answer
- 3× multiple choice
- 1× fill the blanks
- 1× true or false
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.