Real Studios

RAG chunking: how to split documents for reliable retrieval

Decorative title card illustration for RAG chunking article

RAG chunking is the process of splitting source content into retrievable units before it gets embedded and indexed. For most production systems, start with document-aware or adaptive multi-scale chunking, paired with strict metadata and an evaluation suite, rather than a flat fixed-size splitter.

Two reasons drive that recommendation. First, chunk boundaries preserve or destroy semantic meaning: cut a clause in half and the embedding represents neither idea properly. Second, different queries need different granularity. A lookup question needs a tight, precise chunk; a "summarise this policy" question needs a wider one. A single fixed chunk size cannot serve both.

The practical starting point for any RAG pipeline:

  • Map your document types first, since a legal contract and a support FAQ need different treatment.
  • Default to a recursive or semantic splitter with 10 to 20% overlap while you build.
  • Move to adaptive or multi-scale indexing once retrieval quality plateaus.
  • Attach metadata (source, heading path, chunk ID) to every unit from day one.
  • Measure chunk quality intrinsically, not just by watching the LLM's final answer.

TL;DR:

  • Adaptive and multi-scale chunking methods significantly improve retrieval accuracy by matching chunk granularity to specific query types, unlike fixed-size splits.
  • Ingested content should be split with 10 to 20% overlap and stored with detailed metadata to prevent boundary loss and facilitate effective filtering.
  • Intrinsic metrics such as completeness, cohesion, size compliance, and block integrity should be measured before evaluating retrieval performance.
  • Rechunk and re-embed the entire corpus whenever the embedding model changes, since chunk boundaries rarely transfer cleanly across models.
  • Use different strategies for tables and images, extracting structured data or generating summaries, and store pointers to the original content for accurate retrieval.

Table of Contents

Where chunking sits in the RAG pipeline

Chunking is not a preprocessing chore you bolt on before the "real" work starts. It's a data-modelling decision that shapes everything downstream, on the same level as choosing an embedding model or a vector database schema.

The pipeline runs in a fixed sequence:

  1. Ingest: pull raw documents from source systems and strip boilerplate, navigation, and footers.
  2. Chunk: split cleaned content into retrievable units, attaching metadata to each.
  3. Embed: convert each chunk into a vector using your chosen embedding model.
  4. Index: store vectors and metadata in a vector database for similarity search.
  5. Retrieve: pull the top-k chunks matching a query at inference time.
  6. Generate: feed retrieved chunks to the LLM as context for the final answer.

Every failure downstream traces back to a decision made at step 2. If a chunk splits a definition from its qualifying clause, the retriever will find the definition but hand the generator half the truth. If a chunk merges three unrelated topics because it hit an arbitrary character limit, the embedding sits in a semantic no man's land and matches nothing well.

Microsoft's own architectural guidance for Azure RAG solutions recommends separating the loading logic from the chunking logic entirely, and persisting chunk outputs so you're not re-splitting the same corpus on every pipeline run. That separation matters more than it sounds. It means you can swap chunking strategies, re-run evaluations, and compare results without re-parsing thousands of PDFs each time.

Three failure modes show up repeatedly in naive implementations. Chunks that split mid-sentence produce embeddings that represent fragments, not ideas. Chunks with no overlap lose facts that sit exactly on a boundary. And chunks with no metadata become unfilterable, meaning your retriever has no way to prioritise a 2026 policy document over one from 2019 sitting right next to it in vector space.

Hands splitting documents for chunking process

Which chunking strategies actually exist?

Eight approaches cover almost every RAG chunking scenario you'll encounter, and each one carries a distinct trade-off between simplicity, semantic accuracy, and compute cost.

  • Fixed-size: splits by a fixed token or character count. Cheapest to build, fastest to run, but blind to sentence and paragraph boundaries. Suits homogeneous short-form content like chat logs or product descriptions.
  • Sentence/paragraph-based: splits on natural language boundaries using a sentence tokeniser. Keeps grammatical units intact but produces uneven chunk sizes. Suits prose-heavy content like articles and reports.
  • Recursive: tries a hierarchy of separators (double newline, then single newline, then sentence, then word) until chunks fit a target size. A strong general-purpose default. Suits mixed structured/unstructured documents like technical manuals.
  • Semantic: groups sentences by embedding similarity rather than position. Produces topically coherent chunks but costs more to compute at ingest time. Suits long-form content where topics shift gradually, like research papers.
  • Proposition-based: extracts atomic factual statements from text, one idea per chunk. Extremely precise retrieval but generates many small units. Suits dense reference material like encyclopaedias or regulatory text.
  • Adaptive/multi-scale: indexes content at multiple granularities or dynamically selects chunk size per document. Best overall retrieval performance in evaluated tests, at the cost of engineering complexity. Suits high-stakes or heterogeneous corpora.
  • LLM-driven: uses a language model to propose split points or generate summaries at ingest time. Captures nuance simple splitters miss, but adds latency and API cost to every ingest run. Suits corpora where semantic precision justifies the spend.
  • Multimodal/table-preserving: treats tables, images, and text separately, storing raw structure alongside generated summaries. Suits financial reports, scientific papers, and anything with embedded tables or figures.

