Skip to content
// ai glossary

What is a context window in AI? Explained

How much text (measured in tokens) a model can consider at once, including your messages and its replies.

Last reviewed

In plain English

The context window is the amount of text a model can consider at one time. It is measured in tokens, and it covers everything in the conversation: your messages, the AI's replies, any document you pasted in and any hidden instructions. Think of it as the model's desk. Only what fits on the desk can be used for the next answer.

What happens when it fills up

A model has no memory of a conversation beyond what is in its window. In most chat apps the earlier messages are sent again with each new one. In a very long chat, the oldest parts may no longer fit. Depending on the app, they may be dropped, summarised or cause an error. This is why a long conversation can seem to forget what you said at the start.

A simple example

You paste a 40-page report and ask questions about it. If the report plus the conversation fits in the window, the model can refer to any part of it. If it does not fit, the tool may cut some of it or refuse. Splitting the report into sections works better than hoping it all fits.

How to work with it

  • Start a new chat for a new topic. Old, unrelated text takes up room.
  • Summarise and restart. Ask for a summary of the key points, then paste it into a fresh chat.
  • Send only what is relevant. If your question is about one section, paste that section.
  • For large document sets, use retrieval. Methods such as RAG fetch only the relevant passages instead of loading everything.

Common mix-ups

  • A bigger window is not always better. More text means more cost and time, and models can still overlook details buried in a very long input.
  • The window is shared. Your question, the document and the answer all count.
  • The size differs by model and changes often, so check the tool you use instead of assuming a number.
  • System promptHidden instructions a developer gives a model to set its role, rules and style before the user starts chatting.
  • RAG (retrieval-augmented generation)A method where the AI first searches your documents for relevant information, then uses it to write the answer. Reduces made-up facts.
  • InferenceThe moment a trained model is used to produce an answer. Each chat reply is an inference.

Keep reading