New Tool Radar

AI Concepts

How to Chunk Documents by Section Instead of Fixed Token Windows

Split on document structure when headings carry meaning, keep fixed-size chunking as the starting point, and measure both on your own questions.

Schematic with three steps: Build two indexes, one per method; Run the same test questions on both; Pick the winner and check why it.

Fixed-size chunking cuts text every N tokens no matter what the text means, while content-aware chunking follows the document structure, splitting on headings, sections and paragraphs so each chunk keeps its context. Structure-aware chunking sounds better, but it is not always better: in one published benchmark of 156 queries, naive chunking scored 70.5% hit rate against 63.8% for context-aware chunking. Measure both on your own documents before choosing.

What you need

  • Documents with real structure, such as headings and sections
  • A labelled set of test questions with known correct documents
  • A chunking method that can split on structure, for example a recursive splitter

Step 1: Build two indexes, one per method

Build one index with fixed-size chunks and one with section-based chunks, using the same embedding model and the same chunk size target. Changing the model at the same time would hide which change mattered.

Step 2: Run the same test questions on both

Run every test question against both indexes and record the hit rate: how often the correct document appears in the top results. Use the same top-k for both.

Step 3: Pick the winner and check why it won

Choose the method with the higher hit rate, then look at the questions where it lost. If section chunking loses on questions whose answers span two sections, the structure itself is splitting related content, and fixed-size chunking with overlap may serve you better.

Worked example: synthetic chunking comparison on 4 questions

The table below is a synthetic example. It shows the expected result of comparing chunking methods; no index was built.

Question Fixed-size hit Section hit
Refund window Yes Yes
Setup steps Yes No
Pricing tiers No Yes
Support hours Yes Yes

Expected result (UNTESTED). each method wins on 3 of 4 questions, so the choice depends on which questions matter most. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Section chunking needs real structure; on flat text with no headings it behaves like fixed-size chunking.
  • A section chunk can be much longer than a fixed chunk, which can dilute the embedding and raise cost.
  • Pinecone recommends starting with fixed-size chunking and iterating only after it proves insufficient.
  • The published benchmark result above is specific to scientific documents in three languages; your documents may behave differently.

Sources

See all