Skip to content
RAG Explained Better

Late Chunking and Contextual Retrieval

Embedding the chunk with its document context attached: what it fixes, and the published recall numbers.

Late chunking embeds the whole document, or as much as the embedding model context window allows, first, then mean-pools the token vectors inside each chunk span so every chunk vector carries document context without an LLM prepend. Contextual retrieval (Anthropic, September 2024) takes the other path: an LLM writes a short situating preface, usually 50 to 100 tokens, and prepends it to each chunk before embedding and BM25. Both fix the lost-context problem that naive chunk-then-embed creates; they differ in where the context is attached. The strategy catalogue sits on chunking for RAG; boundary methods such as semantic chunking remain orthogonal to late pooling.

What problem does lost context create in RAG?

Naive chunk-then-embed makes each chunk embedding independent, so pronouns and entity references that resolve outside the chunk never reach the vector and retrieval misses passages a human would connect. Overlap windows and multi-pass heuristics can blunt this sometimes; Jina part I notes they carry no theoretical guarantee.

Günther et al. (arXiv:2409.04701, 2024) and the Jina late-chunking write-up demonstrate this on a Berlin Wikipedia split. Against the query embedding for Berlin, the chunk about 3.85 million inhabitants scores cosine 0.708 under naive chunking versus 0.825 under late chunking; the city-is-also-one-of-the-states chunk scores 0.753 versus 0.850 with jina-embeddings-v2-small in their Table 1.

Anthropic SEC-filing example is the same failure in financial prose: a chunk that only says the company revenue grew by 3 percent does not name the company or the quarter. Related but distinct, when the answer text itself straddles two chunks, that is chunk-boundary loss.

Understanding the failure clarifies why late pooling and contextual prepends exist as separate fixes. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

How does late chunking work?

Late chunking inverts the usual order: the transformer sees the long document first, and chunk boundaries are applied after the forward pass by mean-pooling only the token spans that belong to each chunk. Jina part II frames the encoder attention as bidirectional conditioning across the window, so every token embedding already carries document context before pooling.

Three steps define the pipeline. Tokenize the full document up to the model context length, for example 8192 tokens for jina-embeddings-v2 and v3. Run the transformer once. Apply mean pooling over each chunk span using boundary cues after the forward pass, which is why the method is called late.

A chunker is still required for spans. Fixed tokens, sentences or semantic breaks can supply boundaries, but embeddings are conditional on the document rather than independent. Jina part II reports late plus fixed-token often matches or beats naive plus semantic boundaries on their ablations, while a weaker model with late does not beat a stronger model without late.

Contextual retrieval attaches context as text instead of attention, which is the next contrast. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

What is contextual retrieval?

Contextual retrieval, as Anthropic described in September 2024, has an LLM read the whole document plus each chunk and write a short situating context, usually 50 to 100 tokens, that is prepended before embedding and before BM25. Anthropic used Claude 3 Haiku for that situate step and published a situate-chunk prompt template.

Prompt caching makes the one-time cost about 1.02 dollars per million document tokens under their assumed sizes of 800-token chunks, 8k-token documents, 50-token instructions and 100-token contexts (Anthropic 2024). The stack can combine contextual embeddings, contextual BM25 and a reranker.

Smaller corpora under roughly 200k tokens or about 500 pages may skip RAG and put the whole knowledge base in the prompt with caching instead, which Anthropic notes as an alternative when the corpus fits.

Attachment point is the cleanest way to separate late chunking from contextual retrieval. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

How does late chunking differ from contextual retrieval?

Late chunking and contextual retrieval solve the same lost-context problem at different attachment points: late puts context into the embedding model attention with no extra stored text, while contextual retrieval stores literal prepended tokens that also lift BM25. Late needs a long-context mean-pooling embedder and no LLM at ingest; contextual works with any embedder that accepts longer texts and costs an LLM call per chunk.

Jina part II cites a qualitative study in arXiv:2409.04701 finding Anthropic-style enrichment performs similarly to late chunking on their setup; treat that as one paper observation, not a universal ranking. Neither method replaces choosing readable chunk spans for the generator.

ColBERT-style late interaction storage is a different extreme and is owned by ColBERT late interaction; this page only uses the Weaviate storage sketch as contrast. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Published metrics must stay inside each paper rather than being subtracted across methods. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

What published retrieval gains are reported?

Published gains must be dated and kept on their own metrics; late chunking reports BEIR nDCG@10 lifts while contextual retrieval reports top-20 failure-rate cuts, and those figures must not be subtracted across papers. Prove any lift on your own labelled set via chunking evaluation.

Günther et al. arXiv:2409.04701 (2024) Table 2 nDCG@10 with jina-embeddings-v2-small at about 256-token chunks: SciFact 64.20 to 66.10; TRECCOVID 63.36 to 64.70; FiQA2018 33.25 to 33.84; NFCorpus 23.46 to 29.98; Quora 87.19 stays 87.19 because documents were already one chunk. Longer average document length correlated with a larger late-versus-naive gap in that paper.

