Generative AI · Intermediate level

Intermediate level · Module 7: Document Processing and Chunking · Lesson 2 of 3

Chunking Strategies

Learners split documents by fixed size, by structure (headings and sections) and by meaning, with overlap, and measure the effect on retrieval.

In this lesson you will

  • Implement several chunking strategies
  • Choose a chunking strategy using retrieval results

Key concepts

chunk sizeoverlapstructure-based chunkingsemantic chunkingchunk metadata

The lesson

Chunks that are too small lose context; chunks that are too large dilute relevance and use many tokens. A few hundred tokens with some overlap is a common starting point.

Splitting by headings and sections keeps related information together and gives meaningful citations (document, section). Semantic chunking splits where the topic changes.

Choose by measuring: run the retrieval test questions with each strategy and compare how often the right chunk is in the top results.

Step by step

  1. Implement fixed-size, heading-based and overlapping chunking.
  2. Index the collection three times.
  3. Run 20 retrieval test questions on each.
  4. Choose a strategy using the hit rates.

Practice activity

Compare three chunking strategies on the project collection.

Expected result: A measured comparison and a justified choice.

Check your understanding

  1. What is the problem with very large chunks?

    Show answer

    They dilute relevance and use many tokens.

  2. Why is heading-based chunking useful for citations?

    Show answer

    Each chunk maps to a meaningful section of a document.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.