SpectRAG: Weighted Chunk Graphs for Token-Budgeted Context Selection in Multi-Hop Retrieval-Augmented Generation
Organizations: Mitsubishi Electric US Cambridge, 5900-A Katella Avenue California 90630, USA · Mitsubishi Electric Innovation Center (MELIC) Cambridge, MA 02139, USA · Institute of Graduate Programs, Dept. of Computer Engineering, Karabuk University, Karabuk, 78050, Turkey
Abstract
Retrieval-augmented generation (RAG) systems ground large language models (LLMs) by retrieving external evidence and conditioning generation on the retrieved context. Although dense retrieval is effective for local semantic matching, independently ranked retrieval can return redundant passages, miss cross-chunk dependencies, and provide incomplete 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. Document chunks are represented by dense semantic embeddings and graph-spectral coordinates derived from a weighted chunk graph whose edges encode semantic similarity, document adjacency, section hierarchy, shared entities, citation links, and similarity between LLM-generated utility questions. At query time, SpectRAG builds a high-recall seed set using exact inner-product search and hybrid relevance signals, expands it over the chunk graph, re-scores candidates using graph proximity and spectral information, and assembles the final context under a fixed token budget. The goal is not merely to retrieve individually similar chunks, but to construct a context that is relevant, diverse, structurally connected, and sufficient for grounded reasoning. Experiments on MultiHopRAG, UltraDomain, and long-document question-answering settings show that SpectRAG improves broad evidence recovery and achieves competitive generation quality against dense, hybrid, HyDE, LightRAG, and NaiveRAG baselines. The results further indicate that graph-spectral structure is particularly useful for inference-oriented and cross-document retrieval, while highlighting trade-offs in early precision, computational cost, and domain-dependent performance.
Figures & tables
| Step | What it does | Output |
|---|---|---|
| Chunking | Splits documents into structural (heading-aware) or semantic chunks measured with tiktoken (1200 tokens, 100 overlap). Extracts tables. Never cuts mid-sentence. | Chunk objects with text, position, section path, and references |
| Embedding | Encodes each chunk with nomic-embed-text (768-dimensional), using the model’s search_document: task prefix. Builds a FAISS flat index over L2-normalized vectors for approximate nearest-neighbor search. | chunk.embedding per chunk & faiss.index on disk |
| Edge signals | Runs six extractors to find relationships between chunks. Entity edges use gpt-4o-mini concept extraction by default, & utility-question edges use gpt-4o-mini ; both store per-chunk outputs for query-time reuse. Concepts are disk-cached. | Six lists of RawEdge(i, j, weight) & chunk. utility_questions |
| Graph build | Combines all six signals using configurable weights, either fixed priors or auto-calibrated per corpus. Drops edges below the sparsification threshold. | Weighted graph |
| Spectral decomp | Computes the normalized Laplacian . Extracts the 32 smallest eigenvectors. Each chunk gets a 32-dimensional coordinate encoding its position in the graph’s community structure. | chunk.spectral_coords (32-dimensional) per chunk |
| Neo4j write | Writes all chunks as nodes and edges with per-signal attributes to Neo4j via batched Cypher. | Persistent graph in Neo4j |
| Stage | What it does | Output |
|---|---|---|
| Hybrid seed retrieval | Fuses three rankings with reciprocal rank fusion (RRF): dense FAISS cosine, utility-question matching (query to stored questions), & BM25 lexical retrieval. The full relevance vector consumed downstream is hybrid (dense & BM25), so lexical precision reaches later stages. | Seed set (20 chunks) & hybrid relevance scores for all chunks |
| Graph expansion | Performs breadth-first search from in Neo4j, using two hops and a cap of 200 nodes. Fetches the candidate subgraph. | Candidate set ( chunks) and subgraph |
| Proximity re-scoring | Blends relevance with graph proximity as , where proximity in hybrid mode is the mean of spectral eigenspace closeness and Personalized PageRank from the seeds over the real weighted subgraph. | Re-scored candidate set |
| Token-budget selection | Fills an approximately 12k-token budget with relevant chunks: a protected core, a tail precision floor, document-coverage tie-break, and backfill so the budget is never starved. Alternative modes include anchor_expand_ce , protected_mmr , and mmr . | Final context set (adaptive, approximately 10–15 chunks) |
| Generation | Formats grouped by source document and sends it to gpt-4o-mini with a synthesis-oriented, grounded prompt and temperature 0. | Answer string and ranked source metadata |
| Parameter | Setting | Related stage |
|---|---|---|
| Chunking | Structural or semantic chunking with tiktoken ; 1200-token chunks and 100-token overlap; sentence boundaries and tables are preserved. | Offline chunking |
| Embedding model | nomic-embed-text , 768-dimensional embeddings, with the search_document: prefix for indexed chunks. | Offline embedding |
| Edge extraction | Six edge-signal extractors: semantic, document adjacency, section hierarchy, entity/concept, utility-question, and citation/dependency signals. | Offline edge signals |
| LLM-assisted extraction | gpt-4o-mini for concept extraction, utility-question generation, and answer generation; gpt-4o for judging when evaluation requires an LLM judge. | Offline and generation |
| Graph and spectral index | Weighted graph with sparsified edges; normalized Laplacian ; 32 spectral coordinates per chunk. | Graph build and spectral decomp |
| Seed retrieval | RRF over dense FAISS cosine, BM25 lexical retrieval, and utility-question matching; seed set size is 20 chunks. | Online stage 1 |
| Corpus | System | Nodes | Edges | E/N | Graph | Node |
|---|---|---|---|---|---|---|
| File | Red. | |||||
| Agriculture | LightRAG | 1,236 | 1,083 | 0.88 | 1.08 MB | — |
| SpectRAG | 239 | 476 | 1.99 | 0.14 MB | ||
| CS | LightRAG | 1,327 | 1,036 | 0.78 | 1.06 MB | — |
| SpectRAG | 461 | 2,608 | 5.66 | 0.72 MB | ||
| Legal | LightRAG | 5,615 | 6,784 | 1.21 | 6.80 MB | — |
| Field | Content |
|---|---|
| Query | How can anomaly detection techniques be applied in various domains to identify outliers? |
| SpectRAG answer | Frames anomaly detection as a versatile toolset applied through several themes: understanding the dataset (categorical, ordinal, or continuous) to guide method choice; statistical methods (z-scores, p-values, standard-deviation thresholds); machine-learning approaches (K-means clustering, supervised learning on labeled data); domain-specific applications in finance (fraud), healthcare (rare conditions), network security (intrusions), and manufacturing (predictive maintenance); evaluation and validation via precision, recall, F1, and cross-validation; and visualization tools (scatter plots, box plots, heat maps) for inspecting distributions. |
| LightRAG answer | Synthesizes anomaly detection across fields through big data and machine learning (real-time pattern flagging for finance and network security); statistical analysis (z-scores, box plots, interquartile range for healthcare); data mining (clustering to surface outliers in marketing); optimization methods (refining operations-research models); and real-time applications (streaming detection in telecommunications). Concludes that the techniques are versatile across finance, healthcare, marketing, and operations research. |
| Comprehensiveness | Winner: SpectRAG (position-sensitive; split on swap). More detailed exploration covering a wider range of methods, applications, and evaluation strategies. |
| Diversity | Winner: SpectRAG (confirmed both orderings). Richer variety of perspectives across multiple domains and specific techniques within each. |
| Empowerment | Winner: SpectRAG (confirmed both orderings). Detailed explanations and examples that help the reader understand how the techniques are applied. |
| System | Recall | R@2 | R@5 | R@10 | MRR |
|---|---|---|---|---|---|
| LightRAG | 65.6 | 31.2 | 49.2 | 61.8 | 61.5 |
| Hybrid | 76.1 | 46.3 | 68.0 | 76.1 | 79.1 |
| HyDE | 64.1 | 36.1 | 58.2 | 64.1 | 65.5 |
| NaiveRAG | 69.5 | 40.9 | 62.4 | 69.5 | 72.8 |
| SpectRAG | 91.8 | 39.1 | 64.7 | 84.0 | 70.4 |
| System | EM | F1 | Contains |
|---|---|---|---|
| HyDE | 65.2 | 65.6 | 65.4 |
| NaiveRAG | 67.8 | 68.3 | 68.3 |
| Hybrid | 70.6 | 71.1 | 71.0 |
| LightRAG | 70.5 | 70.9 | 70.8 |
| SpectRAG | 71.2 | 71.6 | 71.6 |
| Type | SpectRAG | LightRAG | Hybrid | HyDE | NaiveRAG |
|---|---|---|---|---|---|
| Comparison | 62.7 | 66.4 | 63.1 | 55.7 | 59.8 |
| Inference | 95.1 | 92.2 | 92.2 | 87.0 | 87.7 |
| Temporal | 43.9 | 44.9 | 42.7 | 35.8 | 40.1 |
| Null | 83.1 | 72.8 | 87.4 | 89.7 | 89.7 |
| Dimension | Agriculture | CS | Legal | Mix | Average | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Baseline: NaiveRAG | ||||||||||
| Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | |
| Comprehensiveness | 43.8 | 56.2 | 37.5 | 62.5 | 51.3 | 48.7 | 37.5 | 62.5 | 42.5 | 57.5 |
| Diversity | 32.5 | 67.5 | 21.3 | 78.7 | 52.5 | 47.5 | 37.5 | 62.5 | 35.9 | 64.1 |
| Empowerment | 40.0 | 60.0 | 32.5 | 67.5 | 51.3 | 48.7 | 33.8 | 66.2 | 39.4 | 60.6 |
| Overall | 40.0 | 60.0 | 35.0 | 65.0 | 51.3 | 48.7 | 35.0 | 65.0 | 40.3 | 59.7 |
| Dimension | Agriculture | CS | Legal | Mix | Average | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Baseline: NaiveRAG | ||||||||||
| Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | Base | SpectRAG | |
| Comprehensiveness | 43.8 | 56.2 | 41.2 | 58.8 | 53.7 | 46.3 | 43.8 | 56.2 | 45.6 | 54.4 |
| Diversity | 37.5 | 62.5 | 26.2 | 73.8 | 55.0 | 45.0 | 41.2 | 58.8 | 40.0 | 60.0 |
| Empowerment | 40.0 | 60.0 | 36.3 | 63.7 | 51.3 | 48.7 | 41.2 | 58.8 | 42.2 | 57.8 |
| Overall | 41.2 | 58.8 | 36.3 | 63.7 | 52.5 | 47.5 | 42.5 | 57.5 | 43.1 | 56.9 |
Graph Retrieval-Augmented Generation
Graph Retrieval-Augmented Generation connects language models to knowledge graphs to retrieve relational evidence for grounded, multi-hop answers.
See all 232 papers