Building & Running AI intermediate

Chunking

Splitting documents into passages small enough to embed and retrieve usefully.

Chunking is the least glamorous and most consequential step in a RAG pipeline. Chunks that are too large dilute the embedding and waste context; too small and they lose the meaning that made them relevant. Splitting on structure — headings, sections — beats splitting on character count.

In practice: Cutting a contract mid-clause, so retrieval returns half a sentence that means nothing.