Quantum Memory Graph (QMG)
Quantum-enhanced long-term memory for AI agents. Uses chunked gte-large embeddings for state-of-the-art retrieval with quantum subgraph optimization.
Features
- #1 on LongMemEval — 98.6% R@5, 99.4% R@10, 0.9426 NDCG
- Chunked retrieval — 500-char blocks with 100-char overlap, mean-of-top-3 per session
- QAOA+CVaR optimization — 12.8% edge over greedy on graph/PCE tasks
- GPU accelerated — runs on NVIDIA GB10 (DGX Spark)
How It Works
- Sessions are split into overlapping 500-char chunks
- Chunks encoded with gte-large (1024-dim sentence transformer)
- Per-session score = mean of top-3 chunk cosine similarities
- Top-N candidates refined via QAOA+CVaR subgraph optimizer
Performance
| Metric | Score |
|---|---|
| R@1 | 90.6% |
| R@5 | 98.6% |
| R@10 | 99.4% |
| NDCG | 0.9426 |
Usage
from quantum_memory_graph import MemoryGraph
mg = MemoryGraph()
results = mg.retrieve("What degree did I graduate with?", top_k=5)
The system retrieves the most relevant conversation sessions using semantic chunk embeddings, then optionally refines the selection using quantum-inspired QAOA optimization.
Requirements
- Python 3.10+
- sentence-transformers
- numpy
- (optional) qiskit for QAOA optimization
License
MIT
