AI Hints
Home›Generative AI Tutorial›Context, Models and Reasoning
Generative AI · Lesson 19 of 77

The Context Window

How much a model can hold in mind.

⏱ 2 min read▶ Video at 46:44🎓 Free
Watch this lesson in the Generative AI courseWatch on YouTube ↗Full Generative AI course

Every model has a working memory, called the context window. Everything you say, and everything it replies, must fit inside. In this lesson, you will learn what the window holds, what happens when it fills up, and how to work with it smartly.

The Context Window
From the video: The Context Window
  • A model's working memory
  • Everything must fit inside
  • What happens when it fills up

Context windows are growing

The window is measured in tokens. Early models could hold around two thousand tokens, about three pages of text. Later models reached thirty two thousand, then a hundred thousand, and today, some can hold a million tokens, or more, which is several long books at once. Bigger windows let you paste whole reports and codebases. But they are slower, and more expensive, and models can still overlook details buried in the middle.

Early models
about 2 thousand
Mid models
about 32 thousand
Long-context models
about 1 million

What fills the window

Remember that the window holds everything. The instructions you give at the start. The whole conversation so far. Any documents you paste in. And the reply the model is writing right now. When the total is too long, the oldest parts must be dropped, or summarised. That is why very long chats can seem to forget the beginning. The model does not remember between chats. It only sees what is in the window.

  1. System instructionshow the assistant should behave
  2. Conversation historyall earlier messages
  3. Pasted documentsreports, code, notes
  4. The answer being writtentokens still to come

Working smartly with limits

A few habits help. Put the most important instructions first, and repeat key facts near the end. Do not paste more than you need. For long documents, ask for a summary in stages. And when a chat gets very long, start a fresh one, with a short summary of what matters. Think of the window as a desk. A tidy desk makes better work.

Important instructions firstand repeat key facts
Paste only what you needless noise, lower cost
Summarise in stagesfor very long documents
Start fresh sometimescarry over a short summary

Summary

Good. The context window is the model's working memory, measured in tokens. It holds instructions, history, documents, and the reply. Windows are growing fast, but tidy, focused input still gives better results. Next, a tour of the model landscape, open and closed, big and small.

Key takeaways
  • Context window = working memory
  • Holds instructions, history, documents, reply
  • Tidy input gives better output
Next up: The Model Landscape — open, closed, big and small