Skip to main content

What is a context window, and what happens when a conversation gets too long?

LLM and transformer basics · Intermediate 1

Short answer

The context window is the maximum number of tokens the model can consider in one request: system prompt, conversation history, documents and its own reply together. When you go past it, the request fails or something must be cut, so apps trim, summarise or retrieve only the relevant parts.

Deeper answer

Everything the model sees in one call shares the window. In a long chat, each turn resends the earlier turns, so the input grows. Common strategies are to drop the oldest turns, summarise earlier parts, or store information outside the prompt and retrieve only what the current question needs.

A bigger window is not free: more input tokens cost more and take longer, and models can pay less attention to material buried in the middle of a very long input. So even with a large window, sending only what is relevant usually gives better and cheaper answers.

What a strong answer covers

Answer it out loud in the mock interview about 1 min

Follow-ups to expect

Common mistakes

Learn it

Tokens and the context window

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.