404human Experience Projects Writing Build logs Learning Books Progress
Rust · Zola
zsh · 404human@dev:~ Tab complete · ↑↓ history · type help

LLM context window sizes compared (Claude, ChatGPT, GPT-4.1, Llama 4, Grok)

How advertised 200K, 1M, and 10M LLM context windows compare across Claude, ChatGPT, GPT-4.1, Llama 4 Scout, and Grok—plus KV-cache math and where recall actually drops.

Published
Read time
6 min read
Kind
guide
Topics

Every frontier model release now headlines a bigger context number: 128K, 200K, 1 million, even 10 million tokens. On paper, it sounds like you can throw an entire company’s codebase, five years of PDFs, and every Slack thread into one prompt and retire search forever.

In production, that assumption breaks on day one. Advertised context limits hide three critical engineering realities: web chat vs. API caps are different, long-context pricing often steps up sharply past 200K tokens, and effective reasoning accuracy degrades long before you hit the nominal ceiling.

Here is a grounded comparison of the major context window tiers across Claude, ChatGPT / GPT-4.1, Llama 4 Scout, and Grok—plus the underlying KV-cache memory math and how to budget long contexts cleanly.

Context window tiers compared (API vs. real-world budgeting)

(Exact model tiers and beta limits evolve rapidly—always verify current model IDs in each provider’s API docs before hardcoding ceilings. The table below compares the documented architectural tiers teams actually design around.)

Model familyAdvertised API context tierTypical web chat behaviorArchitectural / practical caveat
Claude (Sonnet / Opus / Haiku families)200K standard (up to 1M beta on select API tiers)Consumer plans enforce plan-specific message/file budgets and auto-compactionPrompt caching is crucial above ~30K tokens; long-context API tiers carry higher input pricing past 200K
OpenAI GPT-4.1 / ChatGPT families128K (classic ChatGPT/4o) to 1M (gpt-4.1 family)ChatGPT Free/Plus caps active conversation context lower than raw API limits and uses file search for large uploadsStrong needle-in-a-haystack benchmarks, yet cost and prefill latency still scale sharply near 1M
Meta Llama 4 Scout (open weights)Up to 10M tokens (interleaved RoPE / NoPE attention)Hosted endpoints typically cap far below 10M due to GPU VRAMRunning anywhere near 10M locally is bounded by KV-cache memory, not weight size
xAI Grok (Grok 3 / Grok 4 / Fast tiers)128K–256K standard; extended 1M–2M on fast/long-context API tiersWeb app manages rolling context & live search separatelyHigh headline capacity still benefits from trimming stale tool outputs in multi-step agents
Google Gemini (Pro / Flash families)1M standard (up to 2M on select tiers)Consumer app caps vary by planContext caching required to keep repeated large-document queries affordable

What 128K, 200K, 1M, and 10M actually hold

Because models read subword tokens instead of words or characters (see why LLMs see tokens instead of letters), source code and JSON consume noticeably more tokens per line than plain English prose:

Context sizePlain English proseReal source code / JSON logsTypical practical sweet spot for strict rule-following
128K tokens~95,000 words~4,000–7,500 linesBest under ~40K–60K active tokens
200K tokens~150,000 words~7,000–12,000 linesBest under ~60K–100K active tokens
1M tokens~750,000 words~35,000–60,000 linesGreat for single-pass corpus search/extraction; compact aggressively for multi-turn agents
10M tokens~7.5M words~350,000+ linesSpecialized batch/needle workloads on dedicated multi-GPU clusters

Remember that every component of a request shares the same window: system prompt + JSON tool schemas + conversation history + retrieved chunks + hidden reasoning (“thinking”) tokens + visible output. A 200K context window with 40K tokens of tool schemas and 80K tokens of un-trimmed tool outputs leaves far less room than teams expect (see what is an LLM context window).

Why 10M tokens is a hardware physics problem (KV cache)

