Context Engineering
Deciding what goes into the context window and what doesn't — the discipline that replaced prompt engineering once the prompt stopped being the hard part.
When not to use it
- As a first response to a knowledge gap. If the fact isn't anywhere in your corpus, no arrangement of context supplies it — you have a data problem.
- On short, simple prompts. If your whole input is a paragraph, this is prompt engineering and calling it something else doesn't add rigour.
- As a substitute for evals. You can arrange context beautifully and still be wrong; only measurement tells you which.
Reach for something else instead
- Fine-tuning puts the behaviour in the weights when the same context would otherwise be pasted into every single call.
- Prompt caching is the cheaper answer when your context is large, fixed, and repeated.
- Better retrieval is usually the actual fix. Most "context engineering" problems are ranking problems wearing a costume.
Sources & further reading
- Liu et al. (2023), Lost in the Middle: How Language Models Use Long Contexts — uneven access across the window; the empirical basis for treating position as a design variable.
- Lewis et al. (2020), Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks — the mechanism most context engineering is built on.
- Brown et al. (2020), Language Models are Few-Shot Learners — in-context learning; why the window became the interface in the first place.
Primary sources, listed so you can check the claims on this page rather than take them on trust.
Where people go wrong
- Filling the window because it's there. Irrelevant context displaces relevant context and gives the model plausible wrong material to use — and the answer needs room too.
- Assuming a long context window means good long-context performance. Liu et al. showed access is uneven; the window is a capacity, not a guarantee.
- Never reading the actual context at the point of failure. It's the highest-yield hour in the project and it's routinely skipped in favour of rewording the prompt.