Zero Labs
Industry News / AI

SpectRAG: Weighted Chunk Graphs for Token-Budgeted Context Selection in Multi-Hop…

Source · Towards AI By Buse Yaren

From the publisher’s feed, collected in the ZeroLabs newsroom.

SpectRAG: Weighted Chunk Graphs for Token-Budgeted Context Selection in Multi-Hop Retrieval-Augmented GenerationSpectRAG turns your corpus into a weighted chunk graph and uses spectral graph theory to pick evidence that is relevant, diverse and connected. Its index is about 6× smaller than LightRAG’s.🤹🏼Retrieval-augmented generation (RAG) systems enhance large language models (LLMs) by sourcing external evidence and using that retrieved information to inform generation. While dense retrieval works well for local semantic alignment, standalone ranked retrieval may yield redundant passages, overlook dependencies across chunks, and offer insufficient evidence for multi-hop reasoning.We propose SpectRAG, a spectral graph-augmented retrieval framework that combines hybrid candidate seeding, weighted chunk graph construction, graph-based expansion, spectral relevance propagation, and token-budgeted context selection !!Ask a RAG system a question for which the answer is spread across three passages and see what happens.The retriever embeds your question and finds the six chunks of text closest to it. These are then handed to the LLM. All six will come from the same paragraph-sized section of one document. They say almost the same thing. The passage that links that section to the rest of the answer never appears because it does not resemble the question.The model then does its best with a context window full of near-duplicates. Sometimes it guesses right. Often, it does not.Same question, same 6-chunk budget. Classic top-k fills the window with near-duplicates from one cluster and finds 1 of 3 gold passages.This is the problem we set out to fix with SpectRAG. Here is the idea in one sentence:Stop ranking chunks one at a time. Select a set of chunks that works together as evidence.In this post I’ll walk through why top-k retrieval breaks on multi-hop questions, how SpectRAG uses a weighted chunk graph and its Laplacian spectrum to fix it, and what we measured on MultiHopRAG and UltraDomain. That includes the parts where SpectRAG does not win.Three ways top-k retrieval quietly failsDense retrieval scores every chunk on its own: how similar is this chunk to the query? That works well for a lookup like “what is the boiling point of X?” When the answer needs several pieces of evidence, it breaks in three ways.Redundancy: Neighboring and overlapping chunks sit close together in embedding space. If one of them is a strong match, its near-copies are too. Top-k happily returns all of them, using up your context window as it repeats itself.Missing bridge evidence: Multi-hop answers are typically based on a connecting passage. This could be defined as a definition, a shared entity, or a reference that links two facts. Connecting passages are not usually a direct match for the question, so they are given a lower rank and are eliminated from further consideration.Structure blindness: Real corpora are characterized by several structural features, including document order, section hierarchy, shared entities and citations. Top-k ignores all of it and treats your knowledge base as a bag of independent vectors.The reframe: from top-k to context-set retrievalSpectRAG treats retrieval as a set selection problem. Rather than maximizing individual scores, our objective is to establish a context set C that is collectively beneficial.F(C, q) = Σ Rel(c, q) ← each chunk should be relevant − λ Σ Red(cᵢ, cⱼ) ← …but not repeat each other + γ Cov(C, q) ← together they cover the question's aspects + η Conn(C; G) ← and they form a connected evidence pathIf the values of λ, γ and η are set to zero, the result will be plain top-k. The remaining three terms each target one of the failure modes above. As this objective is defined over sets, it cannot be optimized by sorting a list. Instead, SpectRAG uses a graph-based pipeline to approximate it.How SpectRAG worksSpectRAG has an offline stage that runs once per corpus and an online stage that runs once per query.The full SpectRAG pipeline [SpectRAG official arXiv preprint]Offline, step 1: a chunk graph built from six signalsDocuments are split into roughly 1,200-token chunks. The splitter follows headings when they exist, places semantic breakpoints when they don’t, never cuts mid-sentence and keeps tables intact. Every chunk is embedded with nomic-embed-text.Then comes the important part. Chunks are connected. Unlike a plain k-NN embedding graph, SpectRAG draws edges from six complementary evidence signals:Chunks from five documents get connected signal by signal, then settle into one weighted chunk graphFor every chunk an LLM generates the questions that chunk can answer. Two chunks that answer similar questions are functionally related, even if their wording is completely different.The signals are fused into one edge weight, w_ij = Σ α_r · w_ij^(r), and weak edges are pruned so the graph stays sparse.Offline, step 2: give every chunk a second set of coordinatesWe take the symmetric normalized Laplacian of the graph,L_sym = I − D^(-1/2) · W · D^(-1/2)That gives every chunk two geometries:its dense embedding, which encodes what the chunk says;its spectral coordinate, which encodes where the chunk lives in the corpus’s community structure.In embedding space, topics overlap and some chunks sit far from the neighbours they belong with. In spectral space (Laplacian eigenvectors), each graph community pulls together, whatever its wordingOnline: five stages per query1️⃣ Hybrid seeds: Three rankings are fused with Reciprocal Rank Fusion: dense FAISS cosine, BM25 and matching the query against the stored utility questions. This gives a high-recall seed set of 20 chunks. We deliberately over-retrieve here, because the rest of the pipeline can only reach what the seeds can reach.2️⃣ Graph expansion: A two-hop breadth-first search from the seeds in Neo4j pulls in up to 200 candidates. These are neighbours that may not match the query at all but are connected to chunks that do.3️⃣ Proximity re-scoring / relevance diffusion: This is where the spectral structure earns its keep. Conceptually, query relevance diffuses over the graph:s' = exp(−t · L_sym) · sA chunk that never matched the query can still light up if it is strongly connected to chunks that did ⤵️Relevance starting at three seed chunks spreads along the graph as the diffusion scale t grows (Real heat-kernel computation on a synthetic graph)4️⃣ Token-budgeted selection: Most retrievers return a fixed k. SpectRAG fills a token budget of about 12,000 tokens instead:a protected core of high-confidence chunks that diversity rules can never push out;a precision-oriented tail that prefers new documents and under-represented spectral clusters and rejects chunks that repeat what’s already in;a backfill step so the budget is never left half-empty.The context window fills by tokens, not by count: protected core first, then a coverage-aware tail with a precision floor, then backfillDoes it work? What we measured 👩🏻‍🔬We evaluated on MultiHopRAG (2,556 gold-answer multi-hop questions) and four UltraDomain corpora (Agriculture, CS, Legal, Mix). Baselines were NaiveRAG, Hybrid (BM25 + dense), HyDE and LightRAG. Every system used the same generator, so differences in answers come from retrieval.1. A much lighter graph than entity-based GraphRAGLightRAG builds its graph from LLM-extracted entities, plus separate vector stores for entities and relations. SpectRAG’s nodes are just your chunks.SpectRAG paper, Table 4.➡️ Across all five corpora SpectRAG has 2.8× to 6.6× fewer nodes, and on MultiHopRAG the full persisted index is 46 MB versus 274 MB. The graph is smaller in nodes, not in edges. Each chunk has far richer connections: up to ~5.7 edges per node versus about 1 for LightRAG.2. It finds more of the evidence, especially as you go deeperSpectRAG paper, Table 6.🔸On MultiHopRAG, SpectRAG recovers 91.8% of gold evidence overall, against 76.1% for the next-best system, and leads at Recall@10 (84.0). Against LightRAG it’s ahead at every cutoff and on MRR (70.4 vs 61.5).3. Best end-to-end accuracy, by a narrow but consistent marginSpectRAG paper, Table 7.SpectRAG has the highest exact match (71.2), F1 (71.6) and answer-containment (71.6) of the five systems. The gap to Hybrid and LightRAG is under one point. The gap to NaiveRAG and HyDE is 3–6 points.4. The biggest win is where it should be: connecting evidenceSpectRAG paper, Table 8.🎢 On inference questions, the type that most needs evidence assembled across hops, SpectRAG reaches 95.1% exact match. Comparison and temporal questions are close to a tie, with LightRAG slightly ahead.⌨️ Try itSpectRAG is open source (MIT). It runs with FAISS, BM25, Neo4j and a React + D3 front-end, where you can explore the chunk graph of your own documents.# index a folder of documentspython main.py index papers/# ask a multi-hop questionpython main.py query "What methods improve cross-document reasoning?"It can run fully local: Ollama embeddings, a local LLM for utility questions and spaCy NER for entities, with no API key.📄 Paper: SpectRAG: Weighted Chunk Graphs for Token-Budgeted Context Selection in Multi-Hop Retrieval-Augmented Generation, arXiv:2610.36991💻 Code: github.com/SightAndCite/SpectRAGIf you build RAG systems, I’d love to hear where your retriever breaks. Is it redundancy, missing bridges or something else? Leave a comment, and if this was useful, a clap or a share helps other people find it 👏SpectRAG is joint work by Zafer Sahinoglu, Abdulazeez Mohammed, Buse Yaren Kazangirler and Cahit Berkay Kazangirler. All numbers in this post are taken from the paper’s tables. The animations of toy graphs are illustrations of the mechanism, not experimental results.SpectRAG: Weighted Chunk Graphs for Token-Budgeted Context Selection in Multi-Hop… was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.