Przejdź do treści
promptowy.com / AI Glossary / Context Window
Technology and architecture

Context Window

A context window is the maximum amount of text, measured in tokens, that an AI model can read and process in a single interaction.

A context window is the maximum amount of information, measured in tokens, that an artificial intelligence model can hold in its active working memory during a single interaction. Everything involved in a conversation must fit inside this boundary at the exact moment of generation: your prompt, any attached files, the prior back-and-forth dialogue, and the reply the model generates. If a piece of information falls outside this window, the model cannot see it, analyze it, or use it to answer your question.

Understanding this concept clears up one of the most common user frustrations: the illusion that an AI is suddenly becoming forgetful. Large language models do not possess persistent long-term memory like humans do. Instead, every time you send a new message, the software re-reads the entire conversation history up to the allowed token limit. When the conversation becomes too long to fit inside the context window, the earliest messages drop off the edge, effectively vanishing from the AI's awareness.

How the Context Window Operates

To grasp how the window functions, it helps to understand tokens. Tokens are the basic units of text processed by language models. A single token can be a whole word, a syllable, or even individual punctuation marks. As you write, upload documents, and receive replies, the total token count climbs steadily.

Think of the context window as a desktop work surface of a fixed size. You can place your instructions, reference sheets, and notes on it. As long as everything fits on the desk, the assistant sitting across from you can consult every piece of paper. The moment the desk fills up, you must sweep the oldest papers onto the floor to make room for new ones. Once a note hits the floor, the assistant has no idea it ever existed, even if you discussed it ten minutes earlier.

A Real-World Example: A High Street Business

Consider an independent accounting practice in Leeds or a boutique estate agency in Denver preparing property listings. A property manager might upload an architectural survey, several legal lease agreements, and neighborhood school performance reports into a chat session to draft sales brochures.

In a model with a modest context window, pasting all these documents at once either triggers an error or silently truncates the end of the text. The agent might ask for a summary of parking rights, only to find the AI hallucinating or claiming the survey does not mention parking, simply because that clause was pushed beyond the window's boundary. Conversely, with an expansive context window, the system can digest all documents together and cross-reference school catchment areas with lease conditions in seconds. However, if the agent keeps that same chat thread open for two weeks, asking dozens of follow-up questions, the original surveys will eventually slide out of view.

The Lost in the Middle Effect

Modern models offer context windows large enough to hold hundreds of pages of text, entire books, or large software codebases. While this scale is powerful, having a massive window does not guarantee perfect comprehension across every single sentence.

Researchers and practitioners frequently observe that language models pay the closest attention to information placed at the very beginning and the very end of the context window. Details buried deep in the middle of a massive pasted document can be overlooked or ignored, a phenomenon often described as the needle-in-a-haystack problem. If a specific constraint or fact is critical, relying on the model to find it halfway through a fifty-page file can lead to inconsistent results.

Best Practices for Managing Context

To get reliable work out of any language model, you should actively manage what enters the context window rather than treating it as an infinite dumping ground:

  • Start fresh sessions: When switching tasks or moving to a new topic, open a clean chat to purge obsolete tokens from the active memory.
  • Front-load key rules: Put your most important requirements, guidelines, and formatting instructions at the very start of your prompt.
  • Repeat crucial constraints at the end: If you are supplying a long background document, restate your core question and key constraints right after the text, at the very bottom of the prompt.
  • Curate your source material: Edit down long meeting transcripts or reports to the relevant sections before pasting them into the prompt.

Frequently asked questions

Why does an AI model forget things we discussed earlier in the chat?

As a dialogue continues, the total token count grows. When it exceeds the model's context window, the earliest messages are dropped from the active memory to make room for new text.

Does the context window include the AI's response?

Yes. The context window includes the initial prompt, any uploaded documents, past chat turns, and the new response the model generates.

Is a larger context window always better?

A larger window allows you to process extensive documents at once, but models can still overlook details buried in the middle of very long inputs, requiring careful prompt placement.

← All terms in the AI Glossary

🛒 Sklep Kinetyka CapCut Pro 460 zł/rok Lovable Pro 450 zł/rok Replit Core 119 zł/rok Zobacz wszystko →
× ‹ powiększenie ›