Frontier Foundry

Long Context

The Library · Context Engineering & Memory

Models that read very long inputs (hundreds of thousands to millions of tokens).

Also called: long-context, context window, million-token, 1m context, 1m token. In the glossary.

Long Context is cooling this week (×0.46 against the eight weeks before). What is moving.

How it works, as a machineThe Marshalling Yard · loads

Follow one load from a pasted codebase to the next word written, in a freight marshalling yard with a long siding.

  1. Weigh the load
  2. Price the load
  3. Roll the load through
  4. Park keys and values
  5. Pick the blocks
  6. Write the next word
Play Long Context

Long Context in plain words

Long context means a model can read very long inputs in one go, from hundreds of thousands to millions of tokens. Whole codebases or stacks of documents fit in a single prompt. Reading that much costs more and takes longer, and filling the window does not mean every part of it is used well.

An analogy

A much bigger desk. Now every folder in the case can be spread out at once and nothing has to be fetched from the cabinet. But someone facing two thousand open pages still has to find the one paragraph that matters, and the rent on the desk is charged by the page.

How Long Context connects

9 typed relations in the knowledge graph

Builds on

  • Context Engineering: What goes in the window, and what is kept out of it, is the same choice made before the load is pasted.
  • Inference Serving: Prefill, the parked cache and the queue of requests are what a serving stack schedules.

Built on by

  • Context Engineering: The desk is the context window: its size, and why a bigger one does not mean a better desk.
  • Efficient Attention: Picking blocks is how a model reaches a million tokens without reading them all.
  • KV Cache: A longer context is more blocks on the shelves per user.
  • State Space Models: The ledger is the other answer to a long window: one fixed state in place of a cache that grows with the page.

Made possible by

  • Efficient Attention: Cheaper attention lets the window grow without the cost growing with its square.

Limits

  • AI Agents: An agent can only act on what still fits in its window.

An alternative to

Often in the same sources

Speculative Decoding, Efficient Attention, Quantization, Mixture of Experts, On-Device & Local Models, KV Cache

See Long Context in the knowledge graph

Who is behind Long Context

people, labs, products and models

Named in its facts

What the sources say

2 parts · 13 sources · updated 2026-11-27

Long context means a model can take in hundreds of thousands to millions of tokens at once. Each token is read in prefill and parked as keys and values, every new word rereads that cache, and the cost, the memory and the uneven use of the middle all grow with the length.

The receiving siding: weigh the load, roll it in, park its cache

A very long input arrives as one load. It is counted in tokens, every token is read once in prefill, and a key and a value for every token are parked in fast memory for later. Prefill is compute-bound; the parked cache is what fills the memory.

  1. The weighbridge counts the load in tokens and checks it against the siding limit of about a million.
  2. The tariff board prices the load per million tokens; a new tokenizer can make the same text cost 30% more.
  3. The prefill hump tower rolls every car of the load through attention in one pass, and the pass blocks the line.
  4. The siding rack parks a key and a value for every car in fast memory, and the rack fills as the load grows.
1 million tokens
The context window of one model, as listed in the developer notes of its release; a tokenizer change in the same release gave about 30% more tokens for the same text Simon Willison
30% more tokens
Tokens produced from the same input text by one lab's new tokenizer compared with its older one, reported in the lab's notes and noted as effectively a 30% price increase Simon Willison
890 bytes per token
Global KV cache footprint held in fast memory by one 1M-token model after compression, about a quarter of its predecessor; reported by the model's authors Hugging Face
5 million tokens
Context length a training run reached with a mix of memory techniques on one eight-GPU node; reported by the research lead of the cloud that ran it Max Ryabinin
3x
More requests served at once with a paged KV cache than with memory reserved up front for each request; reported by the speaker Daniel Kim
  • One model's release notes list a 1 million token context window and 128,000 maximum output tokens, at $3 per million input tokens. Simon Willison
  • A new tokenizer made the same text count as about 30% more tokens, so the same price per million tokens became a higher price per document. Simon Willison
  • Prefill starts when a request arrives and ends when the first token is written; it computes a key and a value vector for every prompt token. Daniel Kim

When it breaksOne long prompt blocks the whole pipeline. Coding agents send prompts of 200K, 500K or a million tokens. The prefill for such a prompt is one long compute job, and while it runs no other request, long or short, can get through. People asking short chat questions queue behind it. Daniel Kim

The switch yard: pick the blocks, write the word

Every word that is written has to look back at the parked cache. Reading every car of a million-car load for every word costs more with each word; sparse attention picks a few blocks that matter. What the model does with a long input is also uneven: the start and the end are used, the middle often is not.

  1. The block switchboard picks which blocks of the siding a word looks at and leaves the rest unread.
  2. The word platform reads the picked blocks and writes the next word, one word at a time.
7x
How much dearer a later token can be to generate than an earlier one on frontier open-weight models; reported by the paper's authors Hugging Face
47.26x
Speedup of block-sparse prefill over FlashAttention-2 at 128K context in FP8 on H20 GPUs; measured by the paper's authors Hugging Face
0.7 points
Largest accuracy gap to full attention when only a 2,048-token KV budget is kept in fast memory; the price of picking blocks, measured by the paper's authors Hugging Face
1.69x
Throughput over dense serving on a reasoning workload with 0.1 points of accuracy loss; measured by the paper's authors Hugging Face
+6.80 points
128K average RULER gain of Stable GDN-2 over GDN-2 in the recurrent setting, on ~1.6B-parameter models; paper's own result Hugging Face
  • One sparse design has an index branch that selects what matters more in the context, and a sparse attention branch that computes only on the selected blocks. Olive Song
  • Block-sparse prefill finds the attention pattern on the fly and keeps only the blocks above a dynamic threshold, so most of the quadratic work is skipped. Hugging Face
  • Decode-time attention is naturally sparse, so only the KV entries of the most relevant tokens need to sit in fast memory; the rest wait in host memory and are prefetched. Hugging Face

When it breaksFour tasks in, two lost in the middle. A code-review team gave one agent a large context and several tasks at once. It focused on two of the four; those came out well, and the other two were lost in the middle of the context. Nupur Sharma

Open questionDo agents need a million-token window, or is frequent compaction enough?

  • Agents that read whole environments and many rounds of tool replies cannot do complex tasks in a shorter context, so the window itself has to grow. Olive Song
  • With frequent compaction, frontier models lose little or no task accuracy on long-horizon and long-input tasks while keeping short contexts, so long context may be unnecessary. Hugging Face

Sources

13 in all

More in Context Engineering & Memory

The Library: the whole area
  • Context EngineeringDeciding what goes into a model's limited context window, when, and in what form.
  • Retrieval-Augmented GenerationFetching relevant documents at question time and putting them in the prompt.
  • EmbeddingsVectors that place similar meanings near each other, used for search and clustering.
  • Agent MemoryLetting agents keep and recall information across sessions.
  • Prompt EngineeringWriting instructions and examples that steer a model's behavior.
  • Prompt CachingReusing computation for repeated prompt prefixes to cut cost and latency.
  • Knowledge GraphsStoring facts as linked entities so agents can traverse relationships.