Glossary/Retrieval & Search

What is Chunking?

Splitting documents into smaller passages before embedding, so retrieval can return the precise section that answers a question rather than a whole page.

Embedding an entire 5,000-word page produces a vector that is an average of many topics — good at matching nothing in particular. Chunking splits documents into retrieval-sized passages so each vector represents one coherent idea.

How you split matters. Naive fixed-size chunks cut sentences in half and orphan content from its heading. Structure-aware chunking follows the document's headings and sections, keeping each chunk self-contained and attributable — which also makes citations point somewhere sensible.

Chunk size is a tradeoff: too small and chunks lack context to be understood; too large and retrieval precision drops. Heading-aware strategies adapt the boundaries to the document instead of forcing one size.

In BeforeQuery

How BeforeQuery uses this

BeforeQuery normalizes every source to markdown (stripping navigation and boilerplate, preserving code blocks), then chunks heading-aware before embedding. Each chunk keeps its document, heading, and URL context — so a citation lands the reader at the right section.

From definition to deployment

Connect a knowledge source and see cited AI answers on your own content in minutes — free, no credit card required.

Get Started Free