What is late chunking?
Late chunking is an embedding method that first passes the whole document through a long-context embedding model, so every token representation has seen the entire document, then forms chunk vectors by averaging tokens within chunk boundaries.
Unlike classic chunking, which splits first and embeds each chunk blind to outside context, late chunking splits after embedding, so referring phrases such as “this system” also carry document context. Contextual retrieval tackles the same problem by adding notes to the text.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Late chunking
- Origin
- 2024, Günther et al.
How late chunking works
- The whole document, or the largest part fitting the model's context window, goes into the embedding model at once.
- The model produces a vector per token that has seen the rest of the document.
- Chunk boundaries are set as usual by sentence, paragraph or token count.
- Each chunk's vector is the average of the token vectors within its boundaries and is written to the index.
In more detail
The bidirectional attention requirement
Late chunking works best with bidirectional Transformer encoders trained for mean pooling over token representations. In decoder-only embedding models with causal attention, earlier tokens cannot attend to text appearing later in the document, weakening cross-chunk context flow unless bidirectional attention is enabled (as in LLM2Vec-style adaptations).
Character to token offset mapping
Implementing late chunking requires mapping character-based chunk spans (such as paragraph or sentence offsets) accurately onto subword token indices using tokeniser offset mappings. Misaligned boundaries can split words mid-token or include unintended tokens in the chunk average, degrading retrieval precision.
Quadratic indexing cost, context dilution and hybrid search
Unlike classic chunking, where embedding complexity scales linearly with the number of short chunks, late chunking computes self-attention over the entire document at once, incurring quadratic memory and compute scaling O(N²) with sequence length. On very long documents, attention dilution can also weaken a chunk's local signal, so practitioners balance macro-window size, FlashAttention support and hybrid BM25 + dense scoring.
Commonly confused terms
| Term | How it differs |
|---|---|
| Contextual retrieval | Contextual retrieval calls an LLM during indexing to prepend a short document-level summary to every chunk before standard embedding, whereas late chunking generates no extra text and preserves document context directly through long-context token embeddings before pooling. |
| Late interaction (ColBERT) | ColBERT keeps a separate vector for every token in a passage and computes late-interaction (MaxSim) scoring at query time, whereas late chunking collapses each chunk's contextualised tokens into a single mean-pooled dense vector at index time. |
Why late chunking matters for on-premises AI
Company documents are full of referring phrases: “the parties” in contracts, “the system above” in specifications. Late chunking helps such chunks match the right query and, unlike contextual retrieval, needs no language model call per chunk; the only extra cost is long-context embedding. It needs an embedding model supporting long context that averages token vectors. Documents longer than the model's window are processed in sections, with the gain measured on the organisation's own documents.
A railway operator indexes maintenance specifications with late chunking; a chunk starting “the braking system in question” is also found by queries about the system named at the start of the document.
Common questions
How does late chunking differ from contextual retrieval?
Contextual retrieval has a language model write a note for each chunk. Late chunking adds no text; it carries context into vectors by embedding the whole document before splitting, with no model call per chunk.
Does late chunking work with any embedding model?
No. It needs a model supporting long context that averages token vectors. Models relying on a single summary token cannot use it directly.
Related terms
Sources
- Günther et al., Late Chunking: Contextual Chunk Embeddings Using Long-Context Embedding Models, 2024
In the glossary: Glossary, D to L