The Weaviate engineering team's guidance frames this as finding a "chunking sweet spot" specific to your own corpus, and that framing is right. There's no universal winning method, only the method that suits your document type and query patterns. A systematic evaluation published on arXiv backs this up empirically, finding that only a handful of methods, recursive semantic, fixed-size, sequential hierarchical clustering, and max-min clustering, complete reliably at scale, while others fail on timeouts or memory limits with larger corpora.

Fixed-size, sentence and recursive chunking: parameters that matter

Simple chunkers remain the right choice for a large share of production systems, provided you get the numbers right.

Token windows. Practitioner guidance from Meilisearch's chunking research puts short entries (FAQ answers, product specs) at 200 to 400 tokens, and documentation sections or long-form prose at 400 to 800 tokens. Go smaller and you lose context; go larger and you dilute the embedding with too many competing ideas, hurting precision.

Diagram showing token window size effects on chunking quality

That's your insurance against a critical fact sitting exactly on a boundary and disappearing from both chunks' effective meaning.

Tokens versus characters. Always count in tokens, not characters, once you know your target embedding model. A character count assumes uniform word length, which breaks down badly across languages and technical vocabulary full of long compound terms. Use the tokeniser that matches your embedding model, whether that's a tiktoken-compatible BPE tokeniser for OpenAI-style models or a SentencePiece tokeniser for many open-source alternatives. Mismatched tokenisers routinely cause silent size overruns that only surface as truncated context weeks into production.

Recursive splitter pattern. Build a separator hierarchy: try splitting on double newlines first (paragraph breaks), fall back to single newlines, then sentence boundaries, then whitespace, only reaching a hard character cut as a last resort. After splitting, run a merge pass that recombines any chunk falling below a minimum size threshold with its neighbour, so you're not indexing a lonely three-word fragment as its own retrievable unit.

  • Set separator priority: `

→ ` → sentence boundary → word boundary.

  • Define a minimum chunk size (roughly 50 tokens) below which fragments merge forward.
  • Cap maximum chunk size at your target token window, not above it.
  • Re-run the merge pass after any manual document cleanup, since editing shifts boundaries.

Pro Tip: Log the separator that actually triggered each split, alongside the chunk itself. When retrieval quality drops after a document format change, that log tells you in seconds whether the splitter silently fell back to character-level cuts on a document type it wasn't tuned for.

Semantic, clustering and proposition chunking explained

Embedding-based chunking treats chunk boundaries as a similarity problem rather than a formatting problem, and it earns its extra cost on corpora where topics drift gradually rather than breaking at clean paragraph marks.

The core technique works in four steps:

  1. Embed every sentence in a document individually using your chosen embedding model.
  2. Calculate cosine similarity between each sentence and the next in sequence.
  3. Mark a chunk boundary wherever similarity drops below a threshold, typically somewhere between 0.5 and 0.7 depending on your embedding model's typical similarity range.
  4. Merge any resulting chunk below your minimum size threshold with an adjacent one.

That similarity-drop threshold needs tuning per corpus. Set it too high and you get one chunk per document, since almost every sentence transition looks like a "topic change" relative to a strict cutoff. Set it too low and you fragment every paragraph into single sentences, defeating the point of semantic grouping in the first place. Run the threshold against a labelled sample of your own documents before trusting it in production.

Clustering approaches. Where semantic drop-detection works sentence by sentence, clustering methods group an entire document's sentences into topic clusters first, then form chunks from each cluster. Hierarchical agglomerative clustering (HAC) builds a tree of sentence similarities and cuts it at a chosen depth, giving you control over the number of resulting chunks. K-means requires you to specify the number of clusters upfront, which suits corpora where you already know roughly how many topics a document type contains, such as a standard contract template with five known sections. The arXiv evaluation found sequential HAC among the more robust methods at scale, while some naive clustering approaches struggled with runtime on larger datasets.

