Language models & chatbots

Context window (Context length)

The context window is the maximum amount of text, measured in tokens, that a language model can consider at once, including your prompt and its own reply.

A language model has no long-term memory of your conversation. Everything it knows about the current chat is the text in front of it: your messages, its replies, any documents you pasted. The context window is the size of that view. Once the conversation outgrows it, the oldest parts are cut off or summarized.

Early chat models saw only a few thousand tokens, roughly a few pages. As of 2026, many models handle hundreds of thousands. Some advertise a million or more, enough for whole books or codebases. Larger windows cost more per request. Models also often get less reliable near the far end.

The window is why a chatbot can forget something you said early in a long session. It is also why RAG exists: instead of stuffing everything in, you retrieve only the relevant passages and place them in the window at question time.

Example

After an hour of chatting about your trip plans, the assistant no longer 'remembers' the budget you mentioned at the start, because that message fell out of its window.

Guide: LLM basics →