Data as of Sep 17, 2026 · Based on 354 AI responses from ChatGPT Search and Google AI Mode · See how Parse measures this
To move beyond naive chunking, use frameworks like LangChain or
LlamaIndex for overall RAG flexibility, or integrate specialized tools like
Unstructured.io for complex file layouts. Choose based on whether your bottleneck is general text management or specific parsing challenges like PDFs with tables. For custom algorithm testing, smaller libraries such as offer lightweight, Python-native alternatives to these larger frameworks.
Brands AI recommends here
Named in 80% of answers
Best for general-purpose RAG development needing diverse, pre-built splitters. It offers versatile methods like recursive and semantic splitting, making it a reliable choice for standard text segmentation workflows.
Named in 68% of answers
Best for hierarchical, node-based indexing. It provides advanced developers with high flexibility to build complex data structures, making it ideal if your retrieval needs require granular control over node relationships.
Named in 41% of answers
Named in 27% of answers
Best for parsing complex document formats like PDFs, HTML, or Word docs. It excels at layout-aware extraction, which helps preserve document structure before splitting, critical for maintaining context in RAG.
**Docling, LlamaIndex, and Chonkie** are the top libraries and frameworks for advanced text chunking, moving well beyond naive character or sentence…
Docling, LlamaIndex, and Chonkie are the top libraries and frameworks for advanced text chunking, moving well beyond naive character or sentence splitting.
Transitioning from a naive approach to an advanced strategy requires choosing tools that understand layout, semantics, or hierarchical relationships.
| Tool / Framework | Core Strength | Best Advanced Strategy |
|---|---|---|
| Docling | Deep document layout parsing (PDFs, tables, equations, DOCX) | Layout-aware structural chunking (HybridChunker) |
| LlamaIndex | Data orchestration and node relationship management | Hierarchical / Small-to-Big parent-child chunking |
| Chonkie | Lightweight, lightning-fast dedicated text chunking | Semantic and token-aware sentence/code chunking |
| LangChain | Extensive utility wrappers and standard splitters | Recursive character and embedding-based semantic splitting |
To help narrow down the ideal tool stack, tell me:
If your current RAG chunking is basically **“split every N tokens with overlap,”** I’d look at **LlamaIndex** first. ### My shortlist - **LlamaIndex — best general-purpose choice for advanced chunking.** Its node-parser system supports semantic chunking, hierarchical chunks, sentence/token splitting, Markdown-aware…
If your current RAG chunking is basically “split every N tokens with overlap,” I’d look at LlamaIndex first.
SemanticSplitterNodeParser uses embedding similarity to identify topic boundaries rather than blindly enforcing a fixed size. by_title strategy preserves section boundaries, while its API also supports similarity-based chunking. For a serious RAG system, I wouldn't choose one “magic chunker.” I'd use a hierarchical pipeline:
Document
↓
Structure-aware parsing
↓
Sections / paragraphs / tables / code
↓
Semantic boundary detection
↓
Parent chunks (~1–2k tokens)
↓
Child chunks (~200–500 tokens)
↓
Embeddings + metadata
↓
Hybrid retrieval
↓
Retrieve children → expand to parents
LlamaIndex is particularly well suited to this because its HierarchicalNodeParser creates multiple chunk-size levels and retains parent/child relationships; its AutoMergingRetriever can then expand retrieved children back into more complete parent context.
One important point: don't assume “semantic chunking” automatically beats fixed chunking. It adds embedding computation and introduces another tunable threshold. LlamaIndex itself exposes a breakpoint_percentile_threshold, and Unstructured's similarity chunking similarly requires tuning a similarity threshold.
So my recommendation would be:
LlamaIndex + Unstructured for ingestion → hierarchical/semantic chunks → evaluate against your actual retrieval queries.
If you tell me what your documents look like (PDFs, Markdown, web pages, technical docs, tickets, etc.) and what vector DB you're using, I can sketch a production-grade chunking pipeline and parameters for it.
Moving away from naive character/token splitting is the single best upgrade you can make to a RAG pipeline. Instead of relying on a single mega-framework, the ecosystem has converged around a few standout libraries and specialized strategies depending on your definition of "advanced." The top choices for advanced text…
Moving away from naive character/token splitting is the single best upgrade you can make to a RAG pipeline. Instead of relying on a single mega-framework, the ecosystem has converged around a few standout libraries and specialized strategies depending on your definition of "advanced."
The top choices for advanced text chunking break down as follows:
MarkdownHeaderTextSplitter / HTMLHeaderTextSplitter to respect document outlines.SemanticChunker (embeds sentences and splits where semantic distance spikes past a threshold).#, ## ) and prevents tables from being torn apart. Essential for technical docs, manuals, and financial reports.If you'd like to narrow this down, tell me:
If the problem is specifically **“our RAG chunking is too naive”**, my first choice would be **LlamaIndex** rather than simply swapping in another fixed-size splitter. ### My ranking Option | Best for | Why
If the problem is specifically “our RAG chunking is too naive”, my first choice would be LlamaIndex rather than simply swapping in another fixed-size splitter.
| Option | Best for | Why |
|---|---|---|
| LlamaIndex | Advanced RAG chunking | Semantic + hierarchical chunking, parent/child relationships, metadata |
| LangChain | Flexible/general-purpose pipelines | Excellent collection of structure-aware splitters; easy to customize |
| Unstructured | Messy PDFs/HTML/docs | Excellent document parsing and element-aware partitioning before chunking |
| Custom semantic chunker | Maximum control | Useful when you have a domain-specific notion of a “retrievable unit” |
LlamaIndex has a SemanticSplitterNodeParser that uses embedding similarity between sentences to determine breakpoints, rather than blindly saying “every 500 tokens.” That lets a chunk expand or contract around semantic boundaries.
More interestingly, it supports hierarchical nodes. You can create, for example:
Document
├── 2048-token parent
│ ├── 512-token child
│ │ ├── 128-token child
│ │ └── 128-token child
│ └── 512-token child
└── 2048-token parent
Then retrieval can start with precise small chunks while recovering the larger parent context when appropriate. LlamaIndex explicitly supports this pattern with HierarchicalNodeParser + AutoMergingRetriever.
That's a substantially more sophisticated approach than:
chunk_size=500
chunk_overlap=50
If you're already using LangChain, I wouldn't switch frameworks just for chunking.
Its langchain-text-splitters package has recursive, token-based, Markdown/HTML, JSON, and code-aware splitters. Its RecursiveCharacterTextSplitter is the recommended generic starting point and tries to preserve paragraphs → sentences → words before resorting to smaller units.
It also has language-specific splitting for things like Python, JavaScript, Markdown, HTML, LaTeX, etc., which is particularly useful for code/documentation RAG.
For a serious production RAG system, I'd use a hybrid chunking pipeline, rather than assuming semantic chunking alone is optimal:
Raw document
↓
Structure-aware parsing
↓
Sections / paragraphs / tables / lists / code blocks
↓
Semantic boundary detection
↓
Hierarchical chunks
↓
Metadata enrichment
↓
Embedding + indexing
↓
Small-chunk retrieval
↓
Parent/neighbor expansion
↓
LLM
The important insight is that chunking and retrieval shouldn't be treated as independent problems.
For example, a 150-token chunk might be ideal for finding the answer, but the LLM may need the surrounding 1,500-token section to understand it. Hierarchical retrieval solves that much better than simply increasing chunk_size.
So, if you want one answer: use LlamaIndex's node parsers as your starting point, particularly SemanticSplitterNodeParser + hierarchical nodes. If you're already heavily invested in LangChain, use its structure-aware splitters and build semantic/hierarchical retrieval on top rather than migrating solely for chunking.
If you tell me what kind of documents you're RAG-ing (PDFs, Markdown, legal docs, code, support tickets, etc.) and your current stack, I can recommend a concrete chunking architecture and settings rather than a generic 500-token/50-overlap recipe.
For RAG, the "best" chunking library depends on your document types and how much sophistication you need. If you're moving beyond naive `split every N characters`, I’d shortlist these: ## 1. LlamaIndex — best overall for RAG-native chunking [llamaindex.ai](https://www.llamaindex.ai?utm_source=chatgpt.com)
For RAG, the "best" chunking library depends on your document types and how much sophistication you need. If you're moving beyond naive split every N characters, I’d shortlist these:
Best when: your pipeline is primarily RAG/search over documents.
Strengths:
SentenceSplitter preserves sentence boundaries better than character splitters.SemanticSplitterNodeParser creates chunks based on meaning shifts rather than length.Node abstraction.Example:
from llama_index.core.node_parser import SentenceSplitter
splitter = SentenceSplitter(
chunk_size=512,
chunk_overlap=64
)
nodes = splitter.get_nodes_from_documents(documents)
For most production RAG systems, this is where I would start.
Best when: your inputs are not clean Markdown/text.
It does document-aware chunking, meaning it first identifies structural elements:
Then it combines those elements into chunks instead of blindly cutting text. This avoids common failures like splitting a table from its explanation or mixing unrelated sections.
A common production stack is:
PDF/DOCX/HTML
↓
Unstructured parser
↓
semantic elements
↓
chunking
↓
embeddings
↓
vector DB
Best when: you want something integrated and flexible.
Good options:
RecursiveCharacterTextSplitter (solid baseline)SemanticChunker (embedding-based boundaries)Example:
from langchain_experimental.text_splitter import SemanticChunker
splitter = SemanticChunker(
embeddings=embeddings
)
chunks = splitter.split_documents(docs)
Recursive splitting is still a good default because it preserves hierarchy (paragraph → sentence → character) rather than slicing arbitrarily.
Best when: chunking itself is a first-class component.
It focuses specifically on chunking algorithms:
It can be attractive if you do not want to pull in a full RAG framework.
| Data | Pick |
|---|---|
| Clean text / Markdown | LlamaIndex SentenceSplitter |
| PDFs, contracts, manuals | Unstructured + LlamaIndex |
| Existing LangChain app | LangChain splitters |
| Need maximum chunking control | Chonkie |
| Code repositories | Code-aware chunker + AST parsing |
For a production RAG system, I’d avoid jumping straight to "semantic chunking everywhere." A good architecture is often:
A lot of RAG failures come from losing document structure during chunking, not from the embedding model itself.
If you tell me your corpus type (PDFs, support tickets, code, legal docs, wiki, etc.) and vector DB, I can suggest a more specific chunking pipeline.
**Chonkie** and **LangChain / LlamaIndex** (leveraging specialized text splitters or unstructured partitioning) are the premier frameworks for moving beyond naive fixed-size chunking.[](https://www.buildfastwithai.com/blogs/chonkie-ai-advanced-text-chunking)…
Chonkie and LangChain / LlamaIndex (leveraging specialized text splitters or unstructured partitioning) are the premier frameworks for moving beyond naive fixed-size chunking.
When upgrading from naive character-based splits, the goal is to respect semantic flow, paragraph boundaries, and hierarchical document elements rather than cutting sentences mid-thought.
| Library / Framework | Core Strength | Best Advanced Strategy Offered |
|---|---|---|
| Chonkie | Lightweight, dedicated Python library purpose-built strictly for text chunking. | Semantic Chunking, Semantic Double-Pass Merge (SDPM), Late Chunking. |
| LangChain | Comprehensive ecosystem with rich text-splitting utilities and document loaders. | RecursiveCharacterTextSplitter , Semantic Similarity Chunker. |
| LlamaIndex | Excellent layout-aware parsing and hierarchical node structuring for RAG. | SentenceWindowNodeParser, HierarchicalNodeParser. |
| Unstructured | Heavy-duty document parsing (PDFs, DOCX, tables) before chunking happens. | Element-based partitioning (detecting titles, narrative text, tables). |
If you want to tailor this, tell me:
If your RAG chunking is currently “split every N tokens with overlap,” the biggest improvements usually come from **structure-aware + semantic chunking**, not just swapping chunk sizes. The best library depends on your document types and how much control you need. ## My shortlist ### 1. LlamaIndex — best…
If your RAG chunking is currently “split every N tokens with overlap,” the biggest improvements usually come from structure-aware + semantic chunking, not just swapping chunk sizes. The best library depends on your document types and how much control you need.
LlamaIndex LangChainUse it if your main problem is retrieval quality.
Strengths:
Good fit:
Typical pipeline:
Document
↓
Structure-aware parser
↓
Semantic splitter
↓
Nodes + metadata
↓
Embeddings + vector DB
Sam BesseyIf your corpus is mostly:
then the biggest win may not be chunking itself — it is correct document decomposition.
Unstructured does:
A good pattern:
PDF
↓
Unstructured partitioning
↓
Elements
↓
Semantic grouping into chunks
↓
Vector index
LangChainUseful components:
RecursiveCharacterTextSplitterSemanticChunkerParentDocumentRetrieverThe recursive splitter is a good baseline because it respects separators:
paragraph
↓
sentence
↓
word
↓
character
rather than blindly cutting text.
Poma AIA newer library focused specifically on chunking:
Worth evaluating if you want a dedicated chunking layer rather than a full RAG framework.
| Scenario | Pick |
|---|---|
| General RAG app | LlamaIndex |
| Lots of PDFs and office docs | Unstructured + LlamaIndex |
| Already built on LangChain | LangChain splitters |
| Code repositories | Specialized code chunker + tree parsing |
| Legal/financial docs | Structure-aware parsing + semantic chunking |
| Maximum retrieval quality | Hybrid: structure + semantic + parent-child retrieval |
Instead of:
1000 tokens + 200 overlap
try:
Example:
Parent chunk:
"Chapter 5: Authentication"
Child chunks:
- OAuth flow
- Token expiry
- Refresh tokens
- Error handling
Retrieve children, but provide the parent context to the LLM.
{
"document": "security_manual.pdf",
"section": "OAuth",
"page": 42,
"heading_path": [
"Security",
"Authentication",
"OAuth"
]
}
This often improves retrieval more than changing embedding models.
If I were starting a new RAG system today, I would probably use Unstructured → LlamaIndex semantic/hierarchical chunking → hybrid retrieval → reranker. The chunker is only one piece; the bigger goal is preserving the document’s information architecture so retrieval has meaningful units to find.
{
"document": "security_manual.pdf",
"section": "OAuth",
"page": 42,
"heading_path": [
"Security",
"Authentication",
"OAuth"
]
}
This often improves retrieval more than changing embedding models.
If I were starting a new RAG system today, I would probably use Unstructured → LlamaIndex semantic/hierarchical chunking → hybrid retrieval → reranker. The chunker is only one piece; the bigger goal is preserving the document’s information architecture so retrieval has meaningful units to find.
Moving away from a naive fixed-size chunking strategy is one of the highest-leverage improvements you can make to a RAG pipeline. Moving past basic character counts means adopting frameworks and libraries that handle **semantic boundaries**, **hierarchical document structures** (Markdown, HTML, PDF layouts), or…
Moving away from a naive fixed-size chunking strategy is one of the highest-leverage improvements you can make to a RAG pipeline. Moving past basic character counts means adopting frameworks and libraries that handle semantic boundaries, hierarchical document structures (Markdown, HTML, PDF layouts), or agentic/LLM-based segmentation.
The top libraries and frameworks for advanced text chunking depend on the specific strategy you want to implement:
langchain-text-splitters)RecursiveCharacterTextSplitter : The gold-standard baseline that recursively splits text by natural boundaries (paragraphs, sentences, words) rather than hard character cuts.MarkdownHeaderTextSplitter & HTMLHeaderTextSplitter : Retains document hierarchy by splitting based on headers and injecting those headers as metadata into child chunks.langchain-text-splitters ), and integrates easily into any data ingestion pipeline.SemanticSplitterNodeParser : Groups sentences by embedding similarity, creating variable-length chunks determined by actual semantic shifts rather than token counts.HierarchicalNodeParser : Creates a parent-child relationship where small chunks are retrieved for precise matching, but larger parent chunks are fed to the LLM for broader context.Which Advanced Strategy Should You Pick?
| Strategy | Recommended Library | Best Used For |
|---|---|---|
| Recursive Token/Character | langchain-text-splitters or Chonkie | General text where you want to respect paragraph/sentence bounds. |
| Structure-Aware (Markdown/HTML/PDF) | LangChain (Header Splitters) | Documentation, technical specs, or cleanly parsed knowledge bases. |
| Semantic Chunking | LlamaIndex (SemanticSplitterNodeParser) | Text with frequent topic shifts where fixed sizes bleed concepts together. |
| Parent-Child Hierarchical | LlamaIndex (HierarchicalNodeParser) | Maximizing retrieval precision while retaining broad context. |
To help narrow down the ideal tool, tell me:
Moving away from a naive character-splitter is the single best upgrade you can make to your RAG pipeline. Instead of a single "best" library, the ecosystem relies on a few powerhouse frameworks depending on *how* advanced you want to go (structural, semantic, or layout-aware). The top tools and libraries for advanced…
Moving away from a naive character-splitter is the single best upgrade you can make to your RAG pipeline. Instead of a single "best" library, the ecosystem relies on a few powerhouse frameworks depending on how advanced you want to go (structural, semantic, or layout-aware).
The top tools and libraries for advanced text chunking break down as follows:
RecursiveCharacterTextSplitter (splits hierarchically on paragraphs, sentences, words), MarkdownHeaderTextSplitter and HTMLHeaderTextSplitter (structure-aware), and built-in SemanticChunker which calculates embedding distance changes between sentences to find natural topic shifts.SentenceSplitter and HierarchicalNodeParser.Which strategy should you pick?
SemanticChunker or Chonkie if your data is narrative, dense, or switches topics frequently within the same page.If you share what type of documents you're processing (e.g., messy PDFs, codebases, long-form legal contracts, or Markdown docs) and your current tech stack (LangChain, LlamaIndex, or raw Python), I can recommend the exact implementation strategy and code pattern for your use case.
If your current RAG chunking is basically “split every N characters/tokens with overlap,” I’d look at **LlamaIndex or Unstructured**, depending on what “advanced” means for your corpus. ### My ranking Library | Best for | Why
If your current RAG chunking is basically “split every N characters/tokens with overlap,” I’d look at LlamaIndex or Unstructured, depending on what “advanced” means for your corpus.
| Library | Best for | Why |
|---|---|---|
| docs.llamaindex.ai | Semantic chunking | Its SemanticSplitterNodeParser groups sentences based on embedding similarity rather than arbitrary token boundaries. Developer Documentation |
| docs.unstructured.io | PDFs, docs, HTML, messy enterprise data | Parses documents into structural elements first, then chunks around titles/sections, tables, pages, etc. Its by_title strategy explicitly preserves section boundaries. Unstructured Unstructured |
| docs.langchain.com | Simple, flexible pipelines | Excellent recursive, Markdown, HTML, code, token, and other splitters, but generally more splitting-oriented than semantic/document understanding. Docs by LangChain LangChain Reference |
For a serious RAG system, I wouldn't use semantic chunking everywhere. I'd use a hierarchical strategy:
Document
│
├── Parse structure
│ ├── title
│ ├── section
│ ├── subsection
│ ├── paragraph
│ ├── table
│ └── list
│
├── Create semantic units
│ └── group related paragraphs/sentences
│
├── Enforce token limits
│ └── recursively split oversized units
│
└── Attach rich metadata
├── document
├── section path
├── page
├── chunk position
└── parent/child relationships
For heterogeneous enterprise documents, I'd pick Unstructured as the ingestion/chunking layer and optionally use LlamaIndex's semantic splitter afterward. Unstructured is particularly useful because tables and section boundaries aren't treated like ordinary strings.
For mostly clean Markdown/text where your main problem is semantic boundaries, I'd go straight to LlamaIndex's semantic splitter. It uses embeddings to determine where semantically related sentences should stay together.
One important point: better chunking isn't necessarily smaller chunks. Often the bigger improvement comes from preserving the document's hierarchy and adding context to each chunk—for example:
[Product Manual > Authentication > OAuth > Refresh Tokens]
<actual chunk text>
That gives the embedding/retriever substantially more useful context than blindly chopping the original document every 500 tokens.
If you tell me what kind of documents you're RAG-ing (PDFs, technical docs, support tickets, code, web pages, etc.) and what stack you're using, I can recommend a specific chunking architecture and parameters rather than just a library.