Language models

What is a context window?

In short

A context window is the amount of text, counted in tokens, that a language model can take in and keep in mind at one time.

Everything in a conversation, including your question, earlier messages and any attached documents, must fit in the context window. If it does not, the oldest or extra parts are left out. Context windows have grown fast, from a few pages to whole books.

Mini course

3 short lessons, about 2 minutes in total

  1. The model's working memory
  2. Bigger is not always better
  3. Working with it

Lesson 1

The model's working memory

A language model does not remember earlier conversations by itself. Each time it answers, it reads everything in its context window: the instructions, any documents, the conversation so far. The window is measured in tokens. Leading models now handle hundreds of thousands of tokens, roughly a few long books.

Context window
Everything the model considers at once must fit in its context window: instructions, documents, the conversation so far and the answer

Tap a box to open that concept

Anything outside the window does not exist for the model.

Lesson 2

Bigger is not always better

A larger window lets you paste whole contracts or codebases. But every token costs money and time, and models tend to pay less attention to details buried in the middle of very long inputs. Sending only what is relevant usually gives better answers, faster and cheaper.

This is the idea behind RAG: fetch the right passages instead of sending everything.

Lesson 3

Working with it

Put the most important instructions at the start and repeat key points at the end of long prompts. In long chats, start a fresh conversation with a summary when the topic changes. For large document sets, use search to pick the relevant parts. And keep an eye on tokens per request, since they drive cost.

Long chats work better when you restart with a short summary

  1. Put the key instructions first
  2. Add only the documents the task needs
  3. Repeat key points at the end
  4. Start a fresh chat with a summary when it gets long
  1. Customers find youHow customers and AI tools find the companySEOGEOGoogle AI Overviews
  2. AI in daily workTools staff and customers useChatbotAI copilotVoice AI
  3. Building blocksHow AI connects to data and systemsRAG (retrieval-augmented generation)AI agentMCP (Model Context Protocol)
  4. AI modelsThe models that understand and createContext windowLarge language model (LLM)Generative AIMachine learning
  5. DataCompany data, gathered and cleanedData warehouseETLData quality
  6. InfrastructureCloud, networks and systems underneathCloud computingDatabaseAPI key
Trust and rulesSecurity, law and control in every layerGDPR and AIEU AI ActAI guardrails
Where Context window sits in a company's AI setup

The skill of choosing what goes into the window is sometimes called context engineering.

An everyday example

If you paste a 300-page manual into a model with a small context window, it can only read part of it at once.

How companies use it

A large context window lets companies feed in long contracts or reports; for huge document collections, RAG is used instead.

Frequently asked questions

Is a bigger context window always better?

A bigger context window is not always better. Very long inputs cost more and the model may miss details in the middle.

What happens when the window is full?

Older parts of the conversation are dropped or summarized, depending on the tool.

How is it different from memory?

The context window covers one session. Some tools add memory that carries over between sessions.

In depth: Context window

The full picture, about 4 minutes of reading

The model's desk

A language model, the kind of AI behind ChatGPT, Claude and Gemini, does not have a memory the way a person does. Each time it writes an answer, it reads a block of text from start to finish and responds to that. This block is called the context window. Think of it as the model's desk: everything it can use right now must be on the desk, and anything that is not on it does not exist for the model.

The context window holds the instructions the tool gives the model, the conversation so far, any documents or files you attach, and the answer the model is writing. Its size is measured in tokens, small pieces of words. A short English word is often one token, and a long or unusual word may be several. Leading models today can hold a very large amount of text at once, often several long books' worth.

Why the limit exists

Reading text is real work for a model. To write each new word, it looks back at all the tokens on the desk and weighs which of them matter. The more text there is, the more computing that takes, which means more time and more cost for every answer.

That is why every model has a maximum, and why AI providers charge by the token. A short question costs very little. Pasting in a long report, and then asking ten follow-up questions in the same chat, means the whole report is read again for every single answer, because the model has no other way to remember it.

So the context window is a trade-off between how much the model can consider at once and how fast and cheap each answer is. Larger windows have made new things possible, such as asking questions about a whole contract, but they have not removed the trade-off.

What happens when it fills up

When a conversation grows longer than the window, something has to give. Different tools handle this differently. Some quietly drop the oldest messages. Some summarize earlier parts of the chat and keep only the summary. Some stop and tell you the conversation is too long.

In all cases, the model loses details. That is why a long chat can suddenly seem to forget an instruction you gave at the start, or mix up facts from different documents. Nothing is broken. The early part is simply no longer on the desk, or only in shortened form.

Some assistants add a separate memory feature that saves notes about you between conversations, such as your role or preferred style. That is not the same as the context window. The notes are stored elsewhere and copied into the window when a new chat starts, so they still take up space there.

Bigger is not always better

It is tempting to think that a model with a huge window can simply be given everything. In practice, three problems appear.

First, cost and speed. Every token sent is paid for and read, every time.

Second, attention. Models tend to use information at the start and end of a long input well, and are more likely to overlook details buried in the middle. Hand a model a hundred pages to find one clause, and it may miss it or confuse it with a similar one.

Third, noise. Irrelevant text is not harmless. It gives the model more chances to pick the wrong passage, quote an old version or blend two topics.

That is why systems that work with large document collections usually do not paste everything in. They search first and give the model only the passages that matter, a method called RAG, retrieval-augmented generation.

How to work with it

A few habits make a clear difference. Put the most important instructions at the start of a prompt, and in a long prompt, repeat the key request at the end. Give the model only the documents that matter for the question, rather than a whole folder. When you paste text, say what it is, such as "below is our returns policy".

In long chats, start a fresh conversation when the topic changes, and paste a short summary of what was decided so far. If an answer suddenly ignores something you said earlier, assume it has fallen off the desk and repeat it.

For people building AI tools, choosing what goes into the window, in what order and in what form, has become a skill in its own right, sometimes called context engineering. It often matters more for quality than which model you pick.

What it means for a small business

For everyday use, the context window explains most of the strange behavior staff notice in AI assistants: forgotten instructions, mixed-up facts and slower, pricier answers in long chats. A short tip sheet helps: one task per chat, the key instructions first, only the documents that are needed, and a new chat when the topic changes.

When you choose or build an AI tool that works with company documents, ask how it decides what the model sees. A tool that searches for the right passages and shows its sources will usually give better answers than one that pastes in everything it can fit, and it will cost less to run.

Curious what this could mean for your company? Book a call.

Book a call