When you see an open-weight model like Llama 4 Scout advertise a 10 million token context window, the catch is not the model file on disk—it is the KV cache sitting in VRAM during inference.

Every single token in the prompt generates Key and Value vectors across every attention layer so the model does not recompute the whole prompt on every generated word (detailed in KV cache explained: why long prompts eat RAM):

KV cache size ≈ 2 × layers × kv_heads × head_dim × bytes_per_param × context_tokens
  • On a modest 8B local model (BF16 KV cache), just 32K tokens already consumes ~4.2 GB of KV cache—nearly matching the 4-bit model weights themselves.
  • Scaling to 1M–10M tokens requires aggressive architectural techniques (Grouped-Query Attention, quantized KV caches, sliding/chunked local attention layers, or ring-attention across multiple GPUs). That is why a single 24 GB GPU or 32 GB Mac can run a model’s weights easily while still crashing with OOM the moment you set num_ctx to 256K+.

Three engineering mistakes teams make with giant context windows

1. Replacing search/RAG with “dump the whole repo in every turn”

Dumping 400K tokens into Turn 1 might work once. In a 15-turn coding or support session, resending 400K tokens 15 times turns into 6 million input tokens billed—and even with prompt caching, any single edit near the top of the prompt busts the cache prefix and forces full prefill recomputation.

Use fast full-text or hybrid retrieval to pull the 5–15 files that matter, and reserve 500K–1M single-shot prompts for genuine whole-corpus audits (for example, auditing cross-file inconsistencies once in a single request). See MCP vs API vs RAG.

2. Trusting “needle in a haystack” benchmarks as proof of reasoning

Finding one out-of-place sentence (“the secret passcode is 4921”) buried in 1M tokens of unrelated essays is pattern retrieval. Real engineering work requires multi-hop reasoning across conflicting constraints—like noticing that rule #3 in AGENTS.md conflicts with a migration written 40,000 tokens earlier.

Multi-hop reasoning degrades far earlier than needle retrieval. Shorter, cleaner context almost always beats a noisy 300K prompt.

3. Ignoring silent truncation on local runners

Cloud APIs return an explicit 400 error when you overflow the context window. Local servers like Ollama default to a small num_ctx (often 2K–8K unless configured) and silently drop the earliest tokens—which can quietly erase your system prompt mid-conversation without throwing an error. Always enforce explicit token accounting in your harness.

Practical decision rule

  • Interactive coding & multi-step agents: Keep active context lean (20K–80K tokens), cap tool output bytes, compact finished turns, and keep static prefixes pinned at token 0 for prompt caching.
  • One-shot document or codebase synthesis: Use a 200K–1M API tier for single-turn reads, structured extraction, or cross-document diffs—then discard the raw context once you have the structured output.
  • Consumer web chats: Treat web apps as having shorter effective memory than the raw API; start a fresh chat whenever a thread shifts goals or starts repeating itself.

Frequently asked questions

Does a 1M or 10M context window work the same in the web chat as in the API? No. Consumer web apps (ChatGPT, Claude, Grok) often enforce tighter per-tier context limits or summarize/retrieve uploaded files behind the scenes, whereas the developer API exposes the raw context window directly—often with higher per-token pricing above a threshold like 200K tokens.

How big is a 1-million-token context window in plain English? In plain English prose, 1 million tokens is roughly 700,000 to 750,000 words—about 8 to 10 full novels. For source code, JSON logs, or SQL dumps, token density is higher, so 1M tokens usually holds roughly 30,000 to 60,000 lines of real repository code.

Why does a model with a 1M or 10M context window still miss instructions buried in a long prompt? Because maximum capacity is not uniform reasoning accuracy. Attention spreads thinner across hundreds of thousands of tokens (“context rot”), distractor text competes with rules, and cost plus time-to-first-token climb rapidly when prompts exceed 100K–200K tokens.

Related reading