BRAG: Bayesian Retrieval Augmented Generation
Organizations: Apple
Abstract
Retrieval-augmented generation (RAG) ranks memory chunks by semantic similarity to the query. Many methods improve on this by learning from feedback on what was retrieved, but each is a separate heuristic, with no account of when it is the right choice. We introduce BRAG, a generative model of retrieval with use. Each chunk generates the queries it answers from a mixture of von Mises-Fisher components anchored at its original embedding, and each chunk has a latent utility that drifts over time. The model gives the optimal inference, a closed-form filter that stores a few keys and two scalars per chunk and updates them online from the labels of a curator, and it frames retrieval as a control problem. It also shows when existing methods are optimal. Query averaging, Rocchio-style feedback and frequency reranking are special cases with fixed parameters, NUDGE is the case of one key per chunk with no dynamics, and LADER the limit of one key per past query. On two public long-term memory benchmarks, BRAG matches these methods on queries asked before, as expected, because when nothing changes over time the assumptions behind these special cases hold. On harder problems, where a new chunk makes an old one obsolete, BRAG outscores them. They all stay at plain-search level (Recall@5 0.67-0.71), while BRAG retrieves the new chunk 0.80-0.86 of the time. We also ran BRAG on three of NUDGE's seven text benchmarks, and it matches or beats NUDGE on all three. On nine months of a personal agent's memory (20,640 chunks), BRAG raises Recall@5 on held-out queries from 0.75 to 0.98 and Recall@1 from 0.44 to 0.97, with little change on chunks never queried.
Figures & tables
| Held-out | Control | ||||
|---|---|---|---|---|---|
| Condition | Recall@1 | Recall@5 | Avg. rank | Recall@5 | Avg. rank |
| RAG | 0.438 | 0.747 | 9.49 | 0.669 | 17.4 |
| Priming | 0.607 | 0.871 | 6.89 | 0.666 | 17.9 |
| Keys | 0.942 | 0.976 | 3.06 | 0.669 | 17.6 |
| BRAG | 0.969 | 0.977 | 3.01 | 0.661 | 18.3 |
| Facts unchanged | A new chunk obsoletes an old one | New ranked above old | ||||||
|---|---|---|---|---|---|---|---|---|
| Method | LME-M asked again | PMv2 asked again | PMv2 never asked | LME-M update | PMv2 forget | Average | LME-M | PMv2 |
| Plain search | 0.697 | 0.426 | 0.444 | 0.711 | 0.673 | 0.590 | 0.528 | 0.236 |
| Regularized centroid | 0.852 | 0.660 | 0.354 | 0.711 | 0.673 | 0.650 | 0.306 | 0.236 |
| Rocchio | 0.858 | 0.661 | 0.390 | 0.711 | 0.669 | 0.658 | 0.047 | 0.007 |
| Historical-query cache | 0.854 | 0.661 | 0.307 | 0.711 | 0.669 | 0.640 | 0.047 | 0.005 |
| Recency rerank | 0.856 | 0.583 | 0.083 | 0.715 | 0.022 | 0.452 | 0.553 | – |
| NFCorpus | FEVER | NQ | |
|---|---|---|---|
| No fine-tuning | 0.336 | 0.812 | 0.212 |
| NUDGE-M | 0.409 | 0.950 | 0.386 |
| NUDGE-N | 0.457 | 0.935 | 0.459 |
| BRAG | 0.462 | 0.963 | 0.474 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| LongMemEval-M | PersonaMem-v2 | |||||
|---|---|---|---|---|---|---|
| Embedder | Plain | BRAG | Gain | Plain | BRAG | Gain |
| nomic-embed-text-v1.5 | 0.697 | 0.859 | [ , ] | 0.424 | 0.653 | [ , ] |
| Qwen3-Embedding-8B | 0.679 | 0.866 | [ , ] | 0.455 | 0.698 | [ , ] |
| Method | Gold labels | LLM labels | Change |
|---|---|---|---|
| Rocchio | 0.669 | 0.490 | [ , ] |
| Historical-query cache | 0.668 | 0.484 | [ , ] |
| NUDGE-M | 0.663 | 0.485 | [ , ] |
| NUDGE-N | 0.669 | 0.497 | [ , ] |
| LADER | 0.664 | 0.493 | [ , ] |
| Keys only | 0.665 | 0.498 | [ , ] |
| Candidates | Method | HEAD | TORSO | TAIL |
|---|---|---|---|---|
| 20 | BRAG+ | 0.311 | 0.303 | 0.308 |
| LADER | 0.306 | 0.316 | 0.322 | |
| BRAG+ LADER | [ , ] | [ , ] | [ , ] | |
| 100 | BRAG+ | 0.328 | 0.306 | 0.307 |
| LADER | 0.353 | 0.325 | 0.337 | |
| BRAG+ LADER | [ , ] | [ , ] | [ , ] |
| Parameter | Value | Description |
| Belief filter | ||
| 0.85 | Prior expected utility (new chunk) | |
| 10 | Prior pseudo-count | |
| 13 | vMF concentration | |
| 0.9923 | Retention per day ( , i.e. 90-day half-life) | |
| 0.12 | Equilibrium utility | |
Retrieval-Augmented Generation
Retrieval-augmented generation connects language models to external knowledge so answers can use current, domain-specific evidence.
See all 847 papers