Skip to content
p.mba

Type to search tools, guides, glossary terms, frameworks, formula sheets and pages.

Menu

Glossary · Data Science & AI

Context Window

Also called: context length · token limit

The maximum amount of text, measured in tokens, that a language model can consider at once, covering the prompt, any documents supplied and its own reply.

Definition

A large language model reads and writes text as tokens, which are words or word fragments, and its context window is the most tokens it can process in a single request. Everything the model uses to answer, including instructions, conversation history, pasted documents and the response itself, must fit inside that window. Material outside the window is simply not seen, so long documents must be trimmed, summarized or retrieved selectively. Window sizes differ widely across models and change often, so check the provider's current documentation rather than relying on a remembered figure.

Worked example

Hypothetical: a model has a 100,000-token window and a rough rule of thumb is about 0.75 English words per token. A 90,000-word set of interview transcripts (about 120,000 tokens) will not fit, so the analyst splits it into batches or uses retrieval to pull only relevant passages.
  • Large Language Model: A neural network trained on very large amounts of text to predict the next token, which lets it generate, summarize, translate and reason over language.
  • Prompt: The instructions, context and examples given to a generative AI model to steer what it produces.
  • Retrieval-Augmented Generation: A technique that retrieves relevant documents from a trusted source and adds them to a language model's prompt so its answer is grounded in that material.
  • Hallucination: When an AI model produces a fluent, confident answer that is false or unsupported, such as an invented fact, number or citation.

Courses

More in Data Science & AI

All glossary terms