AI CompendiumA public chart of the language
Retrieval & Memory

Chunking

Splitting documents into retrievable pieces.

Definition

Breaking source material into pieces small enough to retrieve and fit in context. Chunk size and boundaries decide what can be found and how much surrounding meaning survives.

Chunk by meaning, not by character count. Splitting mid-argument produces fragments that retrieve well and answer badly. Overlap and metadata — title, section, date — usually matter more than a clever splitter.

The tension is unavoidable: small chunks retrieve precisely and lose their context, large chunks keep meaning and blur the match. The resolutions that work are contextual prefixes, overlap, or splitting on document structure — headings and sections — rather than on a fixed character count.

How people use it
Debugging bad answers from a document corpus.
"The table was sliced across three chunks. Chunk by heading and keep tables intact."
Worked example

Splitting on structure, not punctuation

A 400-token fixed window cuts tables and procedure steps in half.

Split on headings and keep each procedure intact, then attach the heading path to every chunk. Retrieval quality improves immediately because a chunk that contains a whole instruction is answerable, while half an instruction is a trap.

Sources
Related terms