Flashcard: what role does the LLM's context window play in a RAG pipeline?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The context window is the hard cap on prompt tokens; in RAG it constrains how many chunks you can include, but cost, latency, and lost-in-the-middle keep production usage well under the cap.
Think of the context window as the size of the desk the model is reading at. Anything you want it to use has to fit on that desk: your instructions, the chunks you retrieved, the user's question, and space for the answer it will write. A bigger desk lets you spread out more pages, but it does not change the fact that the reader's eyes get tired in the middle of a crowded desk. Even when modern models have desks the size of a conference table, smart RAG systems still place only a handful of pages on the desk, the ones most likely to be useful. Stuffing the desk wastes time and money and actually makes the reader less reliable. The window sets the ceiling, but practice sets the working number, and the working number is much smaller.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: define the context window, explain what occupies it in a RAG prompt, walk through the cost latency attention reasons production RAG passes few chunks, and call out lost-in-the-middle by name.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Filling the context window with as many chunks as fit. More tokens cost more money and more latency, and the lost-in-the-middle effect means accuracy can actually drop past a small number of well chosen chunks.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.