Wavelength
Glossary

Plain-language definitions — no jargon for jargon's sake.

All terms
AI Engineering

Context Window Management

The engineering discipline of deciding what information to feed into an AI model's limited context window to maximize output quality within token limits.

Context window management is the discipline of deciding what goes into a model's context window — and what gets left out. Every token is a choice. The right context produces precise, grounded output. The wrong context produces vague, distracted output that misses the point. This is the unglamorous plumbing that separates AI demos from AI products.

Bigger windows don't solve the problem. Research from Stanford and Berkeley ("Lost in the Middle," 2023) showed that models perform worst on information placed in the middle of long contexts — they attend to the start and end, losing signal in between. Throwing your entire knowledge base into a 200K-token window isn't a strategy. It's a hope.

The practical techniques aren't exotic. Chunking strategies control how documents get split before retrieval. Embedding-based relevance scoring ensures only the most pertinent chunks make it into the prompt. RAG pipelines retrieve on demand rather than preloading everything. Priority hierarchies decide what gets dropped when space runs out. This is standard systems engineering applied to a new constraint.

What's underappreciated is the leverage here. Two teams using the identical model can get wildly different results based purely on how carefully they curate context. Get it right and a mid-tier model outperforms a frontier model on sloppy context. Get it wrong and no amount of model spend fixes it.

Further reading: