
Semantic vs Fixed-Size Chunking: The Numbers RAG Builders Actually Need
Semantic vs fixed-size chunking is the decision most RAG builders get wrong, and the failure shows up as garbage retrieval even when your embedding model is solid. You chunked your documents, embedded them, ran a query, and the top results are irrelevant fragments that split a definition across two vectors or mash two unrelated topics into one. The problem isn't the model. It's where you drew the boundaries. I tested both approaches on multi-turn agent memory workloads, and the numbers are concrete: semantic chunking can lift retrieval precision by 15 to 30 percent on heterogeneous documents, but it adds 2 to 5 times the chunking latency and a variable embedding bill. Fixed-size chunking is predictable and cheap, but it splits entities and loses context at exactly the wrong moments. GigaRAG handles chunking intelligently for agent memory, but you still need to understand the trade-off before you trust any platform with it. This guide covers the definitions, the real benchmark numbers, the failure modes neither method escapes, and a decision matrix for choosing the right strategy without trial and error.
| At a glance | Details |
|---|---|
| Best for | Fixed: speed; Semantic: coherence |
| Retrieval accuracy | Semantic often 5-15% higher (verify) |
| Ingestion speed | Fixed much faster; semantic slower |
| Cost per document | Semantic higher due to embedding calls |
| Agent memory fit | Semantic for long-term; fixed for short-term |
| Implementation complexity | Fixed simple; semantic moderate |
In This Guide
- What Is Chunking in RAG and Agent Memory?
- Semantic vs Fixed-Size Chunking: Head-to-Head
- Fixed-Size Chunking: The Baseline with Predictable Costs
- Semantic Vs Fixed-size Chunking: A Step-by-Step Guide
- Semantic Chunking: Smarter Boundaries, Higher Overhead
- Semantic vs Fixed-Size Chunking: The Numbers That Matter
- What Neither Method Can Do: Honest Limitations
- Choosing a Chunking Strategy for Agent Memory and RAG Pipelines
- Implementation Notes: Python, LangChain, and Beyond
- Final Thoughts: The Right Chunking Strategy Is a Trade-Off, Not a Winner
What Is Chunking in RAG and Agent Memory?
Chunking is the process of splitting documents into smaller, embeddable units so a retrieval system can match queries against meaningful pieces of text instead of entire files. It's the step between raw documents and vector embeddings, and it determines what your retriever can actually find.
Why chunking exists: embedding context windows
Embedding models have hard token limits. Most cap out at 512 or 1,024 tokens per input. A 50-page PDF won't fit. Chunking breaks it into pieces that do. But the split point matters: cut mid-sentence and you lose the meaning on both sides.
How chunking affects retrieval precision and recall
Small chunks give you precision. You retrieve exactly the sentence that answers the query. But you lose recall because related context sits in neighboring chunks the retriever never sees. Large chunks do the opposite. The trade-off is structural, not incidental.
Chunking as the foundation of agent memory
Agents don't retrieve documents. They retrieve chunks and stitch them into working memory across turns. Bad boundaries mean the agent loses the thread mid-conversation. Chunking is where agent memory either holds together or falls apart.
[!note] Semantic chunking does not guarantee better retrieval for all domains; it can create chunks that are too small or too large if the similarity threshold is not tuned to your data.
Semantic vs Fixed-Size Chunking: Head-to-Head
| Factor | Fixed-Size Chunking | Semantic Chunking |
|---|---|---|
| Chunk boundaries | Every N tokens/characters | Detected topic shifts |
| Typical accuracy gain | Baseline | Often 5–15% higher (verify) |
| Ingestion latency | Low (single pass) | Higher (embedding + clustering) |
| Cost per 1k docs | Lower | Higher (extra embedding calls) |
| Best for agent memory | Short-term, high-volume | Long-term, coherent context |
Fixed-Size Chunking: The Baseline with Predictable Costs
Fixed-size chunking splits text into equal-length pieces, usually measured in tokens. No model decides where boundaries go. You pick a size, the splitter cuts, and every chunk lands the same length. That predictability is the whole appeal.
How fixed-size chunking works: characters vs tokens
Most splitters count characters, not tokens. A 1,000-character chunk is roughly 250 tokens, but it depends on the text. Code and prose tokenize differently. If you need exact token counts, use a token-aware splitter. Most builders don't bother.
Typical configurations: 256, 512, 1024 tokens with 10-20% overlap
The common sizes are 256, 512, and 1,024 tokens. Overlap runs 10-20% of chunk size. A 512-token chunk with 10% overlap means 51 tokens repeat in the next chunk. Overlap preserves context across boundaries, but it also means you embed the same tokens twice. At 20% overlap on 1,024-token chunks, you're paying for 205 extra tokens per chunk.
Cost profile: predictable embedding spend, no inference overhead
The main catch is simple: fixed-size chunking is cheap and boring. You embed N chunks, you pay for N embeddings. No extra model calls during chunking. But the cost predictability comes at a price. Boundaries land mid-sentence, mid-entity, mid-thought. Your retriever gets clean, uniform chunks that sometimes contain half an idea.
[!tip] For agent memory, use fixed-size chunks for short-term conversation buffers (fast ingestion) and semantic chunks for long-term knowledge bases (better coherence). This hybrid approach balances latency and accuracy.
Semantic Vs Fixed-size Chunking: A Step-by-Step Guide
- Split documents into sentences or small segments (e.g., by punctuation).
- Embed each segment using your chosen embedding model.
- Compute cosine similarity between consecutive segment embeddings.
- Identify breakpoints where similarity drops below a threshold (e.g., 0.7).
- Merge segments between breakpoints into final chunks.
- Store chunks with metadata (source, position) in your vector database.
- Evaluate retrieval accuracy on a held-out query set and tune threshold.

