← Back to article

Equation 6 · What Actually Happens Inside a Very Long Claude Context Window

What does this equation mean?

CLC∼O(n2⋅d),CRAG∼O(k2⋅d),k≪n.C_{\mathrm{LC}} \sim O(n^2 \cdot d), \qquad C_{\mathrm{RAG}} \sim O(k^2 \cdot d), \qquad k \ll n.

Read the formula alongside the article passage below. Each part has a deeper page with its role in the equation, the supporting passage and nearby citations.

This mathematical expression combines the displayed quantities; its precise role follows from the surrounding article text. Read the equation part by part below; each part has a contextual explanation and a link to its mathematical background.

Read it piece by piece

CLCC_{\mathrm{LC}}

Symbol C_LC

CLC_LC is a part of this expression. Its role is fixed by the surrounding article and by the operations shown in the formula.

Understand this part →

OO

Symbol O

O is a part of this expression. Its role is fixed by the surrounding article and by the operations shown in the formula.

Understand this part →

n2n^2

Symbol n^2

the square of n; the writing.

Understand this part →

dd

Symbol d

d is a part of this expression. Its role is fixed by the surrounding article and by the operations shown in the formula.

Understand this part →

CRAGC_{\mathrm{RAG}}

Symbol C_RAG

CRC_RAG is a part of this expression. Its role is fixed by the surrounding article and by the operations shown in the formula.

Understand this part →

k2k^2

Symbol k^2

The square of k: multiply k by itself.

Understand this part →

kk

Symbol k

k is a part of this expression. Its role is fixed by the surrounding article and by the operations shown in the formula.

Understand this part →

nn

Symbol n

the writing.

Understand this part →

multiplication

multiplication

Multiply the quantities on either side.

Understand this part →

subscript

subscript

The lower label selects a particular version, component, or indexed member of the quantity. For example, x₀ and xₜ can be values at different positions.

Understand this part →

superscript

superscript

A raised number can be a power. When it is a label or bound, it selects a case or the upper limit of a sum; the formula’s structure distinguishes these uses.

Understand this part →

See an illustrated explanation →

How to interpret it

Read this expression with the definitions, units, and assumptions supplied by the article.

What the article says around this equation

It is worth being precise about what “just use a longer context” actually replaces, because the alternative is not vague. Retrieval-augmented generation, as originally formalised by Patrick Lewis and colleagues, pairs a parametric model with a separate non-parametric retrieval step: a retriever selects a small number of passages likely to be relevant to a query from a much larger corpus, and only those selected passages, not the whole corpus, are placed in the model’s context for generation [ 14 ] . This publication’s own reporting on retrieval-augmented systems covers that mechanism, its indexing choices, and its failure modes at length elsewhere; the point relevant here is narrower and…
Read the full surrounding passage
It is worth being precise about what “just use a longer context” actually replaces, because the alternative is not vague. Retrieval-augmented generation, as originally formalised by Patrick Lewis and colleagues, pairs a parametric model with a separate non-parametric retrieval step: a retriever selects a small number of passages likely to be relevant to a query from a much larger corpus, and only those selected passages, not the whole corpus, are placed in the model’s context for generation [ 14 ] . This publication’s own reporting on retrieval-augmented systems covers that mechanism, its indexing choices, and its failure modes at length elsewhere; the point relevant here is narrower and purely architectural. Long-context use skips the selection step entirely: the entire candidate material goes into the window, and the burden of finding what matters is placed on attention at inference time rather than on an index built in advance. Writing n for the number of tokens placed directly in context and k for the number of tokens a retriever would instead have selected, the quadratic cost derived above means the two approaches sit in different complexity regimes for handling the same underlying material: CLC∼O(n2⋅d),CRAG∼O(k2⋅d),k≪nC_{\mathrm{LC}} \sim O(n^2 \cdot d), \qquad C_{\mathrm{RAG}} \sim O(k^2 \cdot d), \qquad k \ll n. That gap is not an incidental efficiency detail. It is the reason retrieval-augmented systems existed as a technique before million-token windows did, and it is why the comparison between the two approaches remains a live, actively contested research question rather than a settled one, even after context windows grew by orders of magnitude.

Read the equation in its article →

Sources cited in the surrounding passage

These citations give research context. Read each source to check which claims it supports.

Return to What Actually Happens Inside a Very Long Claude Context Window

See this formula across 1 published context →

Browse the mathematical compendium →