RAG Chunking Strategies: A Decision Table for PDFs, Documentation, and Tables
RAGdocument processingchunkingretrieval qualityembeddings

RAG Chunking Strategies: A Decision Table for PDFs, Documentation, and Tables

SSmart Labs Editorial Team
2026-12-05
7 min read

Compare RAG chunking strategies for PDFs, documentation, and tables, with practical configuration templates and a retrieval testing checklist.

RAG Chunking Strategies: A Decision Table for PDFs, Documentation, and Tables

Choosing a chunking method is a retrieval design decision, not just a text-splitting setting. This guide compares fixed-size, recursive, heading-based, semantic, and table-aware approaches, then gives you a practical checklist for preserving context, testing chunk size and overlap, and diagnosing weak answers in a RAG application.

Overview

In retrieval-augmented generation (RAG), a document is usually divided into smaller passages before those passages are embedded and stored in a vector index. When a user asks a question, the system retrieves some of those passages and provides them to a language model as context. If the chunks are too large, retrieval may return several unrelated topics together. If they are too small, important definitions, headings, exceptions, or table labels may be separated from the text that gives them meaning.

There is no universal best chunk size for RAG. The right configuration depends on document structure, tokenizer behavior, embedding model, query style, metadata, and the amount of context your generation step can accept. Treat chunking as an experiment with measurable retrieval outcomes rather than a permanent default.

A useful starting principle is to preserve the smallest unit that can answer a realistic question without relying on missing neighboring text. For a policy document, that may be a complete subsection. For API documentation, it may be one endpoint and its parameters. For a table, it may be a group of rows that still includes the table title and column headers.

Document typeRecommended starting strategyWhat to preserveMain risk
Plain prose or mixed textRecursive chunkingParagraphs, sentence boundaries, and nearby headingsSplitting a concept across boundaries
Structured manuals and documentationHeading-based with a size limitHeading path, section identity, code examples, and linksSections that are too large for focused retrieval
PDFs with reliable layoutLayout-aware or heading-based chunkingPage number, heading, reading order, footnotes, and listsParser errors or columns merged in the wrong order
Long, repetitive, or irregular proseSemantic chunking, validated against a simpler baselineTopic continuity and document metadataInconsistent chunk sizes and higher processing cost
Financial, operational, or comparison tablesTable-aware chunkingTitle, headers, units, row labels, and source pageRows become meaningless without their headers

Checklist by scenario

PDF chunking for RAG

  1. Inspect extraction before splitting. Confirm that the parser preserves reading order, paragraphs, lists, page numbers, and text from multi-column layouts. A sophisticated splitter cannot repair text that was extracted incorrectly.
  2. Attach page metadata. Store the source filename, page number, section heading, and document version with every chunk. This supports citations, debugging, and targeted re-indexing.
  3. Keep visual relationships where possible. Captions, bullet labels, footnotes, and nearby explanatory paragraphs may be necessary to interpret a figure or table.
  4. Use overlap selectively. A modest overlap can protect definitions that cross a boundary, but excessive overlap creates duplicate retrieval results and consumes context.

Product and developer documentation

Start with heading-based chunks, then apply a maximum token or character limit to unusually long sections. Include the full heading path in each chunk, such as Authentication > OAuth > Refresh tokens. This gives both the embedding model and the language model useful context even when the body text is retrieved without its parent section.

Keep code blocks intact whenever they represent a runnable example. If a code block is too large, split it at logical boundaries and attach the language, file name, function or endpoint name, and surrounding explanation as metadata. Avoid splitting a function in the middle of a parameter declaration unless testing shows that smaller fragments improve retrieval.

Tables and tabular content

Tables need special handling because a cell often depends on a header several lines away. A practical representation repeats the table title and headers in each row group:

Table: Support response targets
Columns: Priority | Initial response | Resolution target
Rows:
- Critical | 30 minutes | 4 hours
- High | 2 hours | 1 business day
Source: Operations handbook, page 12

For wide tables, split by related column groups or row ranges rather than treating every cell as an independent passage. Preserve units, date ranges, currency or measurement labels, and notes that qualify the values. If users ask for calculations or comparisons, consider storing a structured representation alongside the text chunks.

Semantic chunking versus recursive chunking

