Data & databases

Chunking

AI-assisted editorial review:

Chunking is the preprocessing step that splits long documents into smaller pieces suited to embedding and retrieval. In vector-based RAG, documents may be divided by paragraph, sentence, structure, or token count, and the chunks are embedded for retrieval. Short documents may not need splitting.[2] Chunks that are too large mix in unrelated content, and chunks that are too small lose surrounding context. Chunk size, overlap, and boundary rules strongly affect retrieval quality, which makes chunking one of the first things to tune in a RAG system.[2][3]

What does Chunking mean in simple terms?

Chunking means cutting long material into pieces that are easy to search. When the document collection is too large to use directly, the text is split by paragraph or by a fixed length, and each piece is stored separately. It is like indexing a thick rulebook clause by clause instead of handing over the whole book. Cut too big and unrelated content gets mixed in; cut too small and the context before and after is lost, which can reduce answer accuracy. How large each piece is, and how much neighboring pieces overlap, is one of the first settings that decides RAG quality. The same document can give different search results depending on how it is split.[2][3]

How can Chunking be explained with an analogy?

It is like cutting a thick rulebook into clauses and indexing each one.

Where is Chunking used?

Case 1

Anthropic — Adding context to each chunk

In September 2024, Anthropic introduced Contextual Retrieval, which prepends a short, chunk-specific explanation of context to each chunk before embedding it and building a BM25 index.[1] The goal is to fix retrieval misses caused by chunks that lose their context. Its reported averages used the top-performing Gemini Text 004 embedding configuration across the tested domains. Anthropic measured the top-20 retrieval failure rate, that is, how often the right chunk was missing from the top 20 results.[1]
Result: Top-20 failure rate 5.7% → 3.7% with contextual embeddings (−35%), → 2.9% when adding contextual BM25 (−49%), and → 1.9% with reranking as well (−67%).[1]

Case 2

NVIDIA — Benchmarking chunking strategies

In June 2025, NVIDIA compared page-level and token-based chunking on five datasets, testing token sizes of 128, 256, 512, 1,024, and 2,048 with 15% overlap.[3] Page-level chunking had the highest average answer accuracy and the most consistent results across datasets. In a separate comparison, page-level also beat section-level chunking on average, although one dataset did slightly better with sections.[3]
Result: Page-level average accuracy 0.648 with the lowest standard deviation (0.107), versus 0.603–0.645 for token-based settings.[3]

Case 3

Chroma — Measuring retrieval by chunking method

In a July 2024 technical report, Chroma compared chunking methods on recall, precision, and related metrics.[4] It also tested the setting described in that 2024 report as OpenAI Assistants’ documented default, 800 tokens with 400 tokens of overlap, which showed slightly below-average recall and the lowest scores on the other metrics.[4] In the main comparison with five retrieved chunks and text-embedding-3-large embeddings, an LLM-based semantic chunker that asks a model to choose split points reached the highest recall.[4]
Result: LLMSemanticChunker (GPT-4o) recall 91.9%, the highest tested; 800/400 default with slightly below-average recall.[4]

Case 4

Upstage (Korea) — Parsing documents before chunking

Korean AI company Upstage offers Document Parse, which recognizes layout elements such as tables and headings and converts documents into a form LLMs can read.[5] Upstage says it processes 100 pages in under a minute and reports table recognition scores on its own benchmark.[5] Recognized structure can inform chunk boundaries, especially around tables; the cited parsing benchmark does not measure a downstream chunking or RAG improvement.
Result (vendor-reported): TEDS 93.48 and TEDS-S 94.16; about 10x faster than Unstructured and AWS Textract and 4x faster than LlamaParse on 50–100-page documents with similar settings.[5]

Try it today

  1. Split one internal document with a text splitter from LangChain or LlamaIndex, once at 512 and once at 1,024 tokens, using a token-aware length setting. The LangChain recursive splitter example counts characters by default, so do not treat its numeric chunk size as tokens without configuring token measurement.[6][7]
  2. Index it with no overlap and with about 15% overlap, then compare search results for the same question.[3]
  3. Find three cases where the answer was cut at a chunk boundary and retrieval failed, and note them.
  4. For documents with many tables or lists, compare paragraph-level and page-level splitting by eye.[3]
  5. In Anthropic's Contextual Retrieval article, check which combination produced the 49% and the 67% reductions.[1]

Limits and direction

There is no single chunk size that works for every document. As NVIDIA's benchmark shows, the best size depends on the type of document and question.[3] Splitting mechanically at a fixed length can cut sentences or tables at a boundary and break the context. In Chroma's tests, the historical 800/400 setting evaluated in the report ranked low on most metrics.[4] Structured content such as tables, code, and lists often needs its own handling, which is why document-structure-based chunking exists.[2][5] More overlap reduces boundary cuts but stores the same text in several chunks, so the index grows. Settings chosen once need to be revisited when the mix of documents changes.[3]

Two directions stand out. The first is splitting by meaning, using semantic or LLM-based chunkers; in Chroma's comparison, the LLM-based chunker had the highest recall.[4] The second is adding context or reading the document structure first. Anthropic adds context to each chunk, and Upstage parses tables and layout before chunking.[1][5] Retrieval systems also expand results by pulling in neighboring chunks after search to restore context.[2] Measuring the options on your own data, as NVIDIA and Chroma did, is more reliable than copying a default.[3][4]

Which sources explain Chunking?

  1. Anthropic — Introducing Contextual Retrieval (2024-09-19) — https://www.anthropic.com/engineering/contextual-retrieval
  2. Pinecone — Chunking Strategies for LLM Applications (official guide) — https://www.pinecone.io/learn/chunking-strategies/
  3. NVIDIA Technical Blog — Finding the Best Chunking Strategy for Accurate AI Responses (2025-06-18) — https://developer.nvidia.com/blog/finding-the-best-chunking-strategy-for-accurate-ai-responses/
  4. Chroma — Evaluating Chunking Strategies for Retrieval (technical report, 2024-07-03) — https://research.trychroma.com/evaluating-chunking
  5. Upstage — Document Parse: Let LLMs read your documents with speed and accuracy (provider article; access checked 2026-10-13) — https://www.upstage.ai/blog/en/let-llms-read-your-documents-with-speed-and-accuracy
  6. LlamaIndex Docs — Node Parser Modules — https://developers.llamaindex.ai/python/framework/module_guides/loading/node_parsers/modules
  7. LangChain Docs — Splitting recursively — https://docs.langchain.com/oss/python/integrations/splitters/recursive_text_splitter