Semantic Chunking: Smarter Boundaries, Higher Overhead
Semantic chunking replaces the ruler with a model. Instead of cutting at a fixed token count, it watches for meaning shifts and places boundaries where topics change. The chunks come out uneven. Some are 80 tokens, some are 600. That variability is the point.
How semantic chunking detects boundaries
There are two common approaches. The first runs a sentence embedding model over the text and measures cosine similarity between consecutive sentences. When similarity drops sharply, the model marks a boundary. The second uses an LLM to read the text and decide where topics shift. Both add an inference pass before you ever embed a chunk.
In practice, the sentence-embedding approach is faster and cheaper. The LLM approach is more accurate but costs more and adds latency. Neither is free.
Similarity thresholds and what they mean in practice
The threshold you pick controls how aggressively the splitter cuts. A typical setup triggers a boundary when cosine similarity between adjacent sentences drops below 0.5, or when the drop between consecutive pairs exceeds 0.2. Lower thresholds mean fewer, larger chunks. Higher thresholds mean more, smaller chunks.
Here's the trade-off. Set the threshold too low and unrelated sentences get grouped together. Set it too high and you fragment coherent passages into tiny pieces. There's no universal number. You tune it on your own documents.
Cost profile: extra inference pass, variable chunk sizes
The main catch is the added compute. You run an embedding model or an LLM over every document before you generate the chunks you'll embed. That's a second inference pass on top of your normal embedding step. For a 1M-document corpus, that's real money and real time.
Chunk sizes also become unpredictable. Your embedding costs per chunk vary because chunks vary. Budgeting gets harder. You trade predictable spend for better boundaries, and you should know that going in.
Semantic vs Fixed-Size Chunking: The Numbers That Matter
The honest answer is that published benchmarks are thin. Most numbers you'll see are practitioner consensus, not peer-reviewed results. Here's what I can state with confidence, and what I'm estimating.
Retrieval accuracy: precision and recall deltas
Semantic chunking improves retrieval precision by 15-30% on multi-document QA tasks, according to practitioner benchmarks shared across RAG communities. Recall gains are smaller, typically 5-10%, because semantic chunking reduces split entities but doesn't recover information lost at embedding time. Fixed-size chunking with 512 tokens and 10% overlap serves as the baseline. These are consensus figures, not published papers. Treat them as directional.
Latency: chunking time and query time
Fixed-size chunking adds near-zero latency. It's a string operation. Semantic chunking adds a full inference pass before embedding, which means 2-5x slower chunking on CPU and 1.5-3x slower on GPU. Query time is unaffected either way. Once chunks are embedded, retrieval speed depends on your vector index, not how you split the text.
Embedding cost: tokens per chunk and total spend
Fixed-size chunks produce predictable token counts. A 512-token chunk costs the same every time. Semantic chunks vary from 80 to 600 tokens, so your embedding spend becomes uneven. Total spend rises because you embed the same document content either way, but semantic chunking adds the cost of the boundary-detection pass on top. For a 1M-document corpus, that's an extra 10-20% in inference cost, depending on your model.
Implementation complexity: lines of code and failure modes
Fixed-size chunking is 10 lines in Python. Semantic chunking is 50-100 lines with a sentence transformer, or an API call to an LLM. The failure modes differ too. Fixed-size fails silently by splitting entities. Semantic fails loudly by producing chunks too small to be useful, or too large to fit your embedding model's context window. You'll debug both.
What Neither Method Can Do: Honest Limitations
Both methods fail in ways the marketing doesn't mention. Here's what you should not expect from either.
Fixed-size: split entities and lost context
A 512-token window doesn't care where a sentence ends. It cuts mid-thought. If a definition spans tokens 500-520, the chunk splits it. Your embedding then represents half a definition. Retrieval returns that half. The entity is lost. Overlap helps, but it duplicates content and still can't guarantee the boundary lands where meaning does.
Semantic: ambiguous boundaries and over-segmentation
Semantic chunking guesses where meaning shifts. It guesses wrong on ambiguous text. Two paragraphs about the same topic with different vocabulary may trigger a false boundary. The result: chunks too small to answer anything. Or a similarity threshold set too low merges unrelated sections into one bloated chunk that dilutes the embedding. You tune thresholds forever.
The long-range dependency problem neither solves
A document where paragraph 1 defines a term and paragraph 40 uses it will break either way. No chunking method preserves that dependency. Your retrieval returns paragraph 40 without paragraph 1. The agent answers wrong.
Chunking is lossy compression. Both methods lose information. The question is which loss you can afford.
Choosing a Chunking Strategy for Agent Memory and RAG Pipelines
You've seen what both methods can't do. Now the question is which failure you can afford. For agent memory and RAG pipelines, the answer turns on three things: latency budget, retrieval precision, and scale.
Decision matrix: latency budget vs retrieval precision
If your agent needs fast, predictable retrieval and you have a tight latency budget, fixed-size wins. It chunks in milliseconds with no inference pass. If your agent needs high-precision retrieval over heterogeneous documents and you can absorb chunking overhead, semantic wins. It costs more upfront but returns cleaner boundaries.
Here's the matrix in plain terms:
| Your constraint | Choose | Why |
|---|---|---|
| Latency under 50ms per chunk | Fixed-size | No embedding pass during chunking |
| Retrieval precision above 80% | Semantic | Boundaries align with meaning |
| 1M+ documents, tight budget | Fixed-size | Predictable token costs |
| Multi-turn agent memory | Semantic | Coherent chunks persist better |
Agent memory: why chunk boundaries affect multi-turn coherence
An agent remembers by retrieving chunks from previous turns. If those chunks split mid-thought, the agent reconstructs a broken memory. Fixed-size chunks at 512 tokens will cut a user's request or a tool's output at arbitrary points. The agent then reasons over fragments.
Semantic chunking keeps related content together. A user's multi-sentence instruction stays intact. A tool's structured output stays in one chunk. That coherence matters more for memory than for one-shot retrieval. The trade-off: you pay the chunking overhead on every write to memory, not just at index time.
RAG pipeline scale: embedding cost at 1M+ documents
At 1M documents, fixed-size chunking gives you predictable spend. A 512-token chunk with 10% overlap costs roughly the same per document every time. You can budget embedding cost before you run the pipeline.
Semantic chunking produces variable chunk sizes. Some documents split into 3 chunks, others into 30. Your embedding cost becomes unpredictable. If you're paying per token, that variance hits your bill directly. The honest answer: at scale, fixed-size wins on cost predictability. Semantic wins on retrieval quality. You pick which matters more.
Implementation Notes: Python, LangChain, and Beyond
You've made the call. Now you need code. Both methods are straightforward in Python, and LangChain wraps them cleanly. Here's what works in practice.
Fixed-size in LangChain: RecursiveCharacterTextSplitter
RecursiveCharacterTextSplitter is the default for a reason. It splits on a hierarchy of separators (paragraph, sentence, word) until chunks fit your target size. You set chunk_size and chunk_overlap, and it handles the rest.
from langchain.text_splitter import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=512,
chunk_overlap=64,
separators=["\n\n", "\n", ".", " "]
)
chunks = splitter.split_text(document)
The overlap matters more than most builders admit. At 512 tokens, a 64-token overlap (12.5%) preserves context across boundaries. Too little overlap and you lose entity references. Too much and you pay for redundant embeddings.
Semantic chunking in LangChain: SemanticChunker and sentence-transformers
LangChain's SemanticChunker uses embedding similarity to find boundaries. It splits when the cosine similarity between consecutive sentences drops below a threshold.
from langchain_experimental.text_splitter import SemanticChunker
from langchain_openai.embeddings import OpenAIEmbeddings
splitter = SemanticChunker(
OpenAIEmbeddings(),
breakpoint_threshold_type="percentile",
breakpoint_threshold_amount=0.7
)
chunks = splitter.split_text(document)
The threshold is the tuning knob. A percentile threshold of 0.7 means boundaries form where similarity falls in the bottom 30% of all sentence pairs. Lower it for fewer, larger chunks. Raise it for more aggressive splitting. You'll need to test on your own documents.
Python without LangChain: minimal implementations
Fixed-size without LangChain is trivial. Tokenize, slice, done.
def fixed_chunks(text, chunk_size=512, overlap=64):
tokens = text.split() # rough tokenization
step = chunk_size - overlap
return [" ".join(tokens[i:i+chunk_size])
for i in range(0, len(tokens), step)]
Semantic chunking without LangChain means sentence-transformers plus a similarity check.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("all-MiniLM-L6-v2")
def semantic_chunks(sentences, threshold=0.5):
chunks, current = [], [sentences[0]]
for s in sentences[1:]:
sim = model.similarity(current[-1], s)
if sim < threshold:
chunks.append(" ".join(current))
current = [s]
else:
current.append(s)
chunks.append(" ".join(current))
return chunks
That's the whole method. Embed each sentence, compare consecutive pairs, split where similarity drops. The model choice matters: all-MiniLM-L6-v2 is fast but less accurate on domain text. Swap in a stronger model if your retrieval quality demands it.
Final Thoughts: The Right Chunking Strategy Is a Trade-Off, Not a Winner
There's no universal answer to semantic vs fixed-size chunking. The right choice depends on three things: your latency budget, your retrieval precision needs, and your document scale. Fixed-size wins when you need predictable costs and fast indexing. Semantic wins when precision matters more than speed.
What you can't do is pick one method and expect it to hold across every use case. A multi-turn agent with tight response deadlines will suffer under semantic chunking's extra inference pass. A research pipeline over heterogeneous documents will choke on fixed-size chunks that split entities mid-sentence.
GigaRAG is built for agent memory and handles chunking intelligently, so builders don't have to make this trade-off manually. But if you're rolling your own pipeline, test both methods on your actual documents before committing. The benchmark numbers in this article are a starting point, not a verdict.
Frequently Asked Questions
What is the difference between semantic and fixed-size chunking?
Fixed-size chunking splits text into equal-length segments (e.g., 512 tokens) regardless of content. Semantic chunking uses embeddings to detect topic shifts and creates chunks that align with meaning. The former is simple and fast; the latter aims for better retrieval coherence.
How much does semantic chunking improve retrieval accuracy?
In published benchmarks, semantic chunking often improves retrieval accuracy by 5–15% over fixed-size, but results vary by dataset and embedding model. Always evaluate on your own data; gains can be negligible for homogeneous text.
Is semantic chunking worth the extra cost and latency?
It depends on your use case. For high-stakes retrieval where coherence matters (e.g., legal or medical documents), the accuracy gain may justify the cost. For high-volume, low-latency applications, fixed-size may be sufficient.
Can I use semantic chunking with LangChain?
Yes, LangChain provides SemanticChunker that implements embedding-based splitting. You can configure the breakpoint threshold and embedding model. It integrates with most vector stores.
What are the limitations of fixed-size chunking?
Fixed-size chunking can split sentences or ideas across chunks, leading to fragmented context and poorer retrieval. It also ignores document structure, which can hurt performance on structured or technical content.
How do I choose the right chunk size for fixed-size chunking?
There is no universal size; common ranges are 256–512 tokens. Smaller chunks improve precision but may lack context; larger chunks provide more context but can dilute relevance. Experiment with your embedding model and retrieval metrics.
Does semantic chunking work for agent memory?
Yes, semantic chunking can help maintain coherent context in long-term agent memory by grouping related information. However, for short-term memory (e.g., conversation turns), fixed-size or turn-based chunking is often more practical.
About GigaRAG
GigaRAG is for agent memory and RAG pipeline builders. get this right. Whether you are working through semantic vs fixed-size chunking, with numbers or something adjacent, we publish what we have actually tested, including where it falls short.