Recursive chunking is predictable and usually provides a strong baseline: it attempts larger separators such as headings or paragraphs before falling back to sentences or smaller separators. Semantic chunking instead uses changes in meaning or embedding similarity to identify topic boundaries. It can help when paragraphs do not align with topics, but it may produce uneven chunks and requires more validation.

Use semantic chunking when a baseline leaves many questions split across unrelated passages or when the source has long, loosely structured sections. Keep recursive chunking as a comparison point. A more complex method is useful only if it improves retrieval for your actual evaluation questions.

Reusable starting configurations

The following templates are starting points, not universal prescriptions. Express limits in tokens when your library and model support token-aware splitting; character counts can vary substantially by language and content type.

prose:
  strategy: recursive
  target_size: test a small, medium, and large setting
  overlap: test a low-overlap baseline first
  separators: [heading, paragraph, sentence]
  metadata: [source, page, section_path, version]

documentation:
  strategy: heading_then_recursive
  preserve: [heading_path, code_blocks, lists, links]
  max_size: enforce a limit for very long sections

table:
  strategy: table_aware
  repeat_context: [table_title, column_headers, units]
  preserve: [row_labels, notes, source_page]
  overlap: avoid duplicating complete row groups unnecessarily

What to double-check

Before changing chunking in production, create a small evaluation set of representative questions. Include direct lookups, questions requiring two nearby facts, questions about exceptions, table comparisons, and questions whose answer should not be found in the corpus. Record the expected source passage or source page for each question.

  1. Boundary quality: Read random chunks without opening the original document. Can a reviewer identify the topic, subject, and relevant qualifiers?
  2. Retrieval recall: For each question, does the correct passage appear in the top results? Test more than one retrieval depth because a configuration can perform differently at top three and top ten.
  3. Context precision: Are the returned chunks relevant, or are duplicates and neighboring but unrelated sections filling the context window?
  4. Metadata integrity: Do page references, section paths, document versions, and source identifiers survive parsing and indexing?
  5. Generation behavior: Does the model answer accurately when the needed evidence is retrieved? Separate retrieval failures from prompt or generation failures.
  6. Format coverage: Test scanned PDFs, multi-column PDFs, long headings, nested lists, code blocks, footnotes, and tables if those formats occur in your corpus.

Log chunk size, overlap, parser version, embedding model, retrieval settings, and evaluation results together. This makes comparisons reproducible when a document parser, tokenizer, or embedding model changes. For production monitoring, pair retrieval checks with the broader review practices described in LLM observability metrics.

Common mistakes

  • Copying a default without testing it. Defaults are convenient, but document formats and question patterns differ.
  • Using character counts as if they were tokens. Character length is only a rough proxy and varies across languages, symbols, and code.
  • Removing headings during cleaning. Headings often provide the semantic label that makes a passage retrievable.
  • Splitting tables into raw rows. A value without its column header, unit, or row label may be unusable.
  • Overlapping everything heavily. More overlap can increase duplication without solving a poor boundary.
  • Ignoring document versions and deletions. Stale chunks can produce confident answers from content that should no longer be available. Review the workflow in RAG index maintenance.
  • Changing several variables at once. Keep the embedding model, retrieval method, and evaluation set stable while comparing chunking strategies where possible.

When to revisit

Revisit your chunking configuration whenever the underlying inputs change: when you add a new document format, replace a parser, change an embedding model, alter the retrieval depth, or observe answers that omit necessary context. It is also sensible to review the configuration before major planning or reporting cycles if the indexed material is updated regularly.

Use this short review sequence:

  1. Sample recently ingested documents and inspect extracted text, headings, tables, code, and page references.
  2. Run the evaluation questions against the current index and save retrieval results.
  3. Compare one simpler baseline with the proposed strategy, changing only the variables needed for a fair test.
  4. Review failures by category: parser error, boundary error, missing metadata, retrieval ranking, or generation.
  5. Update the configuration, document the reason, and retain the evaluation results for the next comparison.

Finally, treat chunking as part of the application contract. Keep the splitter settings, parser assumptions, metadata schema, and test questions under version control. A repeatable evaluation workflow, such as the one outlined in prompt testing framework guidance, can also be adapted for retrieval experiments. The best RAG chunking strategy is the one that consistently preserves the evidence your users need, in a format your system can retrieve and your model can interpret.

Related Topics

#RAG#document processing#chunking#retrieval quality#embeddings
S

Smart Labs Editorial Team

AI Development Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.