← My notebook

07 · Search

Chunking

Before a document can be searched, it has to be cut into pieces. Where you cut decides what retrieval can ever find.

Too big to use whole

A forty-page policy is too long to embed as one point and too long to send in a prompt. One vector for the whole thing would blur every topic into a single average.

Fixed-size pieces

The document is split into chunks of roughly equal size, measured in tokens. A few hundred tokens is a common starting point: big enough to hold a complete idea, small enough to stay on one topic.

Overlap keeps sentences whole

A hard cut can split a sentence across two chunks so neither makes sense. Overlap fixes that: neighbouring chunks share a few lines, so whatever sits on the boundary appears whole in at least one of them.

What to watch for

Cut on structure where you can: headings, paragraphs, table rows. Keep the source and page with each chunk so answers can cite it. And test retrieval on real questions before tuning sizes by feel.