What is AI chunk size?
Chunk size is the length in tokens, words or characters of each text chunk documents are split into for retrieval-augmented generation; it is a key setting deciding how precise retrieval is and how much context the model gets.
Chunking is the act of splitting; chunk size is each chunk's target length. Chunk overlap is the length shared between consecutive chunks at their boundary, tuned together with chunk size.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Chunk length
How AI chunk size works
- A target length is set in tokens or characters; chunks are cut below that limit, ideally at paragraph or clause boundaries.
- Small chunks focus on one piece of information, so they are retrieved more precisely, but surrounding context can be lost.
- Large chunks keep context, but irrelevant content weakens retrieval and fills the context window quickly.
- Example calculation: retrieving 8 chunks of 512 tokens uses 8 × 512 = 4,096 tokens of context.
In more detail
Embedding model and reranker token limits
Every embedding model and cross-encoder reranker has a fixed maximum token limit (commonly 512 tokens for classic encoders or up to 8,192 tokens for newer models). Setting `chunk_size` above that limit causes the encoder to silently truncate the tail of each chunk, making everything past the cutoff invisible to vector search.
Characters versus tokens and Turkish tokenisation
Setting chunk size by character count behaves very differently across languages and tokenisers. Agglutinative languages like Turkish generate substantially more subword tokens per character than English, so production pipelines should measure chunk size directly with the target embedding and LLM tokenisers.
Embedding dilution and hierarchical chunking
As chunk size grows, a single embedding vector averages more distinct topics together, diluting semantic specificity, a problem known as embedding dilution. Hierarchical (parent-child) chunking resolves this trade-off by indexing small child chunks (128 to 256 tokens) for sharp retrieval while passing the larger parent section (1,024+ tokens) to the LLM.
Commonly confused terms
| Term | How it differs |
|---|---|
| Context window | Chunk size sets the target length of each text segment, whereas context window is the maximum total number of tokens an LLM can process across system instructions, retrieved chunks, chat history and output combined. |
| Top-k retrieval | Chunk size controls how large each indexed unit is; top-k controls how many of those units are retrieved per query; together they determine the total retrieved token budget (`k × chunk_size`). |
Why AI chunk size matters for on-premises AI
No single chunk size suits every document; contract clauses, technical instructions and emails need different sizes. Research shows the choice of retrieval unit markedly affects both retrieval and answer quality, with splitting by document structure able to beat fixed length. Size also sets how many chunks fit in context and the token cost. The right value is found by testing on the organisation's own documents and questions.
A manufacturer cuts chunks at step boundaries in its technical instruction archive; finding that steps lose context in very short chunks and retrieval weakens in very long ones, it picks a middle value with its own question set.
Common questions
What is the best chunk size?
There is no universal best value. It is chosen by testing on your own data for the document type, question style and the model's context window.
How does chunk size affect answer quality?
Small chunks are precise but may lack context. Large chunks keep context but bring irrelevant content and fill the context.
Related terms
Sources
- Dense X Retrieval: What Retrieval Granularity Should We Use?, 2023
- Financial Report Chunking for Effective Retrieval Augmented Generation, 2024
In the glossary: Glossary, A to D