What's the practical distinction between 'the prompt' and 'the context' in an LLM API call?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
At the model level, prompt and context collapse into one input stream the attention layer treats uniformly; the split is a useful human convention, not an architectural boundary.
Imagine handing a chef a single sheet of paper before they cook for you. The top of the page has your standing rules (no nuts, low salt, plate it cold). The bottom has tonight's order (mushroom risotto for two). When the chef reads the paper, they read the whole thing as one sheet. They do not have a separate 'rules folder' in their head and a 'tonight's order folder'. We call the top half 'the prompt' because that's the part you authored, and the bottom half 'the context' because it changes every night, but the chef just reads paper. LLMs do exactly the same thing with the input you send.
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: one flat input stream + role markers as special tokens + shared token budget + caching as a convention enforcer + where the line blurs.
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.
Believing the LLM has a separate context window for retrieved data, or that the model knows which tokens were authored by you versus pulled from a database.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.