Build · 3 min read

Inside Quantum-RAG: The Retrieval Half of RAG, Built Piece by Piece

A small Python library for chunking, embedding and searching documents — with quantum-inspired experiments kept clearly to one side.

Retrieval-augmented generation has two halves: find the right passages, then let a language model answer with them. Quantum-RAG focuses on the first half — split documents into chunks, embed them, search for relevant passages, and assemble context for an LLM.

Quantum-RAG usage code
Index a document, search it, get context.

The pipeline

Document → chunking → embeddings → vector store
                                     ↑
Query → query embedding → ranked passages → LLM context

The public RAG entry point connects three modules: chunker.py, embedder.py and vector_store.py. Generation is kept separate from retrieval.

from quantum_rag import RAG

rag = RAG()
rag.add_document("Semantic retrieval uses embeddings to find relevant passages.")

for result in rag.search("How are relevant passages found?", top_k=3):
    print(result["score"], result["text"])

context = rag.get_context("How are relevant passages found?")

About the “quantum” part

The quantum-inspired components — complex embeddings, similarity, density and fusion — live in their own experimental folder. The default RAG entry point uses conventional embedding and vector-store modules and does not wire those experiments in. This is quantum-inspired software; no quantum hardware is involved.

Adapted from the project write-up. See the code and full details on GitHub ↗