ZeroRAG: Adaptive Semantic Peer Routing for Decentralized Retrieval-Augmented Generation
Petru Neague, Quinten Stokkink, Martijn de Vos, Rafael Pires, Mathis Randl, Anne-Marie Kermarrec, Johan Pouwelse
cs.DC, cs.AI, cs.IR, cs.NI
2026-11-05
ZeroRAG routes queries with neighbor ads and a cache of recent queries, reaching 93% recall and 77% answer accuracy on PubMedQA against 97.3% and 79% for centralized HNSW.
RAG fetches documents for a query and places them in the prompt, so the LLM answers from evidence. Standard systems embed chunks into one central vector index. That breaks when a hospital, a lab, or a rights holder cannot give up custody or allow copies onto arbitrary machines.
Decentralized retrieval usually puts a coordinator back in charge of which collection to ask, or it maintains a DHT (a distributed hash table) or a global semantic tree that the whole network must repair as peers and documents change. Kademlia can bound lookup hops because it owns a global address space. ZeroRAG, from TU Delft and EPFL, drops that shared structure. Documents stay with their owners. Each peer forwards a query using only state it keeps locally.
Every peer stores four things: its documents, a capped neighbor list, advertisements from those neighbors, and a cache of queries it has recently routed. An advertisement is a document vector the owner chooses to expose. Cosine similarity is the relevance score. The experiments assume every peer runs the same sentence encoder, all-mpnet-base-v2, so vectors from different peers can be compared.
Search is a best-first walk on a contact budget. The issuer keeps a list of peers still to visit, ranked by estimated relevance, and always contacts the top one with the query vector and the hit count k. The receiver returns its local top-k document vectors plus a handful of referrals, scored from neighbor advertisements and from the query cache. It then stores the issuer and the query, dropping the oldest entry when the cache is full. The issuer merges the hits and pushes referrals back onto the list. Contacts stop at C. Experiments set C to 50.
After the walk, the issuer adds a directed edge to the peer that returned the best document and, if the neighbor list is full, drops the oldest edge. One query rewires at most one edge, which limits advertisement traffic. The routing picture is close to BGP: there is no global directory, and the next hop is whatever local tables have learned from traffic.
The cache records who recently asked something similar. Those peers are likely to sit near the right documents, or to hold them. Eviction follows join order. Peers do not keep a usefulness score per edge.
Moving the raw document is outside the protocol. After a vector match, the issuer pulls text from the owner, who can refuse. Advertisements, query vectors, and referrals still leak interests, so this is not private retrieval.
The evaluation replays events in simulation. AOL-IA keeps the 10,000 most active users and about 2.17 million queries; a hit means finding the clicked document, ignoring anything the issuer already stores. Amazon Electronics has about 63,000 products and queries built from category paths. PubMedQA has 1,000 yes/no/maybe items, each with five GPT-5-nano rephrasings, and defaults to 50,000 peers with 30 documents each, 1.5 million queries. The decentralized baselines are Semantica and DHT-LSH. Answers come from Phi-3.5-mini-instruct at k=5. Centralized HNSW is the ceiling.
| Metric | ZeroRAG | Comparison |
| AOL-IA last-batch recall@1 | 0.91 | DHT-LSH L=50/20/10: 0.80/0.56/0.41; Semantica: 0.65 |
| Return messages per query, 10k peers | 50 | DHT-LSH about 664 |
| Amazon fraction of relevant products | 94.8% to 98.9% | L=50/20/10: 90.3% to 91.7%, 62.1% to 70.0%, 42.5% to 50.3%; Semantica 66.7% in the largest bin, 41.7% to 52.9% otherwise |
| PubMedQA top-5 recall and answer accuracy, 50k peers | 93.0% and 77% | HNSW: 97.3% and 79% |
| Contacts to the best supporting document once organized | 99% of queries within 13 | HNSW contact counts not reported |
| After 50% of peers drop at once | Final-slice recall@1 returns to 95.5% | Requests to the target rise from 8.9 to 15.1 |
| Routing recall@1, cache size 0 vs 1000 | 77.9% vs 99.65% | Mean requests 16.8 vs 3.45 |
| Routing recall@1 at 100k peers, final 10% | 99.913% | Mean 5.72 requests; only targets some remote peer advertises |
Those recalls are not one number. AOL recall@1, and the routing recall@1 in the cache and scale rows, ask whether a designated document was found. The 93.0% row is top-5 coverage of relevant material, then yes/no/maybe accuracy from the LLM. ZeroRAG's end-to-end curves rise as queries accumulate. HNSW stays flat and stops at 97.3% recall because original questions and their rephrasings do not embed cleanly enough for the right document to always enter the top 5. On one machine the longest HNSW queries take about 24 ms and ZeroRAG about 379 ms, with network delay left out. C=50 is a cap. The smaller averages in the table count only until the target is found, so most queries never spend the full budget.
The paper summarizes 50 return messages against about 664 as roughly one tenth of the overhead. At L=50 the largest DHT bucket still holds 25% of the documents. Semantica advertises one averaged vector per peer; ZeroRAG advertises several raw vectors. Stripping query memory drops AOL-IA average recall@1 from 0.89 to 0.85. Freezing the topology stays close to the full system, but the paper gives no separate point estimate. Raising the neighbor cap from 3 to 100 moves routing recall from 98.6% to 99.7% and cuts requests from 6.2 to 3.3.
A held-out topic, Peptostreptococcus, with 10 documents, is inserted at 60% of the run. With 10 or more initial owners, recall@10 reaches 1 almost immediately. A single owner spreads slowest. A document shows up in other local stores only after some query actually reaches it.
If documents cannot enter a central index, a bounded number of contacts buys recall near that index. One query talks to at most C peers. It does not fan out across the network to find a single document. At 100,000 peers, an advertised target takes 5.72 requests on average.
The step forward is incremental. Semantic neighbors help little when collections look alike, and the working assumption is a heterogeneous network. Every peer must share one embedding model. Document transfer, signatures, and access control sit outside the protocol.
Answer accuracy only checks the PubMedQA label. Citation quality is unmeasured, and so is any drop in hallucinations. Sybil attacks, eclipse attacks, result poisoning, and black holes are outside the experiments. No global index means no hop bound. Once neighbor slots are full, an edge added for the current query evicts an older neighbor that may still serve other interests, so the topology does not settle when interests outnumber slots.
The simulation is easier than a real deployment. Vectors sit in one shared memory and messages are RPCs, so the headline metrics omit wide-area delay. AOL-IA forbids a local lookup first. Amazon queries are flattened category paths, which repeat and favor the cache. PubMedQA interests come from a sharply peaked distribution, and the homogeneous case is not reported. The 99.9% figure at 100,000 peers drops any query whose target nobody advertises. DHT-LSH uses bucket width 3, not the more common 4, because width 4 put 44.7% of AOL-IA documents in a single bucket, and that baseline was run once. Access control is argued, not implemented. The overlay is permissioned, so a new peer does not join freely.