Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-0601

Chunk along the document's own structure before tuning chunk size

Evidence type
practitioner heuristic
Difficulty
easy
Roles
Applied AI, ML engineer
Industries
aviation, insurance

Summary: situation, action, reason, boundary

  1. Situation

    You are ingesting manuals, policies or contracts that have headings, numbered clauses or tables into a RAG index.

  2. Action

    Split first on structural boundaries (section, clause, table, list item), keep the heading path with each chunk, and only then cap length with a size limit and small overlap.

  3. Reason

    A chunk is the unit of evidence the model sees. If the unit is cut mid-rule, no retriever or prompt can restore the missing condition.

  4. Boundary

    Structured, authored documents: fare conditions, insurance wordings, runbooks, API docs.

Symptom or risk

Fixed-size token windows cut a fare rule from its exception, or a table from its header row, so retrieved chunks are fluent but incomplete.

Exceptions

Unstructured text such as chat logs or OCR output with no reliable headings; there, fixed windows with overlap are a reasonable default.

Trade-offs

Structural chunks vary widely in length, so some exceed the embedding model's input limit and must be sub-split.

Pitfalls

Trusting the parser: PDF extraction often flattens tables and drops headings, so inspect a sample of chunks before indexing everything.

Lessons and concepts