ContextRAG: Extraction-Free Hierarchical Graph Construction for Retrieval-Augmented Generation

arXiv cs.CL Papers

Summary

ContextRAG introduces an extraction-free method for constructing hierarchical graph indices for retrieval-augmented generation, using Residual-Quantization K-Means and Formal Concept Analysis to reduce LLM calls and tokens by orders of magnitude while maintaining competitive F1 scores on multi-hop questions.

arXiv:2605.19735v1 Announce Type: new Abstract: Graph-structured retrieval-augmented generation (RAG) systems can improve answer quality on multi-hop questions, but many current systems rely on large language models (LLMs) to extract entities, relations, and summaries during indexing. These calls add token and wall-clock costs that grow with corpus size. We present ContextRAG, a graph RAG system whose graph topology is constructed without LLM-based entity or relation extraction. ContextRAG derives a fuzzy concept graph over chunk embeddings using residual-quantization k-means and Formal Concept Analysis with Lukasiewicz residuated logic. Bridge-like and meet-derived context nodes are induced by soft fuzzy join and meet operations, rather than by LLM-written graph edges. On a 130-task UltraDomain subset, ContextRAG builds its index with 30 LLM calls and 22,073 tokens. In contrast, a local HiRAG reproduction stress test required 870 indexing calls and 3.54M tokens on a 20-task subset before failing during graph construction; linear extrapolation to 130 tasks implies over 23M indexing tokens. ContextRAG obtains 33.6% F1 overall and 36.8% F1 on multi-hop tasks. An activation analysis shows that queries retrieving at least one lattice-derived node in the top five achieve +3.9 percentage points F1 over queries that do not; this association is diagnostic rather than causal.
Original Article
View Cached Full Text

Cached at: 05/20/26, 08:26 AM

