Source-linked AI summary
Quanta: A Self-Contained Python Library for Hybrid Retrieval over Quantised Embeddings, Lexical Indexes, and Knowledge Graphs
Ioannis E. Livieris
TL;DR
Hybrid retrieval commonly requires independently operated vector, lexical, graph, and document-store systems, creating repeated integration work. Quanta unifies these signals in a Python library using weighted reciprocal rank fusion and graph-based candidate expansion with dense re-scoring. Its clinical deployment characterises substantial candidate enlargement and retrieval cost, but does not establish retrieval superiority against relevance-labelled benchmarks.
Problem
Hybrid retrieval combines complementary dense, lexical, and graph signals but typically requires separately operated systems and project-specific integration logic.
Method
Quanta is a single retrieval library that uses weighted reciprocal rank fusion and lets graph traversal expand candidates while dense indexes re-score admitted documents.
Results
The clinical deployment demonstrates substantial candidate-set enlargement through graph traversal and characterises retrieval behaviour and runtime cost.
Takeaways & Limitations
Structural relationships can widen retrieval coverage without allowing graph proximity to dominate content-based relevance.
Takeaways & Limitations
The reported observations characterise the architecture rather than establish retrieval superiority against controlled relevance-labelled benchmarks and alternative systems.
Abstract
from arXiv · showhide
An advanced retrieval-augmented generation pipeline is typically assembled from three or four independently operated systems: an approximate nearest-neighbour index, a full-text search engine, a graph database, and a relational document store. Each contributes its own deployment surface, configuration model, and failure modes, and the integration logic that binds them is written anew in every project. In this work, we present \textsc{Quanta}, an open-source Python library, which unifies dense vector search over 4-bit quantised embeddings, BM25 full-text retrieval, and knowledge-graph traversal behind a single retrieval API. Quanta makes two design commitments, which distinguish it from existing hybrid retrieval stacks. First, signals are combined by \emph{weighted reciprocal rank fusion} rather than by normalising heterogeneous scores onto a shared range, which we argue is ill-posed because such normalisations are query-dependent. Second, the graph is a \emph{candidate expander and not a relevance scorer}: traversal widens the candidate pool, and the newly admitted documents are re-scored by the dense indexes under an identifier allowlist, so structural adjacency determines what is considered while content evidence determines how it ranks.
1 Introduction
Quanta addresses hybrid retrieval as an integration problem by unifying dense, lexical, and structural retrieval in one Python library. Its central design uses graph traversal to enlarge candidates while content-based signals determine ranking.
- The motivation combines dense retrieval’s vocabulary generalisation, BM25’s coverage of rare tokens, and graph relationships absent from text.
- Quanta targets the integration burden created by separately operating vector, BM25, graph, and document-storage systems and rewriting their orchestration per project.
- Quanta provides a single-process retriever that fuses dense, lexical, and structural evidence over one document store without an external retrieval service.
- The library uses a two-pass procedure in which graph traversal enlarges the candidate set and admitted documents are re-scored by dense indexes through an allowlist.
- The paper reports a clinical knowledge-graph deployment measuring candidate enlargement, fusion behaviour, and retrieval cost.
2 System Architecture
Quanta implements hybrid retrieval through local quantised vector and lexical indexes, optional networked services, weighted rank fusion, and graph-based candidate expansion. Graph traversal changes which documents are considered, while dense and lexical evidence determine their final ranking.
- System Architecture: A deployment combines named vector indexes, a document store, and optional graph, lexical-index, and embedding-cache backends behind one asynchronous SEARCH() entry point.
- System Architecture: Quanta stores 4-bit vectors in-process and searches the quantised representations exactly, reducing storage from 2.86 GiB to 366 MiB for 106 vectors of dimension 768.
- Rank Fusion: The system fuses ranked lists because cosine similarity, BM25, and graph distance produce incommensurable scores.
- Graph Expansion as Candidate Enlargement: Graph expansion admits new identifiers and re-scores them through dense indexes under an allowlist, so the graph determines consideration but not ranking.
- Graph Expansion as Candidate Enlargement: Giving graph distance a positive weight can promote arbitrary one-hop neighbours above the best content match, so Quanta defaults to wgraph = 0 and tunes expansion breadth instead.
- Graph Expansion as Candidate Enlargement: The two-pass algorithm first retrieves content-based seeds, expands them through bounded graph traversal, then performs final rank fusion over the updated lists.
3 Case Study: A Clinical Knowledge Graph
The clinical case study characterises Quanta’s graph-expanded retrieval and agent deployment on a synthetic hospital knowledge graph. Expansion substantially enlarges candidates, while constrained re-scoring preserves content-based ranking and retrieval remains small relative to generation latency.
- 3.1 Corpus and Ontology: The corpus contains synthetic hospital records and authored COMORBID_WITH and INTERACTS_WITH edges that encode relationships absent from document text.The deployment includes patients, physicians, diagnoses, procedures, medications, hospitals, and nine relationship types.
- 3.2 Retrieval Behaviour: The candidate pool grew roughly 3.3×, from 18 dense-retrieved identifiers to 50 after two-hop traversal, with about 70% of new candidates receiving similarity scores.Three seeds produced 41–42 new nodes, and no score originated from the graph.
- 3.2 Retrieval Behaviour: For the heart-failure query, graph expansion admitted E11, whose fused score rose from 0.0046 to 0.0071 and rank improved from sixth to fourth.The graph determined that E11 warranted consideration, while dense similarity determined its final ranking.
- 3.2 Retrieval Behaviour: Dense and dense-plus-BM25 searches completed in 7–9 ms, whereas enabling graph expansion increased query time to 44–115 ms.The case study reports runtime behaviour rather than relevance superiority because it uses no relevance judgements or baseline ranker.
- 3.3 Agent Deployment: In the tool-using agent, tool execution took 19–984 ms while complete turns took 19–32 seconds, with generation dominating latency at under five percent for tool execution.Six unseen clinical questions were answered without error by a local open-weight 27B model.
- 3.3 Agent Deployment: An English referral question matched a Greek nephrology narrative at cosine 0.620, demonstrating cross-lingual matching after four-bit quantisation.The deployment also uses the same allowlist mechanism for cohort-restricted similarity and graph-expanded re-scoring.
4 Conclusion
Quanta unifies semantic, lexical, and structural retrieval in a lightweight Python library by separating candidate generation from relevance estimation. Its deployment observations illustrate operational behaviour, but do not establish retrieval superiority against relevance-labelled benchmarks or alternative rankers.
- 4 Conclusion: Quanta combines semantic, lexical, and structural signals in a minimal-dependency Python library while using graph traversal primarily for candidate expansion.Semantic and lexical evidence remains responsible for ranking retrieved documents.
- 4 Conclusion: Four-bit quantised indexes provide memory-efficient dense retrieval, while identifier allowlists support constrained search and graph-expanded candidate re-scoring without a separate ANN service.The same retrieval primitive supports metadata-constrained search and re-scoring.
- 4 Conclusion: The clinical deployment characterises candidate enlargement, retrieval behaviour, and runtime cost, but does not establish retrieval superiority against relevance-labelled benchmarks or alternative hybrid rankers.A controlled evaluation remains an important direction for future work.