Technology & AI
What is Context Window?
Context window is the maximum tokens (input + output) an LLM can process in one call — ranges from 4k to 2M+ across models.
GPT-3.5 = 16k, GPT-4o = 128k, Claude 4 = 200k, Gemini 1.5 = 2M. Bigger window unlocks scenarios (analyze full documents, an entire repo's code), but costs more and runs slower.
Trick: "lost in the middle" — models pay more attention to the start and end of context. Put critical instructions at the top OR bottom, not hidden in the middle.
Frequently asked questions
Is bigger context always better?
No. Costs more and has "lost in the middle". For lots of context, RAG (retrieve relevant chunks) usually wins.
What happens if I exceed the limit?
API returns an error. Solutions: truncate input, summarize, or use RAG to fetch only the relevant pieces.