Proposition extraction. This is the most granular approach available: rather than grouping sentences, you extract individual atomic facts. "The policy renews annually and requires 30 days' notice to cancel" becomes two propositions, one for the renewal term and one for the cancellation window. The clinical evaluation in the PMC study on adaptive and proposition chunking found this level of granularity valuable specifically because medical queries tend to target single, precise facts rather than broad summaries.

Proposition chunking only works well if you preserve a parent-child relationship back to the source passage. Store each proposition with a pointer to its originating chunk or document, because a query that needs framing, "under what conditions does this policy apply", will fail against an isolated proposition stripped of its surrounding context.

Pro Tip: Don't run semantic chunking on your entire corpus by default. Reserve it for document types where you've confirmed topic drift is gradual, then use fixed or recursive chunking everywhere else. The embedding cost at ingest time scales with every sentence you process, and most structured content doesn't need it.

Why adaptive and multi-scale chunking win in testing

Adaptive and multi-scale chunking consistently outperform single-strategy approaches in evaluated benchmarks, and the gap is large enough to change how you should architect a production pipeline from the outset.

Multi-scale indexing takes the query-dependency problem head-on: instead of picking one chunk size for your entire corpus, you index the same content at several granularities simultaneously, say 200, 500, and 1,200 tokens, then aggregate retrieval results across all three at query time using a rank fusion method such as Reciprocal Rank Fusion (RRF). Research on query-dependent chunking from AI21 shows this approach approximates the retrieval performance of an oracle that always picked the theoretically optimal chunk size per query, something no single fixed granularity can do because different questions genuinely need different resolutions.

A clinical RAG evaluation comparing adaptive against fixed-size chunking found substantially higher precision and recall for adaptive chunking, indicating that fixed-size chunking missed a significant portion of relevant passages that adaptive methods retrieved. Read the full PMC clinical evaluation.

Adaptive selection works differently from multi-scale indexing: rather than indexing everything multiple times, you choose a chunking strategy per document (or per section) based on intrinsic quality signals measured at ingest time. A practical metric set for that decision includes:

  • Completeness: does the chunk contain a full idea, or does it cut off mid-thought?
  • Intrachunk cohesion: how semantically similar are the sentences within a single chunk to each other?
  • Size compliance: does the chunk fall within your target token range, or is it an outlier?
  • Block integrity: are structural elements like tables, code blocks, or lists kept whole rather than split?

The arXiv systematic evaluation frames these intrinsic metrics as the correct way to select a chunker, because they measure chunk quality independently of any downstream retriever or LLM, letting you diagnose a bad chunking decision before it ever reaches the generation step.

A third pattern worth building toward is LLM-guided splitting: prompting a language model to propose regex-style split points based on document structure it recognises, then running a merge pass that recombines any resulting fragments below your minimum size. This costs an API call per document at ingest time, which rules it out for very large corpora on a tight budget, but it catches structural cues (numbered clauses, embedded definitions, nested headings) that a rule-based splitter simply cannot see.

Engineer using phone for LLM-guided document splitting

How should you chunk tables, images and other formats?

Tables and images need separate handling from prose, because flattening a table into plain text destroys the row-to-column relationships that give it meaning in the first place.

The standard pattern for tabular content: extract the raw table structure (as HTML, Markdown, or a structured JSON representation), generate a dense natural-language summary of what the table contains and shows, and store both. Index the summary for retrieval, since it embeds far better than raw tabular data, but keep a pointer in the chunk's metadata back to the original structured table so the generation step can pull the exact figures when the query demands precision rather than a paraphrase.

Images follow a similar two-track approach:

  • Generate a caption or summary using a vision-language model (VLM) and embed that summary for retrieval.
  • Store the original image URL or file path in the chunk's metadata, never the raw image bytes in your vector index.
  • For documents with embedded charts or diagrams, run OCR first to capture any text labels the VLM might miss.
  • Treat a scanned PDF page as an image-plus-OCR hybrid rather than assuming clean extractable text.

Choosing between OCR and a full VLM pipeline changes your effective chunk size. OCR alone gives you raw text you can chunk using standard token-window rules. A VLM summary, by contrast, tends to compress an entire complex figure into a single dense paragraph, meaning that one "chunk" now represents proportionally more source information than a text chunk of the same token length. Account for that when setting retrieval k values across mixed-modality corpora, or your ranker will systematically undervalue image-derived chunks relative to prose ones of similar length.

How do you evaluate whether your chunking actually works?

