Match the model class to the context engineering knob it most rewards
Drag each answer to line up with its matching prompt
Small fast model with 8k window
Account image tokens separately and place images near the relevant text
Frontier model with 200k window and prompt caching
Reserve a large output budget and avoid stuffing the input
Reasoning model that emits long internal traces
Head and tail layout for retrieved content; aggressive lost-in-the-middle mitigations
Open weight model with weak long context performance
Stable system prefix to maximise cache hit rate; generous dynamic slots
Vision capable model with images in context
Aggressive trimming and tight top-k; rerank is mandatory
Different model classes reward different context knobs: small windows want aggressive trimming, cached prefixes want stability, reasoning models want output reservation, weak long-context models want head and tail
Imagine packing for five different trips. A weekend carry-on (small window) means ruthless trimming, only essentials. A road trip with a passenger who has a magic suitcase that remembers your packing list (cached prefix) means stable layout to keep the magic working. A hike where you will write a long journal at the top (reasoning model) means leaving lots of paper blank for later. A drive where you tend to only remember the first and last hour (weak long-context) means putting the important stops at the start and end. A photo trip (vision model) means keeping camera notes right next to the photos. The packing rules are not universal. They depend on the trip.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Context engineering has rules but the rules are not universal. They depend on the model class you are targeting. A layout that exploits prompt caching on Claude Opus 4.7 is wasted on a small local 8k model; a layout that maximizes top-k on a small model would crowd out reasoning on an extended-thinking frontier model.
The practical discipline is to pick a model class first, then apply the dominant context knob for that class. Five classes cover most production fleets in 2026, and each has one knob that pays off more than the others.
This card walks through the five classes, the dominant knob each rewards, and the mixed-fleet pattern that holds them together.
Small fast model, tight window
Small models like Llama 3.1 8B, Qwen 3.5 Mini, and Gemma 4 typically ship with windows in the 8k-32k range. The dominant context constraint is raw space.
The layout discipline that pays off here is aggressive trimming and tight top-k.
- Top-k 3-5 after rerank. The marginal chunk has no slack to be wrong.
- Rerank is mandatory. A cross-encoder reranker (BGE Reranker v2, Cohere Rerank 3.5) pays for itself because the survivors get more weight per token.
- System prompt minimalism. Strip every word that does not earn its keep. A 1.5k system prompt on a model with an 8k window is taxing 19% of capacity before you fetch anything.
- No chain-of-thought stuffing. The model cannot afford long reasoning traces; keep tasks scoped.
Small windows reward discipline. Large windows reward stability.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- Anthropic's published Claude Opus 4.7 prompt-caching guide shows up to 90% input-cost reduction and 85% TTFT reduction for stable cached prefixes; the load-bearing optimization for that model class.
- OpenAI's GPT-5.5 reasoning configuration recommends reserving output token budgets of 4k+ for non-trivial tasks; documented in the responses API guide.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow do you design a router that picks the model class first, then the context layout?
Use a small classifier or a rules table over task type and input size to pick the model class; load a per-class layout function that knows top-k, cache strategy, and output reservation.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Applying the same context layout across every model in your fleet. A layout tuned for Claude Opus 4.7 with caching is a poor layout for a small 8k local model and vice versa.
60 second bullets to scan on the way to the call.
What is the dominant context knob for each of five model classes?
Why does prompt caching reward prefix stability?
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.