Entry

What is a context window and how does it affect system design?

How to answer it in an AI engineer interview: what is being tested, a step-by-step framework, a sample answer and the mistakes to avoid.

$19.99 on Gumroad, instant download40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds

What the interviewer is testing

Whether you treat the context window as a design constraint with a budget, not as a reason to skip retrieval or memory, and whether you know models use long inputs unevenly.

Answer framework

  1. Define it: the maximum number of tokens the model can attend to in one call, prompt plus generated output.
  2. Costs: longer prompts raise price and time to first token on every call.
  3. Quality: models use long inputs unevenly; facts buried in the middle are used less reliably.
  4. Design: decide what goes in with retrieval, summarization or memory, and give each section a token budget (system, history, retrieved context, output).
  5. Verify: test long-context behavior on your own tasks instead of trusting the advertised maximum.

Sample answer

The context window is the total number of tokens a model can attend to in one request, which includes the system prompt, conversation history, any retrieved documents and the tokens it generates. If the input fills the window, there is no room left for the answer.

A large window makes some things easier, such as reading a whole contract in one pass, but it does not remove design work. Every extra token adds cost and latency on every call, and models do not use all positions equally well; information in the middle of a long prompt is used less reliably than information at the start or end.

So I design with an explicit budget. For a support assistant I might reserve a fixed slice for the system prompt, cap conversation history and summarize older turns, give retrieved passages the largest share and leave enough room for the output. Retrieval decides what deserves to be in the window; the window size only sets the ceiling.

Likely follow-ups

If a model supports a million tokens, why still use RAG? Cost and latency per call, uneven use of long context, and the need for fresh, permission-filtered content all still favor retrieving only what is relevant.

Common mistakes

The PlaybookWant the full method?

The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.

Get the playbook 40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.

Related questions

Based on question #7, #30 in the full question bank.