Glossary

Context window — Glossary

The maximum number of tokens a model can consider in one request, including instructions, history, and retrieved text.

Reviewed:

Full definition

A context window is the working memory budget of a language model measured in tokens. Everything the model can “see” for a completion—system prompts, chat history, tool results, and retrieved chunks—must fit inside that budget.

Larger windows enable longer documents in a single call but raise cost and can introduce noise if irrelevant text dilutes attention. Many applications therefore combine moderate context with retrieval-augmented generation.

Always count tokens with the model’s tokenizer. Word counts are unreliable across languages and code.

Related encyclopedia topic

Context Windows — A context window is the maximum amount of text (tokens) a language model can consider at once—including the system prompt, user messages, retrieved documents…

← Back to glossary · Learning hub