Est.

Chunking is where most RAG pipelines quietly lose, and document structure should drive the splits

Document structure, not token limits, should determine where RAG pipelines split their chunks.

Staff Writer · · 6 min read
Features · August 6, 2026 · 6 min read · 1,314 words

Most RAG pipelines fail quietly, and they fail at chunking. Not at the model, not at the retriever. At the part nobody shows you in the demo.

I've watched this happen repeatedly: a team spends weeks tuning embeddings, swapping retrievers, prompt-engineering their way around a problem that was introduced the moment someone set a token window and called it preprocessing. The outputs sound plausible. They're often wrong. And because they sound plausible, nobody goes looking upstream.

The Part Nobody Talks About in Demos

When a document enters a RAG pipeline, it gets broken into retrievable pieces. The logic is sound: smaller, focused segments match user queries more cleanly than a full document dump. Retrieve the right chunk, hand it to the model, get a grounded answer.

The failure lives in what "right chunk" actually means in practice.

Most implementations treat chunking as a solved problem. You pick a token limit, maybe 512 or 1024, add a small overlap buffer, and ship it. The splitter fires at the limit and doesn't ask what it's cutting through. You end up with what I'd call contextually orphaned fragments: a conclusion severed from the premise that justified it, a definition retrieved without the term it defines, a numbered procedure split between two chunks so neither one is actionable on its own. It's like tearing a map in half and handing someone one piece — technically they have a map, but good luck finding the destination.

The model receives these fragments and does what it can. It's good at that. Frighteningly good. Which is precisely the problem: the output sounds coherent even when the underlying retrieval was a mess, and that coherence masks the failure so completely that teams spend months tuning the wrong layer.

What Fixed-Size Splitting Actually Destroys

Fixed-size chunking persists because it's simple to implement, easy to reason about, and plays nicely with the input constraints of most embedding models. I understand why it's the default. I've used it myself in early prototypes where speed mattered and document structure was an afterthought. The problem is that "default" has a way of becoming "permanent" once a system reaches production.

Documents are not uniform. A technical specification alternates between dense narrative prose and structured tables that only make sense together. A regulatory filing has a defined hierarchy where subsection language is legally constrained by the section that precedes it. A clinical trial report moves through background, methodology, findings, and interpretation in a sequence where each stage assumes you've read the last. When you slice across those architectures at arbitrary intervals, you're not just inconveniencing the model; you're destroying the organizational logic that made the document interpretable in the first place.

The retriever, working on embedding similarity, finds the chunk that looks most like the query. If the material the user actually needs straddles a boundary, neither adjacent chunk tells the full story. The model fills the gap. Sometimes correctly, sometimes not, and often with a confidence that gives you no signal either way.

The Document Already Knows Where to Cut

Here's the thing that took me longer than I'd like to admit to fully internalize: the author of every well-structured document already solved this problem for you. Headers, section breaks, paragraph boundaries, list terminations, table edges: these are not decorative. They are semantic signals that indicate where one discrete idea ends and another begins. The chunking logic should be reading those signals, not overriding them with a token counter.

Markdown makes this almost trivially legible because the structure is explicit and machine-parseable. HTML and XML carry equivalent signals. Even PDFs, which can be a genuine parsing nightmare depending on how they were generated, have recoverable structure through font size, line spacing, and positional patterns. I've worked with pipelines that extract meaningful hierarchy from PDFs that look like complete chaos to a human reader; the structure is there, just encoded differently.

The principle is consistent regardless of format: a section boundary is a natural split point because someone put it there deliberately. A paragraph break is a softer but still meaningful division. A mid-sentence token cutoff is almost never the right place to divide anything, and if your pipeline is doing it routinely, you're paying for that everywhere downstream.

Overlap Is a Patch, Not a Solution

The standard workaround for arbitrary boundary cuts is chunk overlap: let adjacent chunks share a token window so context bleeds across the seam. It helps. It's also treating a symptom rather than fixing the underlying problem, and it introduces its own costs that teams frequently underestimate.

Overlap inflates your index. It increases retrieval cost. It introduces redundancy that can genuinely confuse both the retriever, which now surfaces near-duplicate content at different ranks, and the model, which has to reconcile slightly varied versions of the same passage. You're compensating for bad cuts by making the system work harder on everything else. Put another way: overlap is duct tape on a pipe — it holds until the pressure builds.

That said, overlap has a legitimate role. Corpora of legacy documents with no recoverable formatting, scanned PDFs that have been OCR'd into undifferentiated walls of text, transcripts stripped of all structure: in those cases, generous overlap paired with careful deduplication is a reasonable mitigation. But it should be a fallback for genuinely unstructured material, not the primary strategy for a corpus where most documents have discernible organization. And most of them do.

What Structure-Aware Chunking Actually Unlocks

Once you're splitting along structural lines rather than arbitrary token limits, something else becomes available that fixed-size pipelines simply can't offer: hierarchical retrieval.

A top-level header represents a topic. Its subsections represent aspects of that topic. The paragraphs within those subsections contain specific claims, evidence, or details. This hierarchy is information, and it tells you something critical: how granular your retrieval needs to be given the nature of the query.

A broad, exploratory question is best served by a section-level chunk that provides orientation and scope. A precise, narrow question needs the specific paragraph or list item that contains the fact. A system that preserved document hierarchy can serve both, dynamically, depending on what the query demands. A system that flattened everything into uniform blocks at ingestion has permanently discarded that capability. There's no retrieving it later.

Some production pipelines implement what's called small-to-large retrieval: they retrieve at the granular level first for precision, then expand to the parent context before passing anything to the model. This gives the model the specific evidence it needs alongside enough surrounding material to interpret it correctly. That expansion is only coherent because the structural chunking preserved the relationships in the first place. Without that, expansion is just grabbing adjacent blocks and hoping.

Where to Actually Look When Things Go Wrong

If you're auditing a RAG pipeline that's underperforming, the first diagnostic question isn't about the model and it isn't about the retriever. Pull a random sample of chunks from your index. Read them. Ask yourself honestly: does this feel complete? Does it have a beginning and an end in any meaningful sense, or does it just start and stop because a counter fired?

If the chunks feel truncated, decontextualized, or like someone handed you page three of a conversation with no other pages available, that's where the accuracy is going. No embedding model upgrade fixes that. No retriever tuning compensates for fragments that were broken before they were indexed.

Structure-aware parsers require more engineering than a character splitter. Different document types need different parsing strategies, and that means investing in logic that has to be maintained. I'm not going to pretend otherwise. But the return is proportionate: a retrieval layer that actually surfaces complete, contextually coherent information is the thing every downstream component depends on. Get it wrong at ingestion and you spend the rest of the project's lifetime managing symptoms of a problem you could have prevented in the first place.

More in Features