What's the practical distinction between 'the prompt' and 'the context' in an LLM API call?
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.
Detailed answer & concept explanation~5 min readEverything 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. 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.
- Anthropic's prompt-caching feature on Claude Opus 4.7 caches a stable prefix (system + tools + few-shot) and re-runs only the tail (user query + retrieved chunks), which is exactly the prompt vs context split made into a billing optimization.
- OpenAI's GPT-5.5 input structure treats system, user, and assistant messages as one concatenated input under the hood; role markers are special tokens, not separate channels.
- LangGraph agents thread a single state object through every node; what the model receives at each step is one merged input regardless of how the developer organizes it in code.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does prompt caching change where you put things?
QDo role markers (system, user, assistant) carry any architectural weight?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
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.
Same topic, related formats. Practice these next.