Context window and context construction
Practice this questionOverview
- A context window is the amount of model input and generated content a model can handle within its documented limits.
- Context is the particular information you provide for one call: instructions, messages, evidence, and tool results.
- A large window gives capacity, not a guarantee that the model uses every detail correctly.
Why this matters
The model needs enough information to answer the current question without overflowing limits or receiving irrelevant distractions.
An everyday example
A support employee can only keep a limited number of pages on their desk and still work efficiently.
A technical example
Keep the latest five messages, an approved summary, and the three most relevant policy sections instead of all previous chats.
How it works
- Identify required instructions
- Select recent messages
- Retrieve current evidence
- Preserve tool-call/result pairs
- Reserve response space
- Trim low-value material.
Architecture and flow
History + retrieved facts + task → context builder → bounded model request.
The insurance assistant example
The assistant includes the active policy version and current claim status, not ten unrelated expired policies.
When to use it
Every conversation, RAG application, and agent benefits from explicit context budgeting.
When to avoid it
Do not use context as permanent storage or assume the provider remembers content you did not send or persist.
Interview answer
“The context window is the model's capacity; context engineering is choosing the right information within that capacity.”
Benefits, trade-offs, and production considerations
- Trim based on relevance and provenance, not just oldest-first.
- Summaries can silently lose conditions or invent facts.
- Keep canonical business data outside the summary and refresh it through tools.