Home / Insights / Generative AI and LLMs
Generative AI and LLMs
Chunking Strategies for Enterprise RAG: Documents, Tables and Long PDFs
Most disappointing RAG pilots fail before the language model is involved. If documents are cut in the wrong places, the retriever never finds the right passage, and no prompt can fix that. Chunking deserves the same design attention as model choice.
Key takeaways
- Chunking decides what the retriever can find; poor splits cause wrong or incomplete answers that look like model failures.
- Use structure first: split on headings and sections, keep tables intact, and fall back to fixed-size splits only for unstructured text.
- Attach metadata to every chunk (document, section path, page, date, access group) so answers can cite and filter correctly.
- Treat tables and long PDFs as separate pipelines with their own parsing and representation choices.
- Choose chunk sizes by testing against real questions, not by copying a default.
On this page
- Why chunking decides answer quality
- The main chunking strategies and their trade-offs
- Handling tables without losing their meaning
- Long PDFs, scans and slide decks
- Metadata, freshness and permissions per chunk
- How to choose settings: an evaluation-led process
- Costs, risks and an implementation checklist
- Frequently asked questions
- Sources and methodology
Retrieval-augmented generation (RAG) gives a language model access to your documents by retrieving relevant passages and passing them into the prompt. The approach was formalised in the 2020 paper by Lewis and colleagues, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, which paired a generator with a dense retriever over a passage index. In enterprise settings the passages are not tidy encyclopaedia paragraphs. They are 80-page policy manuals, scanned contracts, product specifications full of tables and slide decks exported to PDF.
This article is for CTOs, engineering leads and product owners building or buying an internal knowledge assistant. It explains the main chunking strategies, how to handle tables and long PDFs, what metadata to attach, and how to choose settings using evidence rather than defaults. It reflects how we approach enterprise knowledge search projects, where document ingestion, parsing and chunking are designed before any prompt is written.
Why chunking decides answer quality
A RAG system answers from what it retrieves. Retrieval works on chunks: each chunk is embedded as a vector (and often indexed for keyword search too), and at query time the closest chunks are returned. If the relevant fact is split across two chunks, or buried in a chunk dominated by unrelated text, the retriever may miss it.
Three ways bad chunking shows up
- Missing context: a chunk says ‘this limit does not apply to contractors’ but the limit itself is in the previous chunk. The model answers confidently with half the rule.
- Diluted meaning: a chunk covers three unrelated topics, so its embedding sits between them and matches none of them well.
- Broken structure: a table is flattened into a stream of numbers with no headers, so neither the retriever nor the model can tell which value belongs to which row.
Why more context is not a free fix
It is tempting to retrieve more chunks or make them larger so that the answer is surely somewhere in the prompt. Research suggests this has limits. In Lost in the Middle, Liu and colleagues found that language models used information best when it appeared at the beginning or end of the input, with performance dropping significantly for information in the middle, even for models designed for long contexts. Precise retrieval of well-formed chunks remains more reliable than stuffing the prompt.
Constraints from the models
Embedding models have input limits, and text beyond them is truncated. Microsoft’s Azure AI Search chunking guidance notes, for example, that text-embedding-3-small accepts up to 8,191 tokens. Even within the limit, a single vector represents a long, multi-topic passage poorly, which is a second reason to chunk.
The main chunking strategies and their trade-offs
There is no single best strategy. The right one depends on document type, question type and how much structure your parser can recover.
| Strategy | How it works | Best for | Weaknesses |
|---|---|---|---|
| Fixed-size with overlap | Split every N tokens or characters, repeating some text between chunks | Unstructured prose, quick baselines | Cuts through sentences, sections and tables |
| Recursive or sentence-aware | Split on paragraphs, then sentences, then words until under the size limit | General documents without reliable headings | Still blind to document hierarchy |
| Structure-aware (by section) | Start a new chunk at each heading; merge small sections; split large ones | Policies, manuals, contracts, wikis | Depends on good heading detection in PDFs |
| Element-based | Parse into elements (title, paragraph, list, table) and group them | Mixed layouts, scanned documents after OCR | Needs a capable parser |
| Semantic | Group adjacent sentences while their embeddings stay similar | Long narrative text with weak formatting | Extra compute; harder to predict and debug |
| Parent-child (small-to-big) | Retrieve on small chunks, then pass the larger parent section to the model | Precise questions that need surrounding context | More storage and indexing logic |
Fixed-size as a baseline, not a destination
Fixed-size splitting is easy and gives you a baseline to measure against. Microsoft’s guidance offers a starting point of around 512 tokens with 25% overlap for fixed-size chunks, and notes that highly structured content may need less overlap while narrative text may benefit from more. Treat numbers like these as the first row in your experiment log.
Structure-aware splitting for enterprise documents
Most corporate documents have structure: numbered clauses, headings, sections, lists. Libraries such as Unstructured implement this directly. Its chunking documentation describes a by_title strategy in which a title element starts a new chunk so that no chunk spans two sections, with small sections merged up to a size limit. For policies and contracts this is usually a better default than fixed-size splitting.
Parent-child retrieval
Small chunks retrieve precisely; large chunks give the model context. Parent-child retrieval gets both: index sentences or short paragraphs, but when one matches, send the whole parent section. This works well for questions such as ‘what is the notice period for senior staff?’ where the answer is one sentence but its exceptions are nearby.
Handling tables without losing their meaning
Tables are where naive pipelines fail most visibly. A rate card, a product specification or a benefits schedule carries meaning in the relationship between headers and cells. Flattened into plain text, that relationship disappears.
Principles for tables
- Detect tables explicitly. Use a parser or document AI service that identifies tables and cells, rather than relying on raw PDF text extraction.
- Keep each table as its own chunk. Unstructured’s documentation, for example, isolates table elements so they are never combined with surrounding text, and splits only oversized tables.
- Preserve headers. Represent tables as Markdown or HTML so column headers stay attached. When a long table must be split, repeat the header row in every part.
- Add a caption or summary. Generate or extract a short description (‘2024 travel allowance rates by grade and region’) and index it with the table so that natural-language questions match.
- Link back to context. Store the section heading and page so the answer can cite where the table came from.
Row-level representations
For large lookup tables, such as price lists or parts catalogues, consider converting each row into a sentence-like record (‘Grade C, London, daily meal allowance: value’) and indexing rows individually, alongside the full table. For tables that people query with filters and arithmetic, a structured database with a text-to-SQL or tool-calling step may serve better than RAG at all.
When to keep tables out of the vector index
If users ask ‘which supplier had the lowest unit price last quarter’, the answer requires computation across rows. Retrieval of text chunks is the wrong tool. Route such questions to structured data and keep RAG for questions answered by reading.
Long PDFs, scans and slide decks
Long PDFs combine every difficulty: inconsistent layouts, headers and footers repeated on every page, multi-column text, footnotes and embedded images. Getting clean text out is a parsing problem that comes before chunking.
Parsing steps that pay off
- Remove repeated headers, footers and page numbers before chunking, or they pollute every chunk’s embedding.
- Recover reading order for multi-column layouts; raw extraction often interleaves columns.
- Detect headings by font size, numbering or layout analysis so structure-aware chunking has something to work with.
- Run OCR on scanned pages and record a quality score so low-confidence pages can be flagged.
- Handle slides as units: one slide, with its title and notes, is usually a natural chunk.
Keep the document’s address
For an 80-page manual, a chunk is only useful if the answer can say where it came from. Store a section path (‘Part 3 > Leave > 3.4 Parental leave’), page numbers and the document version. Prepending the document title and section path to the chunk text before embedding often helps retrieval, because a passage that simply says ‘the employee may request an extension’ becomes ‘Parental leave policy, 3.4: the employee may request an extension’.
Very long documents and summaries
For broad questions (‘what does this contract say about termination?’), a single passage rarely suffices. A practical pattern is to store section-level summaries as an extra layer: retrieve summaries for broad questions and detailed chunks for specific ones.
Metadata, freshness and permissions per chunk
Chunks are the unit your system stores, filters and cites, so they need more than text.
Minimum metadata per chunk
| Field | Why it matters |
|---|---|
| Document ID and version | Citations, updates and deletion |
| Section path and page | Human-checkable citations |
| Chunk type (text, table, slide, summary) | Different retrieval and display rules |
| Effective and review dates | Prefer current policies; flag outdated ones |
| Access groups or labels | Filter results to what the user is allowed to see |
| Source system and owner | Who to ask when content is wrong |
Chunking and updates are linked
When a document changes, you need to replace all of its chunks reliably, not just add new ones. Stable chunk IDs derived from document and section make this easier. Our article on keeping a RAG knowledge base fresh covers sync, versioning and deletion in detail.
Permissions travel with chunks
If a document is restricted, every chunk from it must carry the same restriction, and the filter must run at query time before results reach the model. Retrofitting this later is far harder than designing it in.
How to choose settings: an evaluation-led process
Chunk size, overlap and strategy are hyperparameters. The only reliable way to choose them is to measure retrieval against real questions.
Step-by-step
- Collect 50 to 150 real questions from the people who will use the system, across document types.
- Label the evidence: for each question, record which document and section contains the answer.
- Build two or three pipelines: for example a fixed-size baseline, a structure-aware variant and a parent-child variant.
- Measure retrieval first: how often the labelled section appears in the top results (recall at k) and how high it ranks.
- Then measure answers: correctness, completeness and whether citations point to the right place.
- Break results down by document type: tables, scanned PDFs and policies often need different settings.
- Record everything: parser version, chunk settings and embedding model, so results are reproducible.
Embedding model choice interacts with chunk size, so test them together. We cover evaluation sets and regression checks for AI features in our article on testing AI features.
An illustrative example
For example, an HR team’s assistant might perform well on policy questions with section-based chunks but poorly on allowance questions because rate tables were flattened. The fix would be a separate table pipeline with header-preserving Markdown and captions, not a bigger model. Only an evaluation broken down by document type would reveal that.
Costs, risks and an implementation checklist
Where effort goes
- Parsing and cleaning usually takes more time than chunking logic itself, especially for scanned and multi-column PDFs.
- Labelling questions needs time from subject-matter experts.
- Re-indexing costs embedding compute every time you change strategy, so keep experiments on a representative subset first.
- Storage grows with overlap, parent-child layers and summaries.
Risks
- Silent regressions when a parser or library update changes how text is split. Pin versions and re-run the evaluation set.
- Over-engineering before measuring. Start with a baseline and add complexity only where results show a gap.
- Permission leaks if chunk-level access metadata is incomplete.
Checklist
- Have we inventoried document types and formats, including scans and tables?
- Does our parser recover headings, reading order and tables?
- Are headers, footers and page numbers removed before chunking?
- Does every chunk carry document, version, section path, page, dates and access groups?
- Are tables kept intact with headers and captions?
- Do we have a labelled question set and retrieval metrics per document type?
- Can we replace all chunks of a changed document reliably?
Frequently asked questions
What chunk size should we use?
There is no universal answer. A few hundred tokens with modest overlap is a common starting point for prose, but structure-aware chunks for sections and separate handling for tables usually beat any fixed size. Choose by measuring retrieval on your own questions.
Do larger context windows make chunking unnecessary?
No. Larger windows let you pass more text, but research such as Lost in the Middle shows models do not use all positions in a long context equally well. Cost and latency also rise with prompt length. Precise retrieval of good chunks still matters.
How should we handle scanned PDFs?
Run OCR with layout analysis first, record quality per page, remove repeated headers and footers, then apply structure-aware chunking. Flag low-quality pages for review rather than indexing noisy text silently.
Can RAG answer questions about numbers in tables?
It can answer lookup questions if tables are kept intact with headers. Questions that require filtering, sorting or arithmetic across many rows are better served by structured data and a query step than by text retrieval.
How often do we need to re-chunk documents?
Whenever a document changes, its chunks should be replaced. You will also re-index the corpus when you change parser, chunking strategy or embedding model, which is why evaluation on a representative subset comes first.
Sources and methodology
Guidance reflects PoliteTech delivery experience. The external references below informed specific points in this article.
- Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (arXiv, 2020) — accessed 9 November 2026. Origin and basic design of retrieval-augmented generation.
- Liu et al., Lost in the Middle: How Language Models Use Long Contexts (arXiv, 2023; TACL) — accessed 9 November 2026. Evidence that models use information in the middle of long contexts less reliably.
- Microsoft Learn: Chunk large documents for vector search solutions in Azure AI Search — accessed 9 November 2026. Embedding input limits, fixed-size starting point with overlap, and overview of chunking approaches.
- Unstructured documentation: Chunking — accessed 9 November 2026. Section-aware by_title chunking and isolation of table elements.
Related reading
Continue your research
Is your knowledge assistant missing answers that are in the documents?
Send us a sample of your documents and ten questions users ask. We will show where parsing and chunking are losing the answer and what to change.
