What is recursive chunking?
Recursive chunking is a chunking method that first splits text by its largest natural separator, such as a blank line between paragraphs, then re-splits chunks exceeding the target size with smaller separators such as lines, sentences and words in turn until each fits the size limit.
Unlike fixed-size chunking, which looks only at length and can split a sentence in half, recursive chunking splits at paragraph and sentence borders where possible. Semantic chunking sets borders by shifts in meaning rather than text structure.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Recursive text splitting
How recursive chunking works
- A target chunk size, overlap and a priority-ordered separator list are set: paragraph, line, sentence, word.
- The text is split with the first separator.
- Each chunk over the target size is re-split with the next separator until it fits.
- Small neighbouring chunks are merged within the size limit and overlap added.
In more detail
Token budgets rather than characters and Turkish tokenisation
Chunk size and overlap should ultimately be measured in tokens matching the chosen embedding model's tokeniser, not raw characters. In morphologically rich or agglutinative languages like Turkish, the same character length can produce more tokens than English, risking silent truncation if the embedding model's context limit is exceeded.
Preventing context loss: heading prefixes, parent-document retrieval and late chunking
Even with overlap, a chunk split mid-document often loses essential context such as which product, fiscal year or section heading it belongs to. Modern pipelines mitigate this by prepending parent headings as metadata, using parent-document (small-to-big) retrieval or applying contextual enrichment and late chunking so embeddings retain document-wide context.
Layout-aware parsing as a prerequisite for complex PDFs and tables
Recursive chunking assumes text has already been cleanly linearised. On complex PDFs containing multi-column layouts, nested tables or running headers and footers, applying recursive splitting before layout-aware parsing fragments table rows and mixes unrelated columns.
Commonly confused terms
| Term | How it differs |
|---|---|
| Semantic chunking | Semantic chunking computes embeddings for sentences or sliding windows and splits where cosine similarity drops, whereas recursive chunking relies purely on deterministic syntax or character separators without running an embedding model during splitting. |
| Layout-aware document parsing | Layout-aware / document-element parsing uses OCR or vision-language models to reconstruct headings, multi-column reading order and tables into structured blocks before chunking, whereas recursive chunking operates on already-extracted linear text strings. |
Why recursive chunking matters for on-premises AI
In enterprise documents, paragraph and clause borders are meaningful units; recursive chunking keeps them while controlling chunk size, making it a common default. A study questioning the cost of semantic chunking reports its extra compute is not justified by consistent performance gains, which makes simple structure-aware methods a good starting point. A study of chunking financial reports shows chunking by document elements such as headings, tables and paragraphs markedly improves RAG results; where document structure is known, separators should follow it.
A software company indexes its technical documentation with recursive chunking that respects heading, paragraph and code block borders, so code samples are never split and answers do not lose commands.
Common questions
How does recursive chunking differ from fixed-size chunking?
Fixed-size chunking splits by length alone. Recursive chunking tries paragraph, line and sentence borders in turn to reach the size limit.
How are separators chosen?
By document format. Plain text favours paragraphs and sentences, Markdown its headings and code its function and block borders.
Related terms
- Chunking
- Fixed-size chunking
- Semantic chunking
- Chunk size
- Chunk overlap
- Document parsing
- Recursive Abstractive Processing for Tree-Organised Retrieval
Sources
- Qu, Tu and Bao, Is Semantic Chunking Worth the Computational Cost?, 2024
- Jimeno Yepes et al., Financial Report Chunking for Effective Retrieval Augmented Generation, 2024
In the glossary: Glossary, R to Z