# Extraction-Free Hierarchical Graph Construction for Retrieval-Augmented Generation
Source: [https://arxiv.org/html/2605.19735](https://arxiv.org/html/2605.19735)
Roman Prosvirnin HSE University rprosvirnin@hse\.ru&Sergei Kuznetsov HSE University skuznetsov@hse\.ru&Seungmin Jin HSE University sedzhin@hse\.ru

###### Abstract

Graph\-structured retrieval\-augmented generation \(RAG\) systems can improve answer quality on multi\-hop questions, but current systems often rely on Large Language Models \(LLMs\) to extract entities, relations, and summaries during indexing\. These calls add token and wall\-clock costs that grow with corpus size\. We presentContextRAG, a graph RAG system whose graph topology is constructed without LLM\-based entity or relation extraction\. ContextRAG derives a fuzzy concept graph over chunk embeddings via Residual\-QuantizationKK\-Means and Formal Concept Analysis with Łukasiewicz residuated logic\. Bridge\-like and meet\-derived context nodes are induced by soft fuzzy join and meet operations rather than by LLM\-written graph edges\. On a 130\-task UltraDomain subset, ContextRAG builds its index with 30 LLM calls and 22,073 tokens\. A local HiRAG reproduction stress test already requires 870 indexing calls and 3\.54M tokens on a 20\-task subset before failing during graph construction; extrapolation to 130 tasks implies over 23M indexing tokens\. ContextRAG obtains 33\.6% F1 overall and 36\.8% F1 on multi\-hop tasks\. An activation analysis indicates that queries retrieving at least one lattice\-derived node in the top five achieve\+3\.9\+3\.9pp F1 over queries that do not; this association is diagnostic rather than causal\.

ContextRAG: Extraction\-Free Hierarchical Graph Construction for Retrieval\-Augmented Generation

Roman ProsvirninHSE Universityrprosvirnin@hse\.ruSergei KuznetsovHSE Universityskuznetsov@hse\.ruSeungmin Jin††thanks:Corresponding author\.HSE Universitysedzhin@hse\.ru

## 1Introduction

Retrieval\-Augmented Generation \(RAG\) is a widely used paradigm for grounding Large Language Model \(LLM\) responses in external knowledge\(Lewiset al\.,[2020](https://arxiv.org/html/2605.19735#bib.bib1)\)\. While early systems retrieved over flat vector indices, recent work has shown that*graph\-structured*indices \- encoding entities, relations, and hierarchical communities \- yield substantial gains on multi\-hop and global\-summarization queries\(Edgeet al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib3); Guoet al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib4); Huanget al\.,[2025](https://arxiv.org/html/2605.19735#bib.bib6)\)\. State\-of\-the\-art graph RAG systems such as GraphRAG, LightRAG, KAG, and HiRAG construct their indices by issuing a large number of LLM calls to extract entities, summarize communities, and build hierarchical knowledge graphs\. This indexing\-time use of LLMs is a serious operational bottleneck\. For a subset of the UltraDomain benchmark, our local HiRAG reproduction stress test issues 870 LLM calls and consumes 3\.54M tokens on only 20 tasks before failing during graph construction; a linear extrapolation to the 130\-task subset gives over 5,600 LLM calls and 23M indexing tokens\. The cost grows with corpus size and must be re\-paid whenever the corpus is updated, the chunking strategy changes, or a different LLM is adopted\. For many practical deployments \- internal enterprise corpora, scientific literature search, evolving knowledge bases \- this cost structure is prohibitive\. We ask whether LLM extraction is*strictly necessary*for graph RAG, or whether useful structural benefits can be obtained from data\-derived algebraic structures\. We find that, in this setting, LLM extraction is not strictly required to construct a usable graph index, although LLM\-extracted graphs may still provide stronger answer quality\. We introduceContextRAG, a graph RAG system whose graph\-construction pipeline is extraction\-free\. The system rests on three theoretical pillars:

- •Residual\-QuantizationKK\-Means\(RQ\-KMeans\) for hierarchical clustering of dense chunk embeddings, providing a multi\-level attribute set;
- •Formal Concept Analysis\(FCA\) over a fuzzy formal context, yielding lattice\-inspired graph nodes whose extents and intents define retrieval structure;
- •Łukasiewicz residuated logicfor fuzzy Galois connections and a principled query\-time routing score\.

The graph topology is determined by data geometry through a fuzzy FCA\-inspired structure, rather than by LLM extraction quality\. In our implementation, the structural graph is extraction\-free; the only index\-time LLM usage is a separate set of 30 cluster\-summary virtual chunks, and this cost is included in all accounting\.

1. 1\.This work presents an extraction\-free graph\-construction pipeline based on fuzzy Formal Concept Analysis with Łukasiewicz residuated logic, a route to graph RAG that does not rely on LLM\-extracted entities or relations\.
2. 2\.Our results on a 130\-task UltraDomain subset show that ContextRAG indexes the corpus with 30 LLM calls and 22,073 tokens, while a local HiRAG reproduction stress test indicates orders\-of\-magnitude higher indexing cost\.
3. 3\.An activation analysis of the FCA\-inspired fuzzy graph \(\+3\.9 pp F1 when lattice\-derived nodes appear in retrieval\) reports a diagnostic association rather than causal evidence\.
4. 4\.A cost\-regime analysis shows that ContextRAG is most attractive for low\- and medium\-query workloads where corpora are re\-indexed frequently\.

The remainder of the paper is organized as follows\. Section[2](https://arxiv.org/html/2605.19735#S2)reviews graph RAG approaches and the use of FCA in information retrieval\. Section[3](https://arxiv.org/html/2605.19735#S3)introduces the algebraic background\. Section[4](https://arxiv.org/html/2605.19735#S4)describes the ContextRAG architecture\. Sections[5](https://arxiv.org/html/2605.19735#S5)–[7](https://arxiv.org/html/2605.19735#S7)report experiments, results, and an activation analysis\. Section[8](https://arxiv.org/html/2605.19735#S8)analyzes cost and trade\-offs\.

## 2Related Work

#### Vector and graph RAG\.

The standard*NaiveRAG*pipeline retrieves text chunks from a vector index using dense or hybrid sparse\-dense scoring\(Karpukhinet al\.,[2020](https://arxiv.org/html/2605.19735#bib.bib2)\)\. While effective for single\-hop factoid queries, NaiveRAG struggles when answers require composing evidence across multiple documents\. Graph RAG systems address this gap by building structured indices over the corpus\.GraphRAG\(Edgeet al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib3)\)uses an LLM to extract entities and relations, detects communities via Leiden clustering, and produces hierarchical community summaries that are queried at retrieval time\.LightRAG\(Guoet al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib4)\)simplifies this pipeline to a dual\-level \(entity\- and relation\-level\) knowledge graph, again populated by LLM extraction\.KAG\(Lianget al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib5)\)introduces a schema\-guided extraction step that imposes typed entities and relations, increasing extraction reliability at the cost of even heavier LLM usage\.HiRAG\(Huanget al\.,[2025](https://arxiv.org/html/2605.19735#bib.bib6)\)builds a 3\-level hierarchical knowledge graph \- entity, summary, and bridge layers \- using an extensive LLM extraction and community\-clustering pipeline\. All four systems share a common architectural commitment:*the LLM is in the loop during indexing*, and the graph structure is determined, in whole or in part, by LLM outputs\.

#### Cost of LLM\-based indexing\.

Recent surveys highlight that LLM\-driven indexing can be a major cost in graph RAG\(Gaoet al\.,[2023](https://arxiv.org/html/2605.19735#bib.bib7); Zhaoet al\.,[2024](https://arxiv.org/html/2605.19735#bib.bib8)\)\. Token consumption can scale poorly with corpus size because extraction pipelines often revisit many chunk, entity, or relation candidates before pruning, and community summaries must be regenerated when entities change\. Several works have proposed partial mitigations \- caching extraction outputs, selective summarization, or smaller distilled extractors \- but prior work has not, to our knowledge, shown a graph RAG system that removes LLM extraction from graph construction while retaining a non\-trivial graph structure\.

#### Formal Concept Analysis in IR\.

Formal Concept Analysis\(Ganter and Wille,[2024](https://arxiv.org/html/2605.19735#bib.bib9)\)has a long history in information retrieval as a means of organizing documents into concept hierarchies derived from term\-document incidence matrices\(Carpineto and Romano,[2004](https://arxiv.org/html/2605.19735#bib.bib10); Priss,[2006](https://arxiv.org/html/2605.19735#bib.bib11)\)\. Fuzzy extensions of FCA\(Bělohlávek,[2002](https://arxiv.org/html/2605.19735#bib.bib12)\)replace binary incidence with graded membership and rely on residuated lattices for the algebraic structure\. While FCA\-based retrieval has been studied extensively, its integration with modern dense embeddings, residual hierarchical clustering, and LLM answer generation has not, to our knowledge, been previously explored\. ContextRAG positions FCA as the structural alternative to LLM\-extracted knowledge graphs in modern RAG\.

#### Hierarchical quantization\.

Residual quantization\(Gray,[1984](https://arxiv.org/html/2605.19735#bib.bib14); Babenko and Lempitsky,[2015](https://arxiv.org/html/2605.19735#bib.bib15)\)is a classical technique in nearest\-neighbour search that decomposes a vector into a sum of codewords drawn from successive codebooks, each fitted to the residuals of the previous level\. Recent work uses RQ\-style structures for retrieval index compression\(Matsuiet al\.,[2018](https://arxiv.org/html/2605.19735#bib.bib16)\)\. ContextRAG repurposes RQ\-KMeans not for compression but as a source of multi\-level cluster assignments that become attributes in a formal concept lattice\.

## 3Background

### 3\.1Formal Concept Analysis

Formal Concept Analysis\(Ganter and Wille,[2024](https://arxiv.org/html/2605.19735#bib.bib9)\)provides a mathematical framework for deriving hierarchical conceptual structures from data\. A*formal context*is a tripleK=\(G,M,I\)K=\(G,M,I\)whereGGis a set of objects,MMa set of attributes, andI⊆G×MI\\subseteq G\\times Man incidence relation\. The Galois connection induced byIIis

A↑\\displaystyle A^\{\\uparrow\}=\{m∈M∣∀g∈A:\(g,m\)∈I\},\\displaystyle=\\\{m\\in M\\mid\\forall g\\in A:\(g,m\)\\in I\\\},\(1\)B↓\\displaystyle B^\{\\downarrow\}=\{g∈G∣∀m∈B:\(g,m\)∈I\}\.\\displaystyle=\\\{g\\in G\\mid\\forall m\\in B:\(g,m\)\\in I\\\}\.\(2\)A*formal concept*is a pair\(A,B\)\(A,B\)withA↑=BA^\{\\uparrow\}=BandB↓=AB^\{\\downarrow\}=A\. The set of all formal concepts ordered by\(A1,B1\)≤\(A2,B2\)⇔A1⊆A2\(A\_\{1\},B\_\{1\}\)\\leq\(A\_\{2\},B\_\{2\}\)\\iff A\_\{1\}\\subseteq A\_\{2\}forms a complete algebraic lattice with respect to infimum \(meet\) and supremum \(join\) operations\. This algebraic completeness is what makes FCA useful as a navigation structure over formal concepts; our implementation uses this structure as a finite graph\-construction template rather than enumerating every concept\.

### 3\.2Fuzzy Extension with Łukasiewicz Logic

Classical FCA operates on binary membership and loses information when chunks partially belong to multiple clusters\. Fuzzy extensions of FCA, see e\.g\.Bělohlávek \([2002](https://arxiv.org/html/2605.19735#bib.bib12)\), replace the binary incidence with a fuzzy membershipI:G×M→\[0,1\]I:G\\times M\\to\[0,1\]\. The algebraic structure is then a residuated lattice\(\[0,1\],≤,∧,∨,⊗,→\)\(\[0,1\],\\leq,\\wedge,\\vee,\\otimes,\\to\)where the residuated pair\(⊗,→\)\(\\otimes,\\to\)satisfies the adjoint condition

a⊗b≤c⇔a≤b→c\.a\\otimes b\\leq c\\iff a\\leq b\\to c\.\(3\)We use the Łukasiewicz t\-norm\(Hájek,[1998](https://arxiv.org/html/2605.19735#bib.bib13)\):

a⊗b\\displaystyle a\\otimes b=max⁡\(0,a\+b−1\),\\displaystyle=\\max\(0,\\,a\+b\-1\),\(4\)a→b\\displaystyle a\\to b=min⁡\(1,1−a\+b\)\.\\displaystyle=\\min\(1,\\,1\-a\+b\)\.\(5\)This choice is motivated by three properties: \(i\) the standard negation induced by Łukasiewicz logic is involutive \(¬¬a=a\\neg\\neg a=a\), which gives a simple interpretation to graded absence and presence; \(ii\) the residuum has a closed\-form analytical expression, enabling efficient computation of fuzzy Galois connections; and \(iii\) the t\-norm saturates at0and11, which keeps hierarchical aggregation numerically stable\. The fuzzy Galois connection is then

A↑​\(m\)\\displaystyle A^\{\\uparrow\}\(m\)=infg∈G\(A​\(g\)→I​\(g,m\)\),\\displaystyle=\\inf\_\{g\\in G\}\\bigl\(A\(g\)\\to I\(g,m\)\\bigr\),\(6\)B↓​\(g\)\\displaystyle B^\{\\downarrow\}\(g\)=infm∈M\(B​\(m\)→I​\(g,m\)\)\.\\displaystyle=\\inf\_\{m\\in M\}\\bigl\(B\(m\)\\to I\(g,m\)\\bigr\)\.\(7\)The set of fuzzy formal concepts forms a complete fuzzy concept lattice under pointwise ordering of fuzzy sets\(Bělohlávek,[2002](https://arxiv.org/html/2605.19735#bib.bib12)\)\. We use the standard FCM fuzziness exponentm=2\.0m=2\.0when computing initial membership values, balancing crisp\-cluster behaviour \(m→1m\\to 1\) and fully diffuse membership \(m→∞m\\to\\infty\)\.

### 3\.3Lattice Operators as Graph Node Types

The two fundamental lattice operations motivate two derived node types in the ContextRAG graph\. In our implementation, we use soft fuzzy versions of these operators before retrieval\-time pruning\.

#### Join \(∨\\vee\) \- least upper bound\.

With pointwise ordering on fuzzy extents, the join is the least concept that covers both input concepts\. The extent of the join of two concepts is the closure of the fuzzy union of concept extents:

A1∨2=\(max⁡\(A1,A2\)\)↑↓\.A\_\{1\\vee 2\}=\\left\(\\max\(A\_\{1\},A\_\{2\}\)\\right\)^\{\\uparrow\\downarrow\}\.\(8\)In practice, we instantiate a soft join by the fuzzy unionmax⁡\(A1​\(g\),A2​\(g\)\)\\max\(A\_\{1\}\(g\),A\_\{2\}\(g\)\)\. These join nodes encode*generalizations*that cover chunks from either of two clusters and act as cross\-cluster bridges\. They play a role analogous to HiRAG’s bridge knowledge but are derived from cluster geometry rather than from LLM\-based entity co\-occurrence\.

#### Meet \(∧\\wedge\) \- greatest lower bound\.

The meet captures the shared part of two concepts\. For fuzzy extents, the soft meet is implemented as the fuzzy intersection

A1∧2soft​\(g\)=min⁡\(A1​\(g\),A2​\(g\)\)\.A\_\{1\\wedge 2\}^\{\\mathrm\{soft\}\}\(g\)=\\min\(A\_\{1\}\(g\),A\_\{2\}\(g\)\)\.\(9\)Meet nodes encode*specializations*: chunks that belong simultaneously to multiple clusters with high membership\. We use these topically dense intersections as meet\-derived context nodes\.

### 3\.4Residual\-QuantizationKK\-Means

To obtain the attribute setMMfor FCA, we use Residual\-QuantizationKK\-Means \(RQ\-KMeans\), a hierarchical clustering procedure inspired by classical residual vector quantization\(Gray,[1984](https://arxiv.org/html/2605.19735#bib.bib14); Babenko and Lempitsky,[2015](https://arxiv.org/html/2605.19735#bib.bib15)\)\. LetX=\{x1,…,xn\}⊆ℝdX=\\\{x\_\{1\},\\dots,x\_\{n\}\\\}\\subseteq\\mathbb\{R\}^\{d\}be the chunk embedding matrix\. We defineLLlevels with codebooksC0,C1,…,CL−1C\_\{0\},C\_\{1\},\\dots,C\_\{L\-1\}:

r\(0\)​\(x\)\\displaystyle r^\{\(0\)\}\(x\)=x,\\displaystyle=x,\(10\)Q\(ℓ\)​\(x\)\\displaystyle Q^\{\(\\ell\)\}\(x\)=arg⁡minc∈Cℓ⁡‖r\(ℓ\)​\(x\)−c‖2,\\displaystyle=\\arg\\min\_\{c\\in C\_\{\\ell\}\}\\\|r^\{\(\\ell\)\}\(x\)\-c\\\|^\{2\},\(11\)r\(ℓ\+1\)​\(x\)\\displaystyle r^\{\(\\ell\+1\)\}\(x\)=r\(ℓ\)​\(x\)−cQ\(ℓ\)​\(x\)\(ℓ\)\.\\displaystyle=r^\{\(\\ell\)\}\(x\)\-c^\{\(\\ell\)\}\_\{Q^\{\(\\ell\)\}\(x\)\}\.\(12\)We use\|C0\|=96\|C\_\{0\}\|=96,\|C1\|=24\|C\_\{1\}\|=24,\|C2\|=12\|C\_\{2\}\|=12\. Three properties motivate this design: \(i\) hierarchical specificity \-L0L\_\{0\}captures coarse topics,L1L\_\{1\}within\-topic variation, andL2L\_\{2\}can capture finer residual distinctions when sufficient variance remains, mapping naturally to an FCA hierarchy; \(ii\) residual near\-orthogonality, encouraging successive levels to capture residual structure when variance remains; and \(iii\) FCA compatibility, since multi\-level assignments provide a richer multi\-dimensional attribute setMMthan single\-level clustering\.

## 4ContextRAG

### 4\.1System Overview

The ContextRAG pipeline consists of seven stages:

1. 1\.Chunking and dense embedding via e5\-large\-v2;
2. 2\.RQ\-KMeans hierarchical clustering;
3. 3\.Fuzzy concept graph construction \(seed concepts \+ join/meet derived nodes \+ co\-occurrence edges\);
4. 4\.Optional cluster\-summary virtual chunk generation \(30 LLM calls, one\-time, indexing, accounted for separately from graph construction\);
5. 5\.Hybrid retrieval combining BM25, cosine, and fuzzy routing;
6. 6\.Multi\-query expansion and LLM rerank;
7. 7\.LLM answer generation\.

The LLM appears only in stages 4, 6, and 7\. Stages 1\-3, which construct the graph topology, are entirely extraction\-free; this separation yields a three\-order\-of\-magnitude lower indexing token budget than the HiRAG reproduction stress\-test estimate while keeping the graph independent of LLM extraction errors\.

### 4\.2Embedding and Hybrid Retrieval

We embed chunks and queries withintfloat/e5\-large\-v2\(1024 dimensions\), using the prescribedpassage:andquery:prefixes\. Retrieval scores combine three components:

score​\(c\)\\displaystyle\\textsc\{score\}\(c\)=0\.3⋅bm25​\(q,c\)\\displaystyle=3\\cdot\\textsc\{bm25\}\(q,c\)\(13\)\+0\.5⋅cos⁡\(e5​\(q\),e5​\(c\)\)\\displaystyle\+5\\cdot\\cos\(e\_\{5\}\(q\),e\_\{5\}\(c\)\)\+0\.2⋅fuzzy​\(q,ℒ\),\\displaystyle\+2\\cdot\\textsc\{fuzzy\}\(q,\\mathcal\{L\}\),whereℒ\\mathcal\{L\}is the FCA\-inspired fuzzy concept graph\. The cosine term carries the dominant signal; BM25 contributes robust matching for named entities and low\-frequency terms; fuzzy routing activates when query\-concept membership exceeds a threshold\.

### 4\.3Co\-occurrence Edges

In addition to FCA\-derived vertical edges, we add*co\-occurrence edges*between concept nodes whose chunks co\-appear in retrieval windows with frequency above a thresholdθ\\theta\. The meet/join construction gives upward and downward links; co\-occurrence edges add lateral connectivity that reflects empirical retrieval behaviour\. The resulting graph𝒢=\(V,E\)\\mathcal\{G\}=\(V,E\)has

V=Vseed∪V∨∪V∧,E=Elat∪Ecooc,V=V\_\{\\text\{seed\}\}\\cup V\_\{\\vee\}\\cup V\_\{\\wedge\},\\quad E=E\_\{\\text\{lat\}\}\\cup E\_\{\\text\{cooc\}\},combining FCA\-motivated structure with inductive corpus statistics\.

### 4\.4Fuzzy Routing at Query Time

At retrieval time, a queryqqis mapped to a fuzzy membership vector over the finite concept graph\. For a concept nodevvwith centroids at levelsℓ0,ℓ1\\ell\_\{0\},\\ell\_\{1\}, we first map cosine similarity into\[0,1\]\[0,1\]:

sℓ​\(q,v\)=1\+cos⁡\(e5​\(q\),centroidℓ​\(v\)\)2\.s\_\{\\ell\}\(q,v\)=\\frac\{1\+\\cos\(e\_\{5\}\(q\),\\mathrm\{centroid\}\_\{\\ell\}\(v\)\)\}\{2\}\.\(14\)We then compute query\-concept activation as

μ​\(q,v\)=⨂ℓ\(θℓ→sℓ​\(q,v\)\),\\mu\(q,v\)=\\bigotimes\_\{\\ell\}\\bigl\(\\theta\_\{\\ell\}\\to s\_\{\\ell\}\(q,v\)\\bigr\),\(15\)whereθℓ\\theta\_\{\\ell\}is the activation threshold at levelℓ\\elland⊗\\otimesis the Łukasiewicz t\-norm\. The direction of the residuum makes activation high when similarity exceeds the threshold\. The fuzzy routing score for chunkccvia lattice\-derived nodevvis then

fuzzy\_score​\(q,c\)=μ​\(q,v\)⊗I​\(c,v\)\.\\textsc\{fuzzy\\\_score\}\(q,c\)=\\mu\(q,v\)\\otimes I\(c,v\)\.\(16\)A high score requires both query\-to\-concept alignment*and*chunk\-to\-concept membership; neither condition alone is sufficient\.

### 4\.5Multi\-Query Expansion and Reranking

We generate three LLM query reformulations \- a paraphrase, a decomposed sub\-question, and an entity\-focused variant \- and fuse their hit lists via Reciprocal Rank Fusion\. The top 25 candidates are reranked by an LLM judgement to a top 12\. Score boosts of×1\.2\\times 1\.2and×1\.3\\times 1\.3are applied to cluster\-summary virtual chunks and bridge nodes respectively, without forced slot allocation\.

### 4\.6Cross\-Document Indexing

ContextRAG maintains a single shared index across all documents, with per\-querydoc\_idfiltering at retrieval time\. In our implementation, cross\-document scale is needed to avoid a degenerate concept graph; per\-task indices below roughly 100 chunks were too small to activate bridge nodes reliably\. Per\-task indexing of∼\\sim28 chunks per task \(tested in earlier system iterations\) yielded a 0% bridge\-node hit rate in top\-5 retrieval, motivating the move to cross\-document indexing\.

## 5Experimental Setup

### 5\.1Hardware and Software

All experiments run on a single node with 2×\\timesNVIDIA A100 80GB SXM GPUs, 8 CPU cores, CUDA 12\.4, and Python 3\.11\. The LLM is a local Gemma BF16 checkpoint \(gemma\-4\-26b\-a4b\-itin the run configuration\); embeddings are produced by e5\-large\-v2\(Wanget al\.,[2022](https://arxiv.org/html/2605.19735#bib.bib17)\)\. The multi\-hop subset \(n=77n=77\) consists of MuSiQue, 2WikiMultiHopQA, and HotpotQA\.

### 5\.2Baselines

We use two HiRAG reference points:

- •HiRAG\-Original: numbers reported byHuanget al\.\([2025](https://arxiv.org/html/2605.19735#bib.bib6)\)for the official HiRAG system\. The released repository supports multiple backend paths, including DeepSeek/GLM and OpenAI configurations, so these numbers are used only as cross\-stack efficiency context\.
- •HiRAG\-Gemma stress test: our local Gemma \+ e5\-large\-v2 reproduction attempt\. The available logs contain a 20\-task indexing stress test that fails during graph construction and no completed 130\-task quality run, so we use it only to estimate indexing resource cost\.

### 5\.3Evaluation Metrics

We report token\-level F1 \(normalized and lower\-cased\) on the predicted answer against the gold answer; ROUGE\-L is logged as a diagnostic but is not used for the main claims\. We additionally report indexing time, indexing LLM calls, indexing tokens, index size on disk, average retrieval latency, LLM calls per query, and querying tokens per query\.

## 6Results

### 6\.1Indexing Cost: HiRAG Stress Test vs\. ContextRAG

Table[1](https://arxiv.org/html/2605.19735#S6.T1)separates measured ContextRAG results from the audited HiRAG\-Gemma reproduction stress test\. The HiRAG\-Gemma run completes indexing calls for a 20\-task subset but fails during graph construction, so it does not provide a usable same\-stack quality baseline\. Linear extrapolation of the 20\-task indexing trace to the 130\-task subset gives a stress\-test estimate of 237,938 seconds, 5,655 LLM calls, and 23\.0M indexing tokens\. Against this estimate, ContextRAG uses1043×1043\\timesfewer indexing tokens and188×188\\timesfewer indexing\-time LLM calls\.

Table 1:Indexing\-cost comparison on UltraDomain\. HiRAG 20 is the measured local reproduction stress test on 20 tasks; HiRAG est\. linearly extrapolates indexing cost to 130 tasks\. Ratios compare the 130\-task HiRAG estimate against the measured ContextRAG run\. The HiRAG\-Gemma stress test is not a completed quality baseline\.
### 6\.2Cross\-Stack Comparison

Table[2](https://arxiv.org/html/2605.19735#S6.T2)places these numbers next to HiRAG\-Original\. Because HiRAG\-Original uses a different official stack and the local HiRAG\-Gemma run does not complete a 130\-task quality evaluation, this table is a resource\-context comparison rather than a controlled quality comparison\.

Table 2:Full comparison including HiRAG\-Original \(numbers fromHuanget al\.\([2025](https://arxiv.org/html/2605.19735#bib.bib6)\), Tables 2 and 5\)\.1HiRAG\-Original is included only as cross\-stack efficiency context because the released code supports multiple backend paths\.2HiRAG\-Gemma est\. is a linear indexing\-cost estimate from a 20\-task stress test that failed during graph construction; no direct quality comparison is claimed\.

## 7Activation Analysis: Lattice\-Derived Node Usage

We estimate the contribution of the FCA\-inspired fuzzy graph by partitioning queries according to whether at least one lattice\-derived item \(cluster\-summary virtual chunk or bridge node\) appears in the top\-5 retrieved chunks\. This is not a causal ablation: activated queries may also differ in difficulty or topic\. It is nevertheless a useful diagnostic for whether lattice\-derived nodes enter the LLM context and correlate with answer quality\.

Table 3:Activation analysis for lattice\-derived nodes\. Queries with at least one lattice\-derived node in top\-5 retrieval obtain higher F1 than those without, though the comparison is correlational rather than causal\.Table[3](https://arxiv.org/html/2605.19735#S7.T3)shows a\+3\.9\+3\.9pp F1 difference for queries where lattice\-derived nodes are activated\. The 30% activation rate is consistent with the cross\-document scale requirement: at the smaller per\-task scale \(∼\\sim28 chunks per task\) used in earlier iterations, activation was 0%\. This supports the cross\-document indexing design and indicates that lattice\-derived items are used by the retriever at this corpus scale\.

## 8Discussion

### 8\.1Cluster Occupancy and Effective Hierarchy Depth

We measured a cluster\-occupancy diagnostic at each RQ\-KMeans level \(Table[4](https://arxiv.org/html/2605.19735#S8.T4)\)\. At the 3,705\-chunk UltraDomain subset,L0L\_\{0\}\(96 clusters\) is well\-distributed,L1L\_\{1\}\(24 clusters\) is moderately populated, andL2L\_\{2\}\(12 clusters\) is degenerate \(occupancy 0\.01\)\. The corpus is geometrically well\-covered by 24L1L\_\{1\}clusters, leavingL2L\_\{2\}residuals with near\-zero variance\. ContextRAG therefore operates as an effective two\-level hierarchy at this corpus scale; the low occupancy at the L2 level indicates that for current corpus scales, the hierarchy effectively collapses to two levels, though the theoretical framework supports deeper structures for larger datasets\.

Table 4:Cluster occupancy diagnostic per RQ\-KMeans level on UltraDomain subset\.
### 8\.2Cost\-Regime Analysis

Because the local HiRAG\-Gemma reproduction did not complete a querying run, we avoid claiming a formal query\-count break\-even point\. The supported comparison is the indexing side: ContextRAG uses 22,073 indexing tokens on the 130\-task subset, while the HiRAG\-Gemma stress\-test trace extrapolates to 23,017,780 indexing tokens\. This makes ContextRAG attractive when corpora are updated frequently, indexing budgets are constrained, or the expected query volume per corpus snapshot is modest\. Re\-indexing under HiRAG, triggered by corpus updates or chunking\-strategy changes, repeatedly re\-pays the 23M\-token indexing cost; ContextRAG’s 22K indexing cost is nearly free to repeat\. Because the HiRAG\-Gemma run is not a completed quality baseline, this analysis should be read as a cost\-regime estimate rather than a definitive system comparison\.

### 8\.3Complementary Trade\-off Structure

HiRAG and ContextRAG illustrate a principled architectural trade\-off:

- •HiRAGfront\-loads semantic reasoning into indexing \(entity and relation extraction over the full corpus\), enabling lightweight querying with two LLM calls per query\.
- •ContextRAGuses lightweight graph construction without entity extraction and defers more semantic reasoning to query time via multi\-query rewrite and rerank, using up to five LLM calls per query and 3\.88 calls on average in our run\.

While query latency is higher than the HiRAG numbers used as context, the massive reduction in indexing overhead makes ContextRAG more suitable for dynamic environments where the corpus is updated frequently\. Neither architecture is universally superior; the optimal choice depends on the query\-to\-index ratio of the deployment\. However, the indexing\-cost asymmetry \(23M vs\. 22K tokens\) makes ContextRAG most attractive for low\- and medium\-query workloads, especially when corpora are re\-indexed frequently\.

### 8\.4Theoretical Positioning

Among graph RAG systems, ContextRAG occupies a distinct theoretical niche \(Table[5](https://arxiv.org/html/2605.19735#S8.T5)\)\. Its graph topology is derived from a formally grounded algebraic structure: an FCA\-inspired fuzzy concept graph induced by the fuzzy formal context defined by cluster membership\. The graph is therefore tied to an explicit mathematical construction based on fuzzy Galois connections, while the implementation uses a finite set of seed, soft\-join, and soft\-meet nodes rather than enumerating the complete fuzzy concept lattice\. This removes several failure modes of LLM\-extracted graphs: extraction errors, hallucinated relations, and model\-specific graph topology\.

Table 5:Theoretical positioning of ContextRAG against representative graph RAG systems\.

## 9Conclusion

We presented ContextRAG, a graph\-structured RAG system whose graph\-construction pipeline is extraction\-free\. By combining Residual\-QuantizationKK\-Means with Formal Concept Analysis under Łukasiewicz residuated logic, ContextRAG derives an FCA\-inspired fuzzy graph whose soft join and meet operations produce bridge\-like and meet\-derived context nodes with retrieval roles analogous to LLM\-extracted graph artifacts\. On UltraDomain ContextRAG indexes the 130\-task subset with 30 LLM calls and 22,073 tokens, whereas a local HiRAG\-Gemma stress test extrapolates to over 5,600 calls and 23M indexing tokens before any completed same\-stack quality result is available\. An activation analysis shows a \+3\.9 pp F1 difference when lattice\-derived nodes are retrieved in the top five, an association that remains correlational without a controlled ablation\. ContextRAG therefore provides setting\-specific evidence that extraction\-free graph topology construction is feasible, while also making clear that LLM\-extracted graphs may still provide stronger answer quality\.

## Limitations

Several limitations should be acknowledged\. First, the available HiRAG\-Gemma logs do not contain a completed 130\-task same\-stack quality baseline; therefore, our direct empirical claim is about ContextRAG’s measured cost and quality, while HiRAG\-Gemma is used only as a reproduction stress\-test estimate for indexing cost\. We also do not include a controlled same\-metric no\-graph baseline, so the reported F1 should be interpreted as an absolute measurement rather than evidence that the graph improves over a strong non\-graph retriever\. Applications where multi\-hop quality is paramount and indexing cost is amortized over many queries may still prefer LLM\-extracted graphs\. Second, retrieval latency is higher than the HiRAG numbers used as cross\-stack context \(2\.5 s vs\. 0\.85 s per query\), driven by sequential multi\-query rewrite calls; parallel asynchronous calls or rewrite caching are natural mitigations not yet implemented\. Third, the system effectively operates as a two\-level hierarchy at this size; richer hierarchies likely require either larger corpora or adaptive cluster\-count selection\. Fourth, evaluation is limited to a single benchmark family \(UltraDomain\) and a single local Gemma checkpoint; generalization to other domains and model families remains an empirical question\. Fifth, our experiments use a moderate 3,705\-chunk corpus; the scaling behaviour of the fuzzy graph on substantially larger corpora has not been measured\. Finally, the extraction\-free claim in this paper refers to graph construction, not to every artifact stored in the index: the system still uses 30 LLM calls to generate cluster summaries used as virtual chunks, and we account for these calls in all reported indexing numbers\.

## References

- A\. Babenko and V\. Lempitsky \(2015\)The inverted multi\-index\.IEEE Transactions on Pattern Analysis and Machine Intelligence37\(6\),pp\. 1247–1260\.External Links:[Document](https://dx.doi.org/10.1109/TPAMI.2014.2361319)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px4.p1.1),[§3\.4](https://arxiv.org/html/2605.19735#S3.SS4.p1.5)\.
- R\. Bělohlávek \(2002\)Fuzzy relational systems: foundations and principles\.Kluwer Academic / Plenum Publishers,New York\.Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px3.p1.1),[§3\.2](https://arxiv.org/html/2605.19735#S3.SS2.p1.3),[§3\.2](https://arxiv.org/html/2605.19735#S3.SS2.p1.9)\.
- C\. Carpineto and G\. Romano \(2004\)Concept data analysis: theory and applications\.John Wiley & Sons\.Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px3.p1.1)\.
- D\. Edge, H\. Trinh, N\. Cheng, J\. Bradley, A\. Chao, A\. Mody, S\. Truitt, and J\. Larson \(2024\)From local to global: a graph RAG approach to query\-focused summarization\.arXiv preprintarXiv:2404\.16130\.External Links:[Link](https://arxiv.org/abs/2404.16130)Cited by:[§1](https://arxiv.org/html/2605.19735#S1.p1.1),[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px1.p1.1)\.
- B\. Ganter and R\. Wille \(2024\)Formal concept analysis: mathematical foundations, 2nd edition\.Springer,Berlin, Heidelberg\.External Links:[Document](https://dx.doi.org/10.1007/978-3-642-59830-2)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px3.p1.1),[§3\.1](https://arxiv.org/html/2605.19735#S3.SS1.p1.5)\.
- Y\. Gao, Y\. Xiong, X\. Gao, K\. Jia, J\. Pan, Y\. Bi, Y\. Dai, J\. Sun, M\. Wang, and H\. Wang \(2023\)Retrieval\-augmented generation for large language models: a survey\.arXiv preprintarXiv:2312\.10997\.External Links:[Link](https://arxiv.org/abs/2312.10997)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px2.p1.1)\.
- R\. M\. Gray \(1984\)Vector quantization\.IEEE ASSP Magazine1\(2\),pp\. 4–29\.External Links:[Document](https://dx.doi.org/10.1109/MASSP.1984.1162229)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px4.p1.1),[§3\.4](https://arxiv.org/html/2605.19735#S3.SS4.p1.5)\.
- Z\. Guo, L\. Xia, Y\. Yu, T\. Ao, and C\. Huang \(2024\)LightRAG: simple and fast retrieval\-augmented generation\.arXiv preprintarXiv:2410\.05779\.External Links:[Link](https://arxiv.org/abs/2410.05779)Cited by:[§1](https://arxiv.org/html/2605.19735#S1.p1.1),[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px1.p1.1)\.
- P\. Hájek \(1998\)Metamathematics of fuzzy logic\.Kluwer Academic Publishers,Dordrecht\.External Links:[Document](https://dx.doi.org/10.1007/978-94-011-5300-3)Cited by:[§3\.2](https://arxiv.org/html/2605.19735#S3.SS2.p1.10)\.
- H\. Huang, Y\. Huang, J\. Yang, Z\. Pan, Y\. Chen, K\. Ma, H\. Chen, and J\. Cheng \(2025\)HiRAG: retrieval\-augmented generation with hierarchical knowledge\.arXiv preprintarXiv:2503\.10150\.External Links:[Link](https://arxiv.org/abs/2503.10150)Cited by:[§1](https://arxiv.org/html/2605.19735#S1.p1.1),[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px1.p1.1),[1st item](https://arxiv.org/html/2605.19735#S5.I1.i1.p1.1),[Table 2](https://arxiv.org/html/2605.19735#S6.T2)\.
- V\. Karpukhin, B\. Oğuz, S\. Min, P\. Lewis, L\. Wu, S\. Edunov, D\. Chen, and W\. Yih \(2020\)Dense passage retrieval for open\-domain question answering\.InProceedings of the 2020 Conference on Empirical Methods in Natural Language Processing \(EMNLP\),pp\. 6769–6781\.External Links:[Document](https://dx.doi.org/10.18653/v1/2020.emnlp-main.550)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px1.p1.1)\.
- P\. Lewis, E\. Perez, A\. Piktus, F\. Petroni, V\. Karpukhin, N\. Goyal, H\. Küttler, M\. Lewis, W\. Yih, T\. Rocktäschel, S\. Riedel, and D\. Kiela \(2020\)Retrieval\-augmented generation for knowledge\-intensive NLP tasks\.InAdvances in Neural Information Processing Systems 33 \(NeurIPS 2020\),External Links:[Link](https://arxiv.org/abs/2005.11401)Cited by:[§1](https://arxiv.org/html/2605.19735#S1.p1.1)\.
- L\. Liang, M\. Sun, Z\. Gui, Z\. Zhu, Z\. Jiang, L\. Zhong, Y\. Qu, P\. Zhao, Z\. Bo, J\. Yang, H\. Xiong, L\. Yuan, J\. Xu, Z\. Wang, Z\. Zhang, W\. Zhang, H\. Chen, W\. Chen, and J\. Zhou \(2024\)KAG: boosting LLMs in professional domains via knowledge\-augmented generation\.arXiv preprintarXiv:2409\.13731\.External Links:[Link](https://arxiv.org/abs/2409.13731)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px1.p1.1)\.
- Y\. Matsui, Y\. Uchida, H\. Jégou, and S\. Satoh \(2018\)A survey of product quantization\.ITE Transactions on Media Technology and Applications6\(1\),pp\. 2–10\.External Links:[Document](https://dx.doi.org/10.3169/mta.6.2)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px4.p1.1)\.
- U\. Priss \(2006\)Formal concept analysis in information science\.InAnnual Review of Information Science and Technology,Vol\.40,pp\. 521–543\.External Links:[Document](https://dx.doi.org/10.1002/aris.1440400120)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px3.p1.1)\.
- L\. Wang, N\. Yang, X\. Huang, B\. Jiao, L\. Yang, D\. Jiang, R\. Majumder, and F\. Wei \(2022\)Text embeddings by weakly\-supervised contrastive pre\-training\.arXiv preprintarXiv:2212\.03533\.External Links:[Link](https://arxiv.org/abs/2212.03533)Cited by:[§5\.1](https://arxiv.org/html/2605.19735#S5.SS1.p1.2)\.
- P\. Zhao, H\. Zhang, Q\. Yu, Z\. Wang, Y\. Geng, F\. Fu, L\. Yang, W\. Zhang, J\. Jiang, and B\. Cui \(2024\)Retrieval\-augmented generation for AI\-generated content: a survey\.arXiv preprintarXiv:2402\.19473\.External Links:[Link](https://arxiv.org/abs/2402.19473)Cited by:[§2](https://arxiv.org/html/2605.19735#S2.SS0.SSS0.Px2.p1.1)\.

## Appendix AHyperparameters

Hybrid retrieval weights are fixed at\(αbm25,αcos,αfuzzy\)=\(0\.3,0\.5,0\.2\)\(\\alpha\_\{\\textsc\{bm25\}\},\\alpha\_\{\\cos\},\\alpha\_\{\\textsc\{fuzzy\}\}\)=\(0\.3,0\.5,0\.2\)\. The FCM fuzziness exponent ism=2\.0m=2\.0\. RQ\-KMeans codebook sizes are\|C0\|=96,\|C1\|=24,\|C2\|=12\|C\_\{0\}\|=96,\|C\_\{1\}\|=24,\|C\_\{2\}\|=12\. Multi\-query expansion uses three reformulations fused via Reciprocal Rank Fusion\. The reranker reduces the top\-25 candidate set to the top\-12\. Score boosts on lattice\-derived items are×1\.2\\times 1\.2for cluster\-summary virtual chunks and×1\.3\\times 1\.3for bridge nodes\. Initial retrieval considers the top\-25 candidates per query\.

## Appendix BIndexing Token Breakdown

Table[6](https://arxiv.org/html/2605.19735#A2.T6)reports the measured token usage for ContextRAG indexing and querying on the 130\-task evaluation\. Indexing\-time tokens are spent entirely on the 30 cluster\-summary virtual chunk calls; the graph\-topology construction itself consumes zero tokens\.

Table 6:Token breakdown for ContextRAG\. Counts are measured from the 130\-task UltraDomain run; per\-query averages are rounded\.

Similar Articles

LightRAG: Simple and Fast Retrieval-Augmented Generation

Papers with Code Trending

The article introduces LightRAG, an open-source framework that enhances Retrieval-Augmented Generation by integrating graph structures for improved contextual awareness and efficient information retrieval.

Structure Over Scale: Schema-Constrained Causal Graphs for RAG

arXiv cs.AI

This paper introduces HCG-RAG, which uses schema-constrained causal graphs for retrieval-augmented generation, achieving 3-20x fewer nodes and 8x-135x fewer LLM calls while matching or exceeding baseline answer quality on medical benchmarks.