Glossary

Semantic chunking

Splitting text into chunks where the meaning shifts, found by comparing embeddings of neighbouring sentences.

Semantic chunking is a way of splitting documents for retrieval augmented generation that places chunk boundaries where the meaning changes, rather than at a fixed character or token count. It embeds each sentence, measures how far apart neighbouring sentences are in meaning, and starts a new chunk where that distance jumps. The aim is for each chunk to hold one idea, so its embedding represents that idea cleanly and the retriever can match it to a question.

How semantic chunking works

Most implementations follow the same four steps. The text is split into sentences, usually with a regular expression on full stops, question marks and exclamation marks. Each sentence is grouped with one or more neighbours, called a buffer, to smooth out very short sentences, and each group is turned into a vector by an embedding model. The splitter then computes the cosine similarity between each pair of adjacent groups and treats low similarity as a candidate boundary. Finally it picks a threshold and cuts wherever the distance between neighbours exceeds it.

LangChain’s SemanticChunker, in its experimental package, works this way with a buffer of one sentence on each side by default. LlamaIndex has an equivalent semantic splitter node parser. The technique spread through RAG tutorials in early 2024 as the next step up from character-based chunking.

Choosing a breakpoint threshold

Threshold type

Where it cuts

LangChain default

Percentile

Distances above the Nth percentile of all distances in the document

95th percentile

Standard deviation

Distances more than N standard deviations above the mean

3

Interquartile

Distances above the mean plus N times the interquartile range

1.5

Gradient

Points where the distance changes fastest, useful for text on one dense topic

95th percentile of the gradient

Because the threshold is relative to the document, a percentile setting produces roughly the same share of boundaries in every file, whether it covers one topic or ten. Most libraries also accept a target number of chunks or a minimum chunk size. Teams usually add a maximum size as well, so a long uniform section does not become a single chunk too large for the model’s context window.

Semantic chunking vs recursive and fixed-size splitting

Recursive chunking splits on paragraph breaks, then line breaks, then spaces, until pieces fit a size limit. It is cheap, predictable and the default in most frameworks. Semantic chunking costs an embedding call per sentence group at indexing time, produces chunks of uneven length and depends on the quality of the embedding model. In exchange, boundaries tend to fall between topics in documents with weak formatting, such as transcripts or long web pages. Fixed size vs semantic chunking and semantic vs recursive chunking compare the trade-offs in more detail.

Published comparisons are mixed. A 2024 study by researchers at Vectara found that the gains of semantic chunking over fixed-size chunking were small and inconsistent across retrieval tasks, and did not justify the extra computation on most of them. Results depend heavily on the corpus, so it is worth testing on your own documents with recall@k and a small set of real questions, as described in retrieval evaluation.

Limits of semantic chunking

Each chunk is still embedded on its own, so a chunk that says “it raised prices in March” loses the company it refers to. Chunk overlap, contextual retrieval and late chunking address that problem from different directions. Sentence splitting also struggles with tables, code and lists, which usually need layout analysis or a structure-aware text splitter first. And when the embedding model changes, the boundaries move, so the whole corpus needs re-indexing to avoid embedding drift.

Semantic chunking and Exabase

Deep Search indexes content stored as Resources when it is written, with no chunking logic to build or tune, and returns the passage that matches a query along with its page number or timestamp. Exabase does not publish which splitting method it uses internally or offer a semantic chunking setting. If you run your own splitter, Extract returns a document’s text as ordered chunks with page numbers through the chunks endpoint, and the PDF to chunks tool does the same for a single file.

Chunking is a workaround, not a design makes the case for retrieving passages instead of tuning chunk boundaries, RAG accuracy explains sub-document retrieval, and Exabase vs LlamaIndex compares a managed search layer with assembling your own pipeline. The RAG pipelines use case shows how the parts fit together.

FAQs

What is semantic chunking?

Semantic chunking splits text into chunks at points where the topic changes. It finds those points by embedding sentences and cutting where neighbouring sentences are least similar.

How is semantic chunking different from recursive chunking?

Recursive chunking cuts on formatting characters such as paragraph breaks until pieces fit a size limit. Semantic chunking cuts on changes in meaning measured with embeddings, so it costs more to run and produces chunks of uneven size.

Is semantic chunking better for RAG?

Sometimes. It helps most on long, loosely formatted text such as transcripts, and published tests show small or no gains on well-structured documents. Test it against a recursive baseline on your own questions.

What threshold should I use for semantic chunking?

Start with the 95th percentile of sentence distances, the LangChain default, and set a maximum chunk size. Lower the percentile for more, smaller chunks and raise it for fewer, larger ones.

Does semantic chunking need an embedding model?

Yes. It embeds every sentence group during indexing, which adds cost and time before the finished chunks are embedded again for search.

Does Exabase use semantic chunking?

Exabase does not document the splitting method behind Deep Search. It indexes stored content automatically and returns matching passages with page numbers or timestamps, so there are no chunk boundaries to configure.

Related pages: Chunking, Recursive chunking, Late chunking, Chunk overlap, Text splitter, Fixed size vs semantic chunking, Semantic vs recursive chunking, Contextual embeddings, Deep Search, RAG accuracy.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.