---
title: Chunking
description: 'Splitting documents or data into retrieval units that can be indexed, selected, and placed into model context.'
canonical_url: 'https://darkfactory.dev/glossary/chunking'
markdown_url: 'https://darkfactory.dev/glossary/chunking.md'
collection: glossary
date_published: '2026-08-03T00:00:00-04:00'
date_modified: '2026-08-26T00:00:00-04:00'
---

# Chunking


## Definition

Chunking splits documents or other data into retrieval units that can be indexed, ranked, selected, and placed into model context. A chunk might be a fixed token range, paragraph, section, code symbol, table, transcript turn, or node in a document hierarchy.

The boundary choice changes what retrieval can recover. Small chunks can match a narrow question precisely but lose definitions, exceptions, or relationships outside the boundary. Large chunks preserve more local context but can dilute the matching signal, consume more context, and return irrelevant material. Overlap can preserve text near a boundary, though it also duplicates storage and may cause repeated passages to crowd a result set.

Useful strategies include fixed-size windows, structure-aware splitting, semantic boundaries, parent-child chunks, and late or query-time grouping. No chunk size is universally best. The right unit depends on document structure, question type, embedding model, ranking method, context budget, and whether answers require relationships across sections.

## Preserve the route back to the source

A chunk is a retrieval projection, not the canonical document. Store a stable source identifier, offsets or structural path, version, and surrounding hierarchy. This makes it possible to show citations, retrieve neighboring material, rebuild the index, and detect when a chunk has become stale.

## Distinguish it from nearby terms

- **Tokenization** converts input into the units a model processes. Chunking groups larger spans for storage and retrieval.
- **Segmentation** is a broader name for dividing data into meaningful units. Chunking is usually tied to retrieval or context assembly.
- **Compaction** summarizes or removes existing context. Chunking decides how source material enters an index.
- A **context window** limits what can be sent to a model. A chunk should be designed for retrieval quality, not merely sized to fill the remaining window.

## Operational significance

Evaluate chunks through end-to-end questions, not visual preference. Measure whether retrieval finds the supporting passage, whether the returned unit contains enough evidence, how often neighboring chunks are required, and how answer quality changes with size and overlap. Test headings, tables, lists, code, and very short or long sections separately because naive splitters often damage them.

## Check your understanding

A policy exception appears in the paragraph after the rule it modifies. If the splitter separates them without a parent link or overlap, retrieval may return a confident rule with its exception missing.

## Related factory areas

- [Context, memory, knowledge & skills](https://darkfactory.dev/factory/context-memory-skills)

## Evidence and further reading

- [Google Machine Learning Glossary](https://developers.google.com/machine-learning/glossary/)
- [Microsoft GraphRAG Documentation](https://microsoft.github.io/graphrag/)
