RAG foundations · about 20 minutes of study

Chunking

Chunking divides documents into retrievable units. Useful boundaries preserve enough context for an answer without filling the prompt with unrelated text.

Before you start: Review Document parsing first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Structure

Find headings, paragraphs and tables.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

Cutting a textbook into study cards works when a definition stays with its example. Cutting halfway through the definition can make both cards misleading.

See a concrete example

For 2,000 tokens, size 500 and overlap 100 give a stride of 400 and roughly five chunks, depending on the final boundary policy. Larger overlap increases storage and duplicate retrieval.

A claim to question

There is no universally best chunk size or overlap percentage.

Try before revealing the answer

Design a comparison of 256, 512 and 1,024-token chunks with and without overlap.

Show the worked answer

Hold documents, queries and embedding model fixed. Compare recall@k, answer correctness, duplicated context, latency and cost on a held-out set; inspect boundary failures.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Retrieval-Augmented Generation

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.