What is chunking?

Chunking is splitting a long document into smaller passages, or chunks, before indexing it for search or retrieval-augmented generation. Each chunk is embedded and retrieved on its own, so chunk size is a trade-off: too small and a passage loses its context, too large and it mixes topics and wastes the model’s context window.

Good chunkers follow the document’s structure, such as sections and paragraphs, instead of cutting at a fixed number of characters.

Keeping each chunk’s page and position lets an answer cite exactly where its text came from.

Read next

The whole glossary →

Help PaperLab reach the next researcher

PaperLab is free, open source and built by one person. A star helps other researchers find it and puts each new release in your GitHub feed. The PaperLab page on LinkedIn posts a weekly breakdown of how one feature works.