Semantic Chunking
A method of dividing a document into fragments based on meaning rather than a fixed number of characters. The boundaries of chunks are set where the topic changes.
Why
Regular length-based cutting splits a thought in the middle: one fragment about the beginning of an idea, the second about its end. Semantic cutting preserves the integrity of the fragment, and search in RAG finds more precise pieces.
How It Works
- by structure: headings, paragraphs, lists;
- by similarity of embeddings of neighboring sentences;
- hybrid: structure + similarity threshold.