AI & Machine Learning

Context window

Also known as: context length, context limit, token limit, context size

A context window is the limit on how much text an AI language model can work with at one time, counting your instructions, any documents you attach, the conversation so far, and the model's own answer.

It's measured in tokens, which are pieces of words. While context windows have grown from a few pages to the length of several novels, a bigger window doesn't guarantee the model pays equal attention to everything inside it.

Context window, explained at three levels

At home

Think of a context window as the size of the desk an AI works on. Everything it needs for your conversation, your messages, its replies, and any files you add, has to fit on the desk at once. When the desk fills up, older pages get pushed off the edge, which is why a very long chat can 'forget' what you said at the start.

At work

A context window is the maximum amount of text an AI model can take in for one request, counting instructions, attached documents, chat history, and its own answer. It is measured in tokens, which are pieces of words. For a business, it decides whether a tool can read a whole contract or only part of it, and since providers charge per token, it also shapes cost.

Real-world examples

At home

Marcus pasted a long rental agreement into an AI chatbot and asked about pets. The answer was right, but when he later added three more documents, the AI started mixing up details.

At work

Nadia builds internal AI tools for a Halifax insurance company. She found that sending only the five most relevant policy sections, rather than the whole 300-page manual, gave cheaper, faster, and more accurate answers.

Common confusions

  • A bigger context window means the AI remembers everything perfectly. — Models can still overlook details, especially in the middle of long inputs. More room isn't the same as better attention.
  • The context window is the AI's long-term memory. — It only covers the current request. Memory features that persist across chats are stored separately and added back into the context.

For analysts

When evaluating AI tools for long documents, I'd test with your real files and questions. Advertised context size says little about whether answers stay accurate at that length.

History & origin

OpenAI's GPT-2 in 2019 handled 1,024 tokens, and GPT-3 in 2020 handled 2,048, roughly a few pages of text. GPT-4 launched in March 2023 with 8,000- and 32,000-token versions. Anthropic expanded Claude to 100,000 tokens in May 2023, and Google announced a one-million-token context window for Gemini 1.5 in February 2024. Research such as the 2023 'Lost in the Middle' paper from Stanford and others showed models often overlooked information buried in the middle of long inputs, prompting new long-context benchmarks. By 2025 and 2026, windows of hundreds of thousands to a million or more tokens were common among leading models. In my view, context windows grew faster than our ability to use them well.