Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. LLMs /
  4. What is a Context Window?
LLMs

What is a Context Window?

Updated September 26, 2026 Read 3 min

A context window is the maximum amount of text, measured in tokens, that a large language model can consider at one time. It includes the system prompt, conversation history, documents and the model's own response.

Contents 12
  1. 01Key takeaways
  2. 02A context window explained in simple terms
  3. 03What fills the context window
  4. 04A worked example: fitting a contract
  5. 05Why bigger is not always better
  6. 06Context window vs memory
  7. 07How applications manage limited context
  8. 08Why context windows have limits
  9. 09Best practices
  10. 10Common Use Cases
  11. 11Frequently Asked Questions
  12. 12Related Terms

A context window is the maximum amount of text, measured in tokens, that a large language model can consider at one time. Everything the model uses to answer must fit inside it: the system prompt, your message, earlier conversation turns, any pasted or retrieved documents, and the response being generated. Anything outside the window is invisible to the model.

Key takeaways

  • The context window is the model’s working memory for one request.
  • It includes both input and output tokens.
  • Context sizes have grown from about 2,000 tokens in GPT-3 (2020) to hundreds of thousands, and in some models over a million.
  • A bigger window does not guarantee the model uses all information equally well.
  • Longer contexts cost more and respond more slowly.

A context window explained in simple terms

Imagine a desk. You can only work with the papers that fit on the desk right now. A small desk holds a few pages; a large desk holds several books. If you add more papers, the oldest fall off the edge. An LLM’s context window is its desk. The model does not remember past conversations unless they are placed back on the desk.

What fills the context window

ItemExample
System promptInstructions, rules and persona
Conversation historyEarlier user and assistant messages
Retrieved documentsHelp articles or files added for grounding
Tool resultsSearch results, database rows, API responses
The current promptThe user’s latest question
The responseOutput tokens being generated

A worked example: fitting a contract

Suppose a model has a 128,000-token context window. You want to analyse a 150-page contract of about 75,000 tokens, with a 1,500-token system prompt, and allow up to 4,000 tokens for the answer.

Total: 75,000 + 1,500 + 4,000 = 80,500 tokens, which fits. Adding three more similar contracts would exceed the window, so you would need to summarise them first or retrieve only the relevant sections.

Why bigger is not always better

  • “Lost in the middle”: a 2023 study by Nelson Liu and colleagues found models often used information at the start and end of long inputs better than information in the middle.
  • Cost: you pay for every input token on every request.
  • Speed: longer inputs take longer to process before the first output token appears.
  • Noise: irrelevant text can distract the model and reduce accuracy.

Context window vs memory

The context window is temporary. Once a conversation ends, or older messages are dropped to save space, the model no longer has that information. Some applications add “memory” features that store facts separately and insert relevant ones into future context windows. The model’s permanent knowledge comes from training, not the context window.

How applications manage limited context

  • Truncation: drop the oldest messages.
  • Summarisation: replace old conversation turns with a short summary.
  • Retrieval (RAG): store documents outside the model and insert only the most relevant chunks.
  • Prompt caching: some providers reuse processed prompt prefixes to cut cost and latency on repeated context.
  • Chunking: process long documents section by section, then combine results.

Why context windows have limits

In a standard transformer, attention compares every token with every other token, so compute grows roughly with the square of context length. The model also stores a key-value cache for every token during inference, which consumes GPU memory. Research into efficient attention and memory techniques has steadily pushed limits higher.

Best practices

  • Put the most important instructions and information clearly, near the start or end.
  • Include only relevant documents rather than everything available.
  • Ask the model to quote or cite the parts of the context it used.
  • Test performance on long inputs before relying on the full window.

Common Use Cases

01

Long document analysis

Analyse contracts, reports and transcripts within one request.

02

Multi-turn chat

Keep conversation history so assistants remember earlier messages.

03

Retrieval-augmented answers

Insert relevant document chunks for grounded responses.

04

Codebase assistance

Load multiple source files so the model understands project structure.

05

Agent workflows

Hold tool results, plans and intermediate steps during multi-step tasks.

06

Prompt caching

Reuse large stable context, such as manuals, across many requests.

Frequently Asked Questions

The maximum number of tokens an LLM can consider at once, including instructions, history, documents and its response.

Yes. Input and output tokens both count towards the context window.

Older content must be dropped, summarised or retrieved selectively, or the request fails with a length error.

Not always. Models can miss information in long inputs, and longer contexts are slower and more expensive.

No. It is temporary working space for one request. Long-term memory features store information separately.

Related Terms

  • Token
  • Large Language Model
  • LLM Inference
  • Retrieval-Augmented Generation
  • Prompt Caching
  • System Prompt

Related AI Terms

What is Self-Attention?Self-attention is a mechanism where each position in a sequence attends to every other position in the same…What is Positional Encoding?Positional encoding is the method transformers use to represent the order of tokens in a sequence, because the…What is an Attention Head?An attention head is a single attention unit inside a transformer layer, with its own query, key and…What is Multi-Head Attention?Multi-head attention runs several attention operations in parallel, each with its own learned projections, so a model can…What is Prefix Tuning?Prefix tuning is a parameter-efficient fine-tuning method that learns trainable vectors inserted into the attention keys and values…What is RoPE (Rotary Positional Embedding)?RoPE (rotary positional embedding) encodes a token's position by rotating its query and key vectors by an angle…

Contents

  1. 01Key takeaways
  2. 02A context window explained in simple terms
  3. 03What fills the context window
  4. 04A worked example: fitting a contract
  5. 05Why bigger is not always better
  6. 06Context window vs memory
  7. 07How applications manage limited context
  8. 08Why context windows have limits
  9. 09Best practices
  10. 10Common Use Cases
  11. 11Frequently Asked Questions
  12. 12Related Terms

AI Topic

  • LLMs

Related Terms

  • What is Self-Attention?
  • What is Positional Encoding?
  • What is an Attention Head?
  • What is Multi-Head Attention?
  • What is Prefix Tuning?
  • What is RoPE (Rotary Positional Embedding)?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
September 26, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}