Evaluate chunking on two separate axes: intrinsic metrics that measure chunk quality on its own terms, and extrinsic metrics that measure how well chunks perform inside a full retrieval pipeline. Conflating the two is the single most common mistake in RAG evaluation, because a bad retriever can make good chunks look useless, and a lucky embedding model can make bad chunks look adequate.

Intrinsic metrics, measured on the chunks alone, before any embedding or retrieval happens:

  1. Completeness: the proportion of chunks containing a full semantic unit rather than a truncated fragment.
  2. Intrachunk cohesion: average pairwise sentence similarity within each chunk, flagging chunks that mix unrelated content.
  3. Size compliance: the percentage of chunks falling within your defined target token range.
  4. Block integrity: whether structural elements (tables, lists, code blocks) survived the split intact.

Extrinsic metrics, measured once chunks are embedded, indexed, and queried:

MetricWhat it measuresWhen to use it
PrecisionShare of retrieved chunks that are actually relevantEvery evaluation run
RecallShare of all relevant chunks that were retrievedEvery evaluation run
F1 scoreHarmonic mean of precision and recallSummarising a single trade-off number
nDCGRewards relevant chunks ranked higher, not just presentWhen result order matters to the generator
Hits@kWhether at least one relevant chunk appears in the top kQuick pipeline health checks

A reproducible evaluation protocol needs three components. First, sample a representative test set from your actual corpus, not a generic benchmark, since chunking performance is highly document-specific. Second, run every candidate chunking strategy against the same test set and the same embedding model, so the comparison isolates the chunking variable. Third, apply statistical testing, not eyeballing, before declaring a winner: an ANOVA across your candidate strategies followed by a Tukey post-hoc test tells you whether an apparent performance gap between two chunkers is a real, reproducible effect or noise from your sample size. Add a human review pass on a random subset of retrieved results, because automated metrics miss cases where a chunk is technically relevant but reads as nonsensical once stripped of its original context.

What tools and checklist make chunking production-ready?

A production chunking pipeline needs three categories of tooling: a tokeniser matched to your embedding model, a splitter library that supports the strategy you've chosen, and a visualiser that lets you inspect chunk boundaries before they go live.

For tokenisation, match the tokeniser family to your embedding model rather than defaulting to whatever ships with your splitter library; a mismatch silently produces chunks that overrun your intended size once the real model tokenises them, and you can use BabyLoveGrowth's structured data tools for schema and structured-data checks useful in preprocessing. For splitting, a recursive character-based splitter covers most general text with low engineering effort, semantic splitters require an embedding call per document and moderate effort to tune thresholds, and LLM-driven splitters require the most engineering effort but handle irregular document structures no rule-based splitter anticipates. Azure's own RAG chunking guidance lists this exact spread, fixed-size, semantic, custom code, and LLM augmentation, alongside notes on the engineering cost each option carries. A chunk visualiser, even a simple script that renders boundaries as highlighted text, catches obvious mid-sentence splits far faster than reading raw JSON output.

The ingestion checklist worth running before any chunker goes to production:

  • Strip navigation, footers, and boilerplate from HTML before chunking starts, not after.
  • Generate deterministic chunk IDs, ideally a content-hash UUID, so re-ingesting unchanged content doesn't create duplicates.
  • Attach required metadata keys to every chunk: source_url, heading_path, chunk_id, document_type, ingested_at.
  • Persist chunk outputs to storage separately from the embedding step, so you can re-embed without re-chunking.
  • Version your chunker configuration and store that version string in chunk metadata.
  • Batch document processing in parallel where your storage layer supports concurrent writes, but cap concurrency to avoid overwhelming your embedding API's rate limits.

Pro Tip: Build your chunk visualiser before you build your evaluation suite, not after. Fifteen minutes scanning highlighted chunk boundaries by eye catches obvious splitter bugs, like a table getting sliced mid-row, that intrinsic metrics might average out and miss entirely.

How do you manage chunks after launch?

A chunked index isn't a one-time artefact. It's a living dataset that needs the same lifecycle discipline as any production database, and skipping that discipline is how teams end up with a bloated index full of stale, duplicated content nobody notices until retrieval quality quietly degrades.

Use deterministic content-hash UUIDs for every chunk ID, generated from the chunk's own text, so re-ingesting an unchanged document produces identical IDs rather than duplicate entries. Practitioner guidance on RAG chunking best practices recommends storing your chunker's version string alongside every chunk's metadata specifically so you can identify and re-process anything generated under an outdated configuration.

