Article

The economics of a million-token context: where the memory you save goes back

Long-context marketing has moved from 'supports 1M tokens' to 'native 1M tokens', but what decides whether you can use it is KV cache memory, prefill compute and decode bandwidth. Using the GDN + MLA + DSA hybrid published for GigaChat 4, this article breaks down the cost structure of long context, explains why sparse attention gives back on short sequences what it saves on long ones, and where the break-even point sits for real workloads.

One-line summary

Long context is not free capacity but a loan denominated in tokens: borrow more, and every decoded step has more bytes to move.

Why "supported" and "usable" are different things ​

Almost every mainstream model can now claim 128K or 1M context in its config. Deployment is limited by three hardware constraints rather than the number on the model card:

  • Memory: KV cache grows linearly with context, and a million-token conversation can consume more VRAM for cache than for weights.
  • Prefill compute: before the first token, the whole context passes through attention, and whether that is quadratic or linear depends on the implementation.
  • Decode bandwidth: every generated token rereads the entire history. Longer context, more bytes per step, slower decoding.

Algorithms can compress the second; the first and third only shrink by storing and reading less. Every long-context technique answers one question: can the model look only at the history it actually needs?

GigaChat 4, released November 26, 2026, is a useful sample to take apart.

Three layers: linear attention as the base, MLA for precision, DSA for selection ​

Both GigaChat 4 sizes share one architecture: Gated DeltaNet alternating with MLA at 3:1, with DeepSeek Sparse Attention on the MLA blocks.

ComponentProblem it solvesCost
GDN (Gated DeltaNet)Compresses long sequences into a fixed-size recurrent state that does not grow with lengthLimited capacity, weak detail recall
MLA (multi-head latent attention)Low-rank compression shrinks KV cache storageExtra projection compute, complex implementation
DSA (sparse attention)Each query attends to a selected subset of history (2,048 tokens)An indexer must choose first, and choosing costs compute

The logic: most layers use linear attention with a fixed-size state carrying long-range information, producing no length-dependent cache. A minority (one in four) use MLA for exact attention so key positions are not compressed away. Within those MLA layers, DSA shrinks exact attention from the full sequence to 2,048 selected tokens.

The effect is a flatter growth curve. A pure-attention model going from 32K to 1M grows its KV cache 32x; in a hybrid, only a quarter of layers produce length-dependent cache, and DSA plus MLA compression push the growth to another order of magnitude.

Where the saved memory goes back ​

Reading only that section, the conclusion would be "long context got cheap." In a real bill, saved memory returns in three other forms.

First, the indexer's fixed overhead. DSA must first compute which historical tokens are worth attending to. That indexer is an extra attention computation, small in scale but performed for every query. The longer the sequence, the better it amortizes; the shorter, the more it looks like pure overhead.

GigaChat's technical notes say this explicitly: in short contexts or small decode batches, the DSA indexer can "add more work than it saves." That is not modesty but the general rule of sparse attention — sparsity has a startup cost, and only long sequences can spread it.

Second, recall loss from linear attention. A fixed-size recurrent state cannot store all history losslessly. The GDN layers carry long range, but they remember a summary, not the text. When a task requires quoting one sentence from a long document or recalling a specific constraint across many turns, the pressure falls entirely on the quarter of MLA layers. That is why hybrids keep full-attention blocks — pure linear models usually lose on long-context retrieval.

Third, drafters and speculative decoding. Slow long-context decoding is commonly offset by speculation: a small drafter proposes tokens, the main model verifies in batch. GigaChat 4 offers a recurrent multi-token-prediction head and a diffusion drafter DFlash2 trained from scratch. The extra memory and compute are net expense in short-output scenarios.

So the accurate reading of "native 1M context" is: for long input and long output, the cost curve is flattened; for short input and short output, it is more expensive than a pure-attention model of the same size. An app answering a few hundred tokens per query is paying for capacity it never uses.

Training the window open ​

Context length is not a setting but a training stage. GigaChat 4 extended in steps — 32K, 128K, native 1,048,576 — with indexer training and joint optimization at the final length before SFT and RL.

StageMain costKey risk
32K pretrainingStandard pretraining computeNone
Extend to 128KLong-document corpora, new attention kernelsPositional extrapolation failure
Extend to 1MSequence parallelism, activation checkpointing, indexer trainingRegression on short sequences

The last item is the familiar trap: architecture changes and data-mix shifts made for long context can degrade short-sequence quality. GigaChat 4's selling point of Instant and Reasoning sharing one checkpoint is partly a response — a model must stay stable across lengths, not just optimize the longest one.

A rough cost table ​

A coarse-grained framework, not a quote:

Use caseTypical inputIs long context worth it?
Support Q&A, classification, extractionA few hundred tokensNo: indexer and drafter are net cost
Single-document Q&A5K–20KMarginal: MLA starts to pay off
Repository-scale retrieval-augmented coding50K–200KYes: reading a module at once beats multi-round retrieval
Long-document comparison, audit200K–1MYes, but pair with retrieval to avoid recall loss
Full 1M-token close reading1MOnly when exact quoting is required; very costly

For most businesses the break-even sits between 50K and 200K: long enough to amortize sparse attention's startup cost, not so long that KV cache dominates memory.

Beyond that, "long context plus retrieval" beats "pure long context." The model does not forget; the bill grows because every stored token must be read again, and that cost multiplies with calls.

What product teams should ask ​

  1. On what task was 1M validated? Fits in, or fits in and still answers correctly? The former is a config claim; the latter needs cross-segment benchmarks like GraphWalks.
  2. Does short-sequence quality regress? Test at your real input lengths, not at 1M.
  3. What shape is the cache curve? Hybrids flatten it but do not eliminate it. Ask for memory and throughput at 32K, 128K and 512K.
  4. What does the license allow? GigaChat 4's 708B is MIT; the 37B is personal noncommercial. The one you can run may not be the one you can sell with.

Boundaries ​

  • GigaChat 4's architecture configuration (GDN and MLA at 3:1, DSA selecting 2,048 tokens, the 32K→128K→1M staged training, two drafters, 708B/37B sizes and license split) comes from GigaChat's official blog and Hugging Face model card, cross-checked against Unite.AI and iMasters.
  • The statement that DSA may add more work than it saves in short contexts or small decode batches is from the official technical notes.
  • The cost analysis (memory, prefill, decode bandwidth) is general inference-engineering reasoning, not a measurement of this model.
  • The cost table gives order-of-magnitude ranges, not quotes or selection conclusions.
  • No testing was performed; every figure is attributed and unpublished numbers are not inferred.

Sources ​