NestedRAG

NestedRAG

An open-source RAG library that organizes documents into a nested tree instead of flat chunks, so an AI assistant retrieves one relevant piece per branch instead of repeating itself.

🔗 Visit NestedRAG
📁 AI & Machine Learning🗣️ English📅 September 5, 2026

Description

When you ask an AI a question about a huge pile of documents, it can't read everything at once — it first has to fetch the right pages, a process called "retrieval-augmented generation" (RAG). Most tools do this by chopping documents into same-size pieces and grabbing the ones that sound closest to your question, which often pulls back several near-duplicate chunks while missing the surrounding context. NestedRAG instead builds something closer to a table of contents with nested sub-sections, then picks at most one relevant piece per branch of that tree — fewer repeats, more coverage.

NestedRAG is a Python 3.9+ library (MIT license) that recursively splits documents into a hierarchical tree of semantically-related chunks at varying granularities, then uses graph-based context exclusion (marking ancestor/descendant chunks) to avoid retrieving redundant text from the same branch twice. It plugs into LangChain, Qdrant as the vector store, and OpenAI embeddings, and includes tools for persisting/reloading the graph plus basic retrieval statistics. It's aimed specifically at long-form unstructured text — research papers, call transcripts, technical documentation — where flat chunking's size/relevance trade-off hurts the most.

💬 Our review

The short version: NestedRAG solves a real, specific annoyance with standard RAG — getting five near-identical chunks back for one query — by organizing documents hierarchically and enforcing diversity across branches, at the cost of more moving parts to run.

Against LlamaIndex or a standard LangChain + flat-chunking pipeline, NestedRAG's tree-based structure directly targets the redundancy problem that ad-hoc re-ranking and deduplication scripts usually paper over after the fact. The trade-off is real: building and querying that hierarchy scales close to exponentially with tree depth and branching factor, so it's a heavier setup for long documents than simple fixed-size chunking, and it's tuned specifically for unstructured long-form text rather than short or structured content. It's free, open-source (MIT), and worth adopting if you're already fighting duplicate-chunk noise on long documents; skip it for short documents or if you need a drop-in, zero-tuning RAG pipeline.

💰 Pricing

Open sourceFree, MIT license
Self-hosted Free (MIT)

📊 Global score

53Average
🌐Availability15/100Faible

1 language · 0 platform

📄Profile90/100Excellent

Profile completeness

🤖 AI-enriched data

💰 Pricing model
💳 Open source

Gratuit, licence MIT

👥 Target audienceDéveloppeurs construisant des systèmes RAG sur des documents longs (recherche, transcripts, documentation technique)
🗣️ Languagesen
🌍 Target countriesInternational
👍

Pros

Meilleur ratio information pertinente / information totale grâce au chunking hiérarchique

Récupère des résultats divers de branches différentes sans redondance

Sélectionne dynamiquement la taille de chunk selon la pertinence de la requête

Licence MIT, gratuit, intégration LangChain + Qdrant + OpenAI Embeddings

👎

Cons

Croissance quasi exponentielle du nombre de points de données selon la profondeur de l'arbre

Nécessite un réglage fin de la profondeur et de la granularité des chunks

Pensé spécifiquement pour du texte long non structuré, moins généraliste

❓ Frequently asked questions

What is NestedRAG in one sentence?
What stack does it require?
What kind of content is it best suited for?
Does it replace my vector database?
Is it actively maintained?
Is it worth the money compared to alternatives?
Which tool should you pick for your case?