Modern AI systems rely on fast, accurate document retrieval at every step — from answering questions to generating responses grounded in real knowledge. Yet today's best retrieval methods treat text as flat numerical coordinates, ignoring the richer geometry that quantum mechanics provides. We present QuantumRAG: a system that maps neural text embeddings into complex quantum states in Hilbert space and retrieves documents using quantum fidelity — a similarity measure that captures both the magnitude and the phase (orientation angle) of semantic meaning. Built on BERT-projected quantum encoding (8 qubits, 256-dimensional Hilbert space) with a Fisher discriminant category mask, QuantumRAG achieves P@1=0.698 and NDCG@10=0.825 on the MATH benchmark (12,500 problems, 7 categories, 500 test queries), matching BERT-cosine accuracy while running 3.6× faster (8.4 ms vs 29.9 ms per query). The system is modality-agnostic: the same quantum backbone retrieves mathematics, natural language documents, and video content without any architectural changes. A Grover-inspired Quantum Amplitude Amplification (QAA) reranker provides a secondary scoring pass using quantum interference principles. All experiments run on standard CPU hardware — no quantum computer required. QuantumRAG serves as the universal retrieval backbone for a multi-modal AI pipeline spanning gesture recognition, mathematical reasoning, and document question answering — demonstrating that quantum-projected representations are a practical, deployable alternative to classical similarity search today, with a clear scaling path as quantum hardware matures.
Modern AI systems rely on fast, accurate document retrieval at every step — from answering questions to generating responses grounded in real knowledge. Yet today's best retrieval methods treat text as flat numerical coordinates, ignoring the richer geometry that quantum mechanics provides. We present QuantumRAG: a system that maps neural text embeddings into complex quantum states in Hilbert space and retrieves documents using quantum fidelity — a similarity measure that captures both the magnitude and the phase (orientation angle) of semantic meaning. Built on BERT-projected quantum encoding (8 qubits, 256-dimensional Hilbert space) with a Fisher discriminant category mask, QuantumRAG achieves P@1=0.698 and NDCG@10=0.825 on the MATH benchmark (12,500 problems, 7 categories, 500 test queries), matching BERT-cosine accuracy while running 3.6× faster (8.4 ms vs 29.9 ms per query). The system is modality-agnostic: the same quantum backbone retrieves mathematics, natural language documents, and video content without any architectural changes. A Grover-inspired Quantum Amplitude Amplification (QAA) reranker provides a secondary scoring pass using quantum interference principles. All experiments run on standard CPU hardware — no quantum computer required. QuantumRAG serves as the universal retrieval backbone for a multi-modal AI pipeline spanning gesture recognition, mathematical reasoning, and document question answering — demonstrating that quantum-projected representations are a practical, deployable alternative to classical similarity search today, with a clear scaling path as quantum hardware matures.
Abstract Modern AI systems rely on fast, accurate document retrieval at every step — from answering questions to generating responses grounded in real knowledge. Yet today's best retrieval methods treat text as flat numerical coordinates, ignoring the richer geometry that quantum mechanics provides. We present QuantumRAG : a system that maps neural text embeddings into complex quantum states in Hilbert space and retrieves documents using quantum fidelity — a similarity measure that sees both the magnitude and the phase (orientation angle) of semantic meaning. On the MATH benchmark (12,500 problems, 7 categories, 500 test queries), Quantum Q-CSD achieves P@1 = 0.698 and NDCG@10 = 0.825, matching BERT-cosine accuracy while running 3.6× faster (8.4 ms vs 29.9 ms per query). The system is modality-agnostic: the same quantum backbone retrieves mathematics, natural language documents, and video content without any architectural changes. All experiments run on standard CPU hardware — no quantum computer required.
Text embeddings are central to modern information retrieval and Retrieval-Augmented Generation (RAG). While dense models derived from Large Language Models (LLMs) dominate current practice, recent work has explored quantum-inspired alternatives motivated by the geometric properties of Hilbert-like spaces and their potential to encode richer semantic structure.
This paper presents an experimental framework for constructing quantum-inspired 1024-dimensional document embeddings based on overlapping windows and multi-scale aggregation. The pipeline combines semantic projections (e.g., EigAngle), circuit-inspired feature mappings, and optional teacher-student distillation, together with a fingerprinting mechanism for reproducibility and controlled evaluation.
We introduce a set of diagnostic tools for hybrid retrieval, including static and dynamic interpolation between BM25 and embedding-based scores, candidate union strategies, and a conceptual alpha-oracle that provides an upper bound for score-level fusion.
Experiments on controlled corpora of Italian and English documents across technical, narrative, and legal domains, using synthetic queries, show that BM25 remains a strong baseline, teacher embeddings provide stable semantic structure, and standalone quantum-inspired embeddings exhibit weak and unstable ranking signals. Distillation yields mixed effects, improving alignment in some cases but not consistently enhancing retrieval performance, while hybrid retrieval can recover competitive results when lexical and embedding-based signals are combined.
Overall, the results highlight structural limitations in the geometry of quantum-inspired embeddings, including distance compression and ranking instability, and clarify their role as auxiliary components rather than standalone retrieval representations.
Retrieval-Augmented Generation (RAG) improves LLM factual accuracy via external retrieval, but existing frameworks rely on cosine similarity, leaving quantum overlap-based measures such as fidelity largely unexplored. QF-RAG is a hybrid quantum-classical retrieval architecture that estimates Quantum Fidelity Similarity (QFS) between amplitude-encoded embeddings via a Swap Test. Because fidelity equals squared cosine similarity for real unit vectors, QFS is fundamentally a score transformation, and we evaluate it entirely on real, handauthored text rather than synthetic vectors: 63 factual passages across 16 real-world topics (paraphrases, hard negatives, and noise documents) and 42 queries (standard, ambiguous, multihop), embedded with real TF-IDF vectors that are mean-centered so cosine similarity can take negative values, as dense embeddings do in practice. On this real corpus, 69.9% of query-document cosine similarities are negative, yet cosine and exact QFS agree on the Top-1 result for every query and produce identical Precision@5, Recall@5, MRR, and nDCG@5 to three decimal places, confirming that QFS preserves cosine's ranking quality on real text. With sufficient Swap Test shots, QFS recovers this same ceiling: MRR reaches 0.951 byS=1024and 1.000 at the exact-fidelity limit, tracking the expectedO(1/S)estimator convergence. A retrieval-to-generation test on the same real passages shows retrieval quality causally propagating to answer accuracy (93.8% at k=1). We further complement asymptotic complexity analysis with numbers computed and measured endto- end in code: an unoptimized amplitude-encoding synthesis needs O(d2) CNOT gates (349,525 atd=768), and we verify a tighter O(d) optimized bound (1,022), with exact memory accounting and a measured, extrapolated simulator runtime of 19.6 s per pair for state preparation atd=768, dropping to 0.057 s with the optimized construction. QF-RAG is positioned as a rigorously specified, empirically evaluated hybrid architecture and evaluation framework for bringing quantum overlap measures into RAG retrieval, with a clear, quantified resource profile for near-term hardware.
We demonstrate how word and text embeddings as n-dimensional real vectors used in classical Natural Language Processing (NLP)/AI applications can be mapped to quantum states or quantum embedding representations in Quantum Applications using NLP and AI. Models like fastText [1], [2], GloVe [3], Numberbatch [4], or BERT [5] are common NLP embedding vectors or models that encode semantic properties of words or text fragments. We use these models to evaluate mapping properties and compression rate, as well as information preservation in quantum embeddings. For mapping embedding vectors to quantum states, we use encoding strategies, such as Amplitude Encoding. The encoding strategies allow us to map large dense vectors from the embedding models to compact quantum states using different compression ratios. The compression with Amplitude Encoding can be2ntoN, resulting in a mapping of a 1,024-dimensional vector of reals in the classical environment to a 10-qubit state. The goal of this work is to evaluate these strategies with respect to their compression ratio and measure the preservation of semantic information using similarity scores. We show that the resulting quantum embeddings based on mapped classical computing embeddings exhibit the same relational properties and that there is no significant loss of semantic information in the conversion from classical n-dimensional real vector embeddings to qubit states. We conclude that the experimental results allow us to quantum compute semantic similarities of words or text, reusing existing and freely available embedding models from classical NLP/AI computing.
Over the last decade, representation learning, which embeds complex information extracted from large amounts of data into dense vector spaces, has emerged as a key technique in machine learning. Among other applications, it has been a key building block for large language models and advanced computer vision systems based on contrastive learning. A core component of representation learning systems is the projection head, which maps the original embeddings into different, often compressed spaces, while preserving the similarity relationship between vectors. In this paper, we propose a quantum-inspired projection head that includes a corresponding quantum-inspired similarity metric. Specifically, we map classical embeddings onto quantum states in Hilbert space and introduce a quantum circuit-based projection head to reduce embedding dimensionality. To evaluate the effectiveness of this approach, we extended the BERT language model by integrating our projection head for embedding compression. We compared the performance of embeddings, which were compressed using our quantum-inspired projection head, with those compressed using a classical projection head on information retrieval tasks using the TREC 2019 and TREC 2020 Deep Learning benchmarks. The results demonstrate that our quantum-inspired method achieves competitive performance relative to the classical method while utilizing 32 times fewer parameters. Furthermore, when trained from scratch, it notably excels, particularly on smaller datasets. This work not only highlights the effectiveness of the quantum-inspired approach but also emphasizes the utility of efficient, ad hoc low-entanglement circuit simulations within neural networks as a powerful quantum-inspired technique.
While having enhanced NLP, deep learning and pre-trained language models requires a lot of processing power.The work showcases the potential of quantum computing by mapping linguistic data into vast, high-dimensional Hilbert spaces through entanglement and superposition.It focuses on mathematical concepts that set quantum approaches apart from classical ones, among them being the fidelity-based similarity and quantum probability.Various quantum machine learning models are considered in this article, including Quantum Neural Networks and Quantum Support Vector Machines, each discussing the computational advantages in pattern recognition.In addition, it considers retrieval techniques like Grover's algorithm, showing how quantum similarity functions give better semantic search.Indeed, the comparison does show that quantum techniques might yield advantages regarding expressiveness and scalability, despite obstacles such as hardware noise and data encoding.Notwithstanding that quantum technology is still in its infancy, future improvements might advance language understanding.