Set explicit operational policies rather than letting the index grow unmanaged:

  • Define a time-to-live (TTL) for content types that go stale, like pricing pages or seasonal promotions.
  • Run a deduplication pass on a schedule, since re-ingested or lightly edited documents otherwise accumulate near-duplicate chunks.
  • Re-chunk and re-embed your entire corpus whenever you swap embedding models, since chunk boundaries tuned for one model's similarity space rarely transfer cleanly to another.
  • Prune orphaned chunks whose source document no longer exists in your content management system.

Monitor three signals continuously: retrieval quality against a fixed evaluation set (to catch silent regressions), index size growth over time (to catch runaway duplication), and query latency (since multi-scale indexing and larger chunk counts both add retrieval overhead). Set alert thresholds on each, because a slow drift in retrieval precision rarely triggers a support ticket. It just quietly erodes trust in the system until someone finally notices.

Real-studios practitioner notes and resources

Real-studios builds custom RAG systems, voice agents, and chat agents for UK businesses, and chunking decisions sit at the centre of nearly every one of those engagements. A poorly chunked knowledge base is the single most common cause of a customer-facing AI agent giving confidently wrong answers, and diagnosing it requires exactly the intrinsic metric work covered above.

Real-studios' approach to any RAG engagement typically includes:

  • An audit of the client's existing document corpus to identify which chunking strategy suits each content type.
  • Implementation of adaptive or multi-scale indexing where document heterogeneity justifies the added engineering cost.
  • Generative Engine Optimisation (GEO) work, ensuring the same well-chunked, well-structured content that serves internal RAG retrieval also helps the business get recognised in AI engine responses.
  • Post-launch support to monitor retrieval quality and re-chunk when embedding models or document formats change.

Businesses considering an AI-powered automation and integration project can review Real-studios' service pages for details on how chunking, ingestion, and ongoing maintenance fit into a full production pipeline.

Getting professional support for your RAG pipeline

Building a chunking pipeline that survives contact with real documents, real embedding model migrations, and real query patterns takes more engineering time than most teams budget for. The gap between a working prototype and a production system that holds up under monitoring, re-chunking, and deduplication policies is exactly where projects stall.

RAG Chunking: Strategies for Splitting and Structuring Documents

Real-studios designs and implements custom RAG systems for UK businesses, covering chunking strategy selection, metadata schema design, and the evaluation protocols needed to prove a pipeline actually retrieves what it should before it ever reaches a customer. That work sits alongside voice, chat, and email agents built on the same retrieval foundation, plus Generative Engine Optimisation to keep the underlying content visible as search shifts toward AI-generated answers.

Teams that need help connecting a chunking pipeline to existing systems, CRMs, document stores, or support platforms, can explore Real-studios' systems integration services for a scoped approach to production-grade ingestion and retrieval.

Key Takeaways

Adaptive and multi-scale chunking outperform fixed-size splitting because they let retrieval granularity match query intent rather than forcing every question through one chunk size.

PointDetails
Start document-awareMatch your chunking strategy to document type rather than applying one splitter across a mixed corpus.
Use 10 to 20% overlapSet overlap within this range on fixed or recursive chunks to stop facts disappearing at boundaries.
Measure chunks intrinsicallyScore completeness, cohesion, size compliance, and block integrity before blaming the retriever.
Move to adaptive when it mattersReserve adaptive or multi-scale indexing for high-stakes or heterogeneous corpora where the accuracy gap justifies the cost.
Re-chunk on model changesRe-embed and re-chunk the full corpus whenever you swap embedding models, since boundaries rarely transfer cleanly.

An editorial take on adaptive chunking

The conventional advice on RAG chunking still treats it as a solved problem: pick a chunk size, add some overlap, move on. That advice was never good enough, and the evaluation data backing adaptive chunking's precision and recall gains over fixed-size approaches makes the case plainly. Teams that stop at fixed-size chunking are leaving retrieval accuracy on the table because they never measured chunk quality independently of the LLM's final output.

The overrated idea is that a bigger or fancier embedding model will fix a bad retrieval pipeline. It won't. A brilliant embedding model given a chunk that splits a clause from its qualifier will faithfully embed nonsense.

Prioritise intrinsic chunk metrics before you touch your embedding model or reranker. Completeness, cohesion, and block integrity tell you where the problem actually lives, and that diagnosis should come before any architecture change, not after three failed attempts to fix retrieval by swapping vector databases.

— Oded

Sources

These sources form the evidence base behind every recommendation in this article.

All guides