Overlap Strategies
You'll learn how to add overlap between adjacent chunks to preserve context across boundaries and prevent critical information from being split.
The Problem with Hard Boundaries
When you split a document into chunks, you create artificial boundaries. Imagine cutting a newspaper article exactly in half—you might split a sentence describing how "The CEO announced..." in one chunk and "...a major restructuring plan" in the next. Neither chunk alone tells the complete story.
In RAG systems, if a user's query matches concepts that straddle a boundary, the retrieved chunk might lack crucial context.
What Overlap Does
Overlap means duplicating some content between adjacent chunks. If your chunks are 500 tokens each, you might overlap the last 50 tokens of chunk A with the first 50 tokens of chunk B.
Analogy: Overlapping Shingles
Think of roof shingles—they overlap so water can't slip through the gaps. Similarly, overlapping chunks ensure ideas that span boundaries appear completely in at least one chunk.
Typical Overlap Sizes
- 10-20% overlap is common (e.g., 50-100 tokens for 500-token chunks)
- Too little: risks losing context
- Too much: wastes storage and retrieval time, increases redundancy
When to Use More Overlap
- Dense, technical content where every sentence connects to the next
- Narrative documents where pronouns reference earlier entities
- When chunk size is small (less room for self-contained context)
Key Takeaway: Overlapping chunks by 10-20% acts as a safety buffer, ensuring contextually complete information reaches your LLM even when the relevant content sits near chunk boundaries.