Anthropic September 2024: Contextual Embeddings cut top-20-chunk retrieval failure rate 35 percent from 5.7 percent to 3.7 percent; plus Contextual BM25 cut 49 percent to 2.9 percent; plus Cohere rerank cut 67 percent to 1.9 percent, using 1 minus recall@20 averaged across their domains with Gemini Text 004 top-20.

Cost and storage decide whether those lifts are affordable at ingest scale. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

What does late chunking cost compared with contextual retrieval?

Late chunking cost is one long-context forward pass per document or window at ingest, with storage identical to naive chunking because vector count equals chunk count. A universal dollars-per-query figure for late chunking across providers is not published; teams must meter their own runs.

Weaviate blog (2024) storage sketch at 768-d fp32 for 100k documents times 8k tokens: late interaction or ColBERT about 2.46 TB with 8k vectors per document versus naive or late chunking about 4.9 GB with 16 vectors per document at 512-token chunks. That is a structural illustration, not a vendor quote of your bill.

Contextual retrieval adds Anthropic published one-time about 1.02 dollars per million document tokens to generate contexts under their size assumptions, plus longer indexed text from the 50 to 100 token prepend, plus LLM latency at ingest. Query path cost is unchanged except for richer embeddings and BM25; reranking adds query-time cost owned elsewhere.

Model requirements determine whether late chunking is even available on your stack. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Which embedding models support late chunking?

Late chunking needs an embedder that exposes token-level embeddings before pooling, offers long context around 8192 tokens or more, and uses mean pooling because CLS or max pooling cannot span-pool cleanly. Single final vector APIs usually cannot implement late pooling without extra hooks.

Demonstrated in published work: jina-embeddings-v2-small and base-en, jina-embeddings-v3, and nomic-v1 in Jina part II ablations. The method is not exclusive to Jina; any long-context mean-pool model can implement it per the paper framing. Model choice still dominates the late-versus-naive gain.

Selection criteria for embedding models live on what embeddings decide in RAG and embedding model selection; this page only states late-chunking compatibility constraints. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Choosing between late and contextual is the operational decision after models are known. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

When should you use late chunking instead of contextual retrieval?

Choose late chunking when you control a long-context mean-pooling embedder, want naive-chunk storage cost, see context loss on long documents, and refuse per-chunk LLM spend at ingest. Choose contextual retrieval when the embedder is short-context or a closed single-vector API, you already pay for an LLM with prompt caching, you need BM25 to see situating terms, or a custom situate prompt helps a domain.

Choose neither first when chunk size and overlap are still untuned; fix boundaries at chunk size and overlap then re-measure. Pair either method with structure-aware or semantic splitters when spans themselves are unreadable for generation, including document-structure chunking.

Both can still return a span that is hard for the generator if boundaries ignore discourse. Measure before fleet rollout rather than copying published deltas onto a different corpus. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Implementation is a handoff to pinned pipelines rather than a notebook on this page. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

How do you implement late chunking?

Late chunking implementation is a pooling change after a long-context forward pass; the reference repository is jina-ai/late-chunking on GitHub from Günther et al., and Weaviate notes the pooling change is small while the retrieval pipeline stays ordinary vector ingest. Vectors land as ordinary chunks in Weaviate, Pinecone, Qdrant or Milvus.

Contextual retrieval follows the Anthropic cookbook situate prompt and related Bedrock Knowledge Bases custom-chunk paths documented 2024 to 2025. Runnable pinned builds live at building a RAG pipeline; measured comparison protocol lives at chunking evaluation.

Pin embedder revision, chunker version and situate prompt hash beside the collection name so rebuilds reproduce the same vectors. Dual-run against the prior naive index before promoting. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Late and contextual are context-attachment upgrades, not replacements for honest span selection. Operators should treat this as a hard requirement when comparing chunkers on the same labelled set.

Operational control 1: freeze embedder revision, chunker version and collection identifier on Weaviate before dual-running Pinecone or Qdrant peers, and promote only after labelled metrics clear a threshold registered before the change.

Operational control 2: freeze embedder revision, chunker version and collection identifier on Weaviate before dual-running Pinecone or Qdrant peers, and promote only after labelled metrics clear a threshold registered before the change.

Operational control 3: freeze embedder revision, chunker version and collection identifier on Weaviate before dual-running Pinecone or Qdrant peers, and promote only after labelled metrics clear a threshold registered before the change.

Operational control 4: freeze embedder revision, chunker version and collection identifier on Weaviate before dual-running Pinecone or Qdrant peers, and promote only after labelled metrics clear a threshold registered before the change.

Late chunking pools after a long-context transformer so chunk vectors carry document attention without LLM prepends. Contextual retrieval prepends situating text so embeddings and BM25 both see the context. Published BEIR nDCG@10 and Anthropic failure-rate lines stay on their own papers; choose by embedder capability, ingest budget and labelled proof on your corpus.