Advanced text chunking libraries
Brands AI mentions
Also mentioned rarely: Haystack (deepset), LlamaIndex Connectors, Deepset, Marker, LlamaParse, semantic-text-splitter, Ragas, Anthropic, semchunk, LangChain LangGraph, Haystack, DeepEval, NVIDIA NeMo Data Designer, BEIR, NVIDIA, Docugami, Milvus
- LangChainChatGPTChatGPT 100%Google AI ModeGoogle AI Mode 100%
- UnstructuredChatGPTChatGPT 100%Google AI ModeGoogle AI Mode 100%
- LlamaIndexChatGPTChatGPT 67%Google AI ModeGoogle AI Mode 100%
- ChonkieChatGPTChatGPT 100%Google AI ModeGoogle AI Mode 50%
- DoclingChatGPTChatGPT 83%Google AI ModeGoogle AI Mode 50%
Questions and answers
ChatGPTNov 21, 2026
Top-rated text chunking tools and frameworks for RAG (2026)
For sophisticated Retrieval-Augmented Generation (RAG) systems, I would shortlist Chonkie, LlamaIndex, LangChain, Docling, and Unstructured.
The important distinction is that some tools specialize in chunking algorithms, while others provide complete document-ingestion pipelines. If you're implementing advanced strategies such as semantic, hierarchical, contextual, late, or structure-aware chunking, that distinction matters.
My recommendation is to consider Chonkie and LlamaIndex first for advanced chunking, and Docling if your corpus contains complex PDFs, tables, and Office documents.
1. Top tools compared
Tool Best capability Advanced chunking Chonkie Dedicated chunking library Excellent LlamaIndex Sophisticated RAG ingestion Excellent LangChain Flexible splitting ecosystem Very good Docling Structure-aware document chunking Excellent Unstructured Document-aware preprocessing Very good Haystack Modular production pipelines Very good These are capability-based recommendations, not a universal benchmark ranking. A recent November 2026 comparison independently identifies the same six libraries as leading options for RAG chunking.
2. Detailed evaluation
1. Chonkie
(Best dedicated chunking library)
Open source · Python · MIT
GitHub: approximately 4.8k stars in the retrieved snapshot.
Chonkie is particularly interesting because it focuses on chunking rather than trying to be an entire RAG framework.
Supported approaches include:
- Token-based chunking.
- Sentence-based chunking.
- Recursive chunking.
- Semantic chunking.
- Late chunking.
- Neural and LLM-driven chunking.
- Code and table chunking.
Why I recommend it: You can experiment with several chunking strategies independently of your embedding model, vector database, and orchestration framework.
Source:
2. LlamaIndex
(Best for sophisticated RAG architectures)
Open source · Python and TypeScript
LlamaIndex provides a rich node parsing and document-ingestion ecosystem.
Particularly useful capabilities:
SentenceSplitter: preserves sentence boundaries.SemanticSplitterNodeParser: identifies semantic boundaries using embeddings.HierarchicalNodeParser: creates multiple levels of document granularity.- Markdown and HTML-aware parsing.
- Parent-child relationships between chunks.
- Metadata extraction and propagation.
Why I recommend it: Its hierarchical node architecture is particularly useful for systems that need both precise retrieval and broader contextual information.
For example, retrieve a small paragraph but provide the parent section to the LLM for additional context.
Source:
3. LangChain
(Best for integration flexibility)
Open source · Python and JavaScript/TypeScript
LangChain's text-splitting ecosystem is mature and widely used.
Useful splitters include:
RecursiveCharacterTextSplitterTokenTextSplitterMarkdownHeaderTextSplitterHTMLHeaderTextSplitter- Language-specific code splitters.
- Semantic chunking integrations.
Why I recommend it: It is a good choice when chunking is one component of a larger system involving multiple retrievers, rerankers, agents, and vector databases.
Its recursive splitter is a sensible baseline because it tries to preserve paragraphs and sentences before splitting into smaller units.
Source:
4. Docling
(Best for complex documents)
Open source · Python · MIT
Docling's HybridChunker is particularly useful for sophisticated document processing.
Features include:
- Document hierarchy preservation.
- Layout-aware parsing.
- Token-aware chunk sizing.
- Table and heading preservation.
- Combining smaller document elements into appropriately sized chunks.
Why I recommend it: Traditional text splitting can destroy the relationships between headings, paragraphs, tables, and captions. Docling helps preserve these relationships before indexing.
Source:
5. Unstructured
(Best for heterogeneous data)
Open source · Python · Apache 2.0
Unstructured is primarily a document ingestion and preprocessing framework.
Its chunking capabilities include:
- Basic chunking.
- By-title chunking.
- Element-based chunking.
- Preservation of document metadata.
- Handling of PDFs, DOCX, HTML, and other document formats.
Why I recommend it: Particularly useful when documents originate from many sources and need to be converted into structured elements before chunking.
Source:
6. Haystack
(Best for modular production pipelines)
Open source · Python · Apache 2.0
Haystack offers modular indexing and retrieval pipelines.
Useful capabilities:
- Document preprocessing.
- Recursive splitting.
- Metadata-aware processing.
- Integration with specialized chunkers.
- Explicit, inspectable indexing pipelines.
Why I recommend it: It is attractive for production RAG systems where ingestion, retrieval, and evaluation need to be independently configurable.
Source:
3. Advanced chunking strategies worth implementing
Choosing a framework is only half the decision. These are the strategies I'd investigate for a sophisticated RAG architecture.
Strategy How it works Best application Semantic chunking Splits when semantic similarity changes Long-form documents Hierarchical chunking Creates parent, child, and sometimes grandchild chunks Complex questions Late chunking Embeds larger context before pooling token representations into chunks Context-sensitive retrieval Contextual chunking Adds document and section context to individual chunks Fragmented documents Structure-aware chunking Respects headings, tables, paragraphs, and document layout PDFs and technical documents Agentic chunking Uses an LLM to decide meaningful boundaries Highly unstructured documents Sliding-window chunking Uses overlapping windows Continuous narratives and logs A few particularly interesting approaches:
A. Hierarchical retrieval (small-to-big)
Parent document
Technical documentation: Database architecture
Each child can be split into smaller retrieval units.
Retrieved leaf chunks
Precise matches returned to the retrieval system
The retriever searches smaller chunks, then retrieves their parent context for generation. This balances precision and context.
B. Semantic chunking
Instead of splitting every 500 tokens, calculate similarity between adjacent sentences or groups of sentences. Create a boundary when semantic similarity drops sufficiently.
This helps prevent unrelated topics from appearing in the same chunk.
C. Contextual chunking
Attach contextual information to each chunk, for example:
- Document title.
- Section heading.
- Parent section summary.
- Relevant entity names.
- Document type and source.
This helps chunks remain meaningful even when retrieved independently.
D. Late chunking
An especially interesting technique: encode a larger document first, then pool token-level embeddings into chunk embeddings.
This allows individual chunk embeddings to retain information from their surrounding document context. It requires an embedding model that exposes suitable token-level representations.
4. My recommended architecture for sophisticated RAG
If I were building a production-grade RAG system today, I'd combine specialized tools rather than rely on one framework.
Recommended ingestion architecture
1. Document ingestion
PDF, DOCX, HTML, Markdown, databases
Docling / Unstructured
2. Structure extraction
Headings, tables, metadata, document hierarchy
3. Advanced chunking
Chonkie / LlamaIndex
Semantic + hierarchical + contextual chunking
4. Embedding generation
Dense embeddings, optionally late chunking
5. Vector and hybrid indexing
Vector database + keyword index + metadata
6. Retrieval and reranking
Hybrid retrieval + parent-child retrieval + reranking
7. LLM generation
Context assembly, citations, grounded responses
For orchestration, I'd choose LlamaIndex or LangChain depending on the existing application architecture.
5. How to evaluate chunking quality
Don't select a chunking framework solely by GitHub stars or implementation convenience.
I'd benchmark the following:
Metric What it measures Recall@K Whether relevant chunks are retrieved Precision@K Whether retrieved chunks are relevant MRR How highly the first relevant result ranks Context precision How much retrieved context is useful Context recall Whether retrieved context covers the answer Faithfulness Whether generated answers are grounded Indexing latency Cost of creating chunks and embeddings Retrieval latency Cost of finding relevant chunks I'd also compare multiple chunk sizes rather than assume one is optimal. A reasonable experimental starting point is:
- 256 tokens
- 512 tokens
- 768 tokens
- 1,024 tokens
Use approximately 10–20% overlap as an initial baseline, then tune against your evaluation dataset. These are starting points, not universal optimal values.
6. Final recommendations
My strongest recommendation: Start with Chonkie for chunking experimentation, LlamaIndex for hierarchical and semantic retrieval, and Docling for document parsing where necessary. Evaluate the combined pipeline against a representative question-and-answer dataset before committing to it.
7. One important question about your RAG system
What kind of documents are you primarily indexing?
1. Document types
2. Primary objective
3. Technology stack
[Design my RAG chunking architecture]
I can use those details to narrow this down to a concrete architecture, including the actual chunking algorithms and framework integrations worth implementing.
Pages cited in this answer 19
- andrew.oooBest Chunking Libraries for RAG 2026: 6 Compared — andrew.ooo
- reviewramble.comBest chunking (2026): 6 compared
- github.comGitHub - feyninc/chonkie: 🦛 CHONK docs with Chonkie ✨ — The lightweight ingestion library for fast, efficient and robust RAG pipelines · GitHub
- github.comdocs/src/oss/integrations/splitters/recursive_text_splitter.mdx at main · langchain-ai/docs · GitHub
- ovaledge.comBest RAG Frameworks for Enterprise AI Pipelines in 2026
- yigtwxx.github.ioChunking Strategies - Awesome RAG Production
- laoujin.github.ioChunking Strategies for RAG Pipelines — Atlas
- docs.chonkie.aiChonkie Documentation
- vdf.aiBest RAG Frameworks (2026): 8 Open-Source Options Compared
- github.comGitHub - run-llama/llama_index: LlamaIndex is the document processing platform for AI · GitHub
- docs.llamaindex.aiLlamaIndex Framework, by the makers of LlamaParse | Developer Documentation
- github.comGitHub - langchain-ai/langchain: The agent engineering platform. · GitHub
- docs.langchain.comHome - Docs by LangChain
- github.comGitHub - docling-project/docling: Get your documents ready for gen AI · GitHub
- docling-project.github.ioIndex - Docling
- github.comGitHub - Unstructured-IO/unstructured: Convert documents to structured data effortlessly. Unstructured is open-source ETL solution for transforming complex documents into clean, structured formats for language models. Visit our website to learn more about our enterprise grade Platform product for production grade workflows, partitioning, enrichments, chunking and embedding. · GitHub
- docs.unstructured.ioParse your first document - Unstructured
- github.comGitHub - deepset-ai/haystack: Open-source AI orchestration framework for building context-engineered, production-ready LLM applications. Design modular pipelines and agent workflows with explicit control over retrieval, routing, memory, and generation. Built for scalable agents, RAG, multimodal applications, semantic search, and conversational systems. · GitHub
- docs.haystack.deepset.aiIntroduction to Haystack | Haystack Documentation
Google AI ModeNov 5, 2026
The top-rated frameworks and tools for implementing sophisticated text chunking strategies in a Retrieval-Augmented Generation (RAG) system are categorized below by their
primary approach and technical capabilities.Top Frameworks & Tools for RAG Chunking
- LlamaIndex
- Best for: Semantic splitting, hierarchical parsing, and node relationships.
- Key Capabilities: Provides out-of-the-box support for
SemanticSplitterNodeParser(which groups consecutive sentences by embedding similarity), hierarchical chunking (linking parent summary chunks to child detail chunks), and node-level metadata preservation.
- LangChain
- Best for: Recursive character splitting, layout-aware parsing, and modular pipelines.
- Key Capabilities: Offers flexible text splitters (
RecursiveCharacterTextSplitter,MarkdownHeaderTextSplitter,HTMLSectionSplitter) that respect natural document grammar, headers, and code blocks before falling back to fixed-size token or character limits.
- UnstructuredUnstructured ( Unstructured.ioUnstructured.io )
- Best for: Complex multi-format document ingestion (PDFs, DOCX, PPTX, images).
- Key Capabilities: Automatically extracts structural elements like titles, narrative text, tables, and embedded charts, allowing you to chunk by document layout or partition elements without breaking table boundaries.
- NVIDIA NeMo / RAG Blueprints
- Best for: Enterprise evaluation, microservices architecture, and benchmarked strategies.
- Key Capabilities: Provides reference implementations and blueprints to benchmark different chunking strategies (such as page-level vs. token-based vs. section-level chunking) while standardizing embedding and reranking microservices.
- Docugami
- Best for: XML/tree-based semantic chunking of long-form business and financial documents.
- Key Capabilities: Generates semantic XML trees from complex contracts, leases, and reports to preserve deep document architecture rather than slicing text blindly.
Comparison of Core Chunking Strategies
If you'd like to narrow this down, tell me:
- What type of documents you are working with (PDFs, web scrapes, legal contracts, code)?
- Are you prioritizing maximum retrieval accuracy or low processing latency/cost?
ChatGPTNov 21, 2026
If you're moving beyond naive fixed-size chunking, I'd focus on semantic, structure-aware, hierarchical, and late chunking rather than simply increasing chunk size or overlap.
As of November 2026, there are several strong open-source options. My shortlist would be Chonkie, Docling, LlamaIndex, LangChain, and Unstructured.
The important distinction is that these tools solve slightly different problems: some identify semantic boundaries, some preserve document structure, and others provide multiple retrieval-oriented segmentation strategies.
1. Top text segmentation libraries
Here is my practical ranking based on capability, flexibility, and suitability for RAG pipelines—not a universal benchmark ranking.
1. Chonkie
(Best standalone chunking toolkit)
- Semantic, recursive, sentence, token, code, table, neural, and late chunking.
- Lightweight and designed specifically for chunking.
- Good for experimenting with different segmentation strategies without adopting an entire RAG framework.
Best when you want a dedicated chunking layer.
2. Docling
(Best structure-aware segmentation)
- HybridChunker respects document hierarchy and token limits.
- Preserves headings, tables, lists, and document relationships.
- Particularly useful for PDFs, technical documents, and Office files.
Best when document layout matters as much as text content.
3. LlamaIndex
- SemanticSplitterNodeParser.
- HierarchicalNodeParser.
- SentenceSplitter and SentenceWindowNodeParser.
- Supports parent-child relationships between chunks.
Best for hierarchical retrieval and context-aware RAG.
4. LangChain
- RecursiveCharacterTextSplitter.
- MarkdownHeaderTextSplitter.
- HTMLHeaderTextSplitter.
- Token-aware and code-aware segmentation.
- Semantic chunking integrations.
Best for an existing LangChain-based RAG stack.
5. Unstructured
- Element-based partitioning.
by_titlechunking strategy.- Combines document elements while respecting structural boundaries.
- Handles PDFs, HTML, DOCX, PPTX, and other formats.
Best for heterogeneous enterprise document collections.
These choices are consistent with recent comparative tool roundups and documentation, although the rankings above are my engineering recommendations rather than independently verified ratings.
2. Advanced segmentation techniques worth exploring
The library matters, but the segmentation algorithm matters even more.
Strategy How it works Main advantage Semantic chunking Detects topic shifts using embedding similarity Preserves conceptual coherence Hierarchical chunking Creates parent, child, and sometimes grandchild chunks Supports broad and precise retrieval Late chunking Embeds larger text first, then pools token embeddings into chunks Preserves surrounding context Structure-aware chunking Splits using headings, sections, tables, and document layout Preserves document organization Agentic/LLM chunking Uses an LLM to identify logical content boundaries Handles complex narrative structures Proposition chunking Breaks text into atomic factual statements Improves precise factual retrieval A few deserve particular attention:
Semantic chunking
Instead of splitting every 500 tokens, compare adjacent sentences using embeddings. When semantic similarity drops below a threshold, create a new chunk.
Useful for:
- Long-form articles.
- Knowledge bases.
- Research papers.
- Documents with frequent topic changes.
Hierarchical chunking
Create multiple levels of segmentation:
Parent chunk: Database Architecture
Child 1
Indexing strategies
Child 2
Query optimization
Child 3
Replication
Child 4
Consistency models
Retrieve a precise child chunk, then optionally expand its parent for additional context.
LlamaIndex is particularly useful for implementing this approach.
Late chunking
This is an especially interesting approach if you're trying to improve retrieval without losing contextual information.
Traditional chunking:
- Split document.
- Embed each chunk independently.
- Store embeddings.
Late chunking:
- Tokenize and embed the larger document.
- Obtain contextualized token embeddings.
- Define chunk boundaries.
- Pool the relevant token embeddings for each chunk.
This allows a chunk's embedding to reflect context from outside its own boundaries. It requires an embedding model that exposes suitable token-level embeddings.
3. My recommended technology combinations
Rather than selecting one library to do everything, I'd consider these combinations:
Use case Recommended combination General-purpose RAG Chonkie + your existing vector database Complex PDF ingestion Docling + HybridChunker Hierarchical retrieval LlamaIndex + hierarchical node parsing Enterprise document ingestion Unstructured + custom chunking Semantic segmentation experiments Chonkie + embedding model Existing LangChain pipeline LangChain splitters + Chonkie One particularly promising combination is Docling for document extraction followed by Chonkie for additional semantic segmentation.
The benefit is separating two distinct problems:
- Understanding the document's structure.
- Determining the best retrieval boundaries.
4. How to benchmark these approaches
Don't assume semantic chunking automatically produces better RAG results. A 2026 IEEE survey identifies inconsistent evaluation practices as a major challenge in comparing chunking strategies.
I'd benchmark at least these five approaches:
- Fixed-size baseline.
- Recursive character splitting.
- Semantic chunking.
- Hierarchical chunking.
- Late chunking.
Measure:
Metric What it tells you Recall@5 / Recall@10 Whether relevant information is retrieved Precision@K Whether retrieved chunks are relevant MRR / NDCG Whether relevant results rank highly Answer faithfulness Whether answers remain grounded Context utilization How much retrieved context is useful Indexing latency Cost of preparing documents Storage overhead Embedding and metadata footprint Keep the embedding model, retrieval configuration, test questions, and reranker constant while comparing chunking methods.
5. My final recommendation
If I were building a sophisticated RAG pipeline today, my starting architecture would be:
Source documents
PDF · HTML · DOCX · Markdown
Docling / Unstructured
Parsing and structural extraction
Chonkie / LlamaIndex
Semantic and hierarchical segmentation
Embedding and indexing
Context-aware embeddings and metadata
Hybrid retrieval + reranking
Vector search · BM25 · parent-child retrieval
6. One question that would help narrow this down
What kind of documents does your RAG pipeline primarily ingest?
Document types
Current technology stack
Primary objective
[Build my recommended architecture]
With those details, I can narrow this down to an actual implementation rather than just a list of libraries.
Pages cited in this answer 14
- github.comGitHub - feyninc/chonkie: 🦛 CHONK docs with Chonkie ✨ — The lightweight ingestion library for fast, efficient and robust RAG pipelines · GitHub
- github.comGitHub - docling-project/docling: Get your documents ready for gen AI · GitHub
- docling.orgDocling for RAG: HybridChunker, Token Limits & Loaders (2026)
- github.comGitHub - run-llama/llama_index: LlamaIndex is the document processing platform for AI · GitHub
- docs.llamaindex.aiLlamaIndex Framework, by the makers of LlamaParse | Developer Documentation
- github.comGitHub - langchain-ai/langchain: The agent engineering platform. · GitHub
- docs.langchain.comHome - Docs by LangChain
- github.comGitHub - Unstructured-IO/unstructured: Convert documents to structured data effortlessly. Unstructured is open-source ETL solution for transforming complex documents into clean, structured formats for language models. Visit our website to learn more about our enterprise grade Platform product for production grade workflows, partitioning, enrichments, chunking and embedding. · GitHub
- docs.unstructured.ioParse your first document - Unstructured
- andrew.oooBest Chunking Libraries for RAG 2026: 6 Compared — andrew.ooo
- reviewramble.comBest chunking (2026): 6 compared
- mixpeek.comBest Document Parsing Tools in 2026 - Tested & Ranked | Mixpeek
- doi.orgText Chunking Strategies for Retrieval-Augmented Generation: A Survey
- aclanthology.orgAdaptive Chunking: Optimizing Chunking-Method Selection for RAG
Google AI ModeNov 21, 2026
To move beyond naive fixed-size chunking, use
specialized open-source librariesthat handle semantic boundaries, structure, and token efficiency.Top-Rated Tools & Libraries
- Chonkie : A lightweight, dedicated Python library built strictly for text chunking. It supports fast SIMD-based splitting, sentence chunking, recursive rules, semantic chunking, code segmentation, and late-chunking strategies with minimal bloat.
- LlamaIndex : Built specifically for data-centric RAG systems, it offers advanced
NodeParsersthat handle hierarchical chunking, markdown/code-aware parsing, and metadata extraction out of the box. - LangChain : A general framework featuring diverse
TextSplitters(such asSemanticChunker,RecursiveCharacterTextSplitter, and language-specific code splitters) that fit easily into broader agentic workflows. - Unstructured / Marker / Docling : Document-parsing libraries that extract layout, tables, and hierarchical headings first, allowing you to segment text strictly by logical document structure rather than arbitrary character counts.
Core Alternative Strategies to Implement
- Semantic Chunking: Calculates embedding distance or cosine similarity between consecutive sentences and cuts a chunk whenever the semantic drift crosses a threshold.
- Recursive Character / Sentence Chunking: Tries to split on large natural boundaries (paragraphs) first, falling back to smaller boundaries (sentences, then words) only if a chunk exceeds your token limit.
- Hierarchical / Parent-Child Chunking: Indexes small, fine-grained chunks for high-precision vector search, but feeds the larger parent paragraph or section to the LLM to preserve context.
- Late Chunking: Embeds the entire long-form document context first (using long-context embedding models) and derives chunk representations afterward to prevent loss of global context.
What type of documents (e.g., PDFs, codebases, legal contracts) are you primarily processing, and what embedding model or vector database are you using?
Pages cited in this answer 2
Top head-to-head comparisons
Since Oct 6Data through Nov 21, 2026Based on 10 AI answers
For agents: this page as Markdown, https://parse.gl/topics/advanced-text-chunking-libraries.md. JSON, MCP · free for the last 90 days, checks from $0.01
This page
Read and search
Connect
npx -y parse-gl check <domain>Copy the CLI commandAn agent can save work before signup: POST https://agent.parse.gl/v1/workspaces
What it costs
Prices: https://parse.gl/pricing.md
Map of the site: https://parse.gl/llms.txt