Concept
Retrieval-augmented generation
Answering with a model that is handed relevant passages, found by search over a document store, together with the question.
An open-book exam instead of a closed-book one: before answering, the model is handed the pages that look relevant.
How it works
Documents are cut into passages and indexed, by keywords or by numerical representations of their meaning. When a question arrives, a retriever finds the passages that best match it, they are placed in the prompt next to the question, and the model answers using them. Lewis and colleagues (2020) combined a pre-trained language model, which holds knowledge in its parameters, with an explicit memory, a vector index of Wikipedia read by a trained retriever. They argued that this helps with two open problems: showing where an answer came from, and updating what the system knows without retraining it.
Where it misleads
The retriever can miss the one passage that matters, and the model can ignore or misread what it is given. Position matters too: Liu and colleagues (2024) found that models often do best when the relevant information is at the beginning or end of a long input and degrade significantly when it sits in the middle, so adding more passages is not always better. The quality of the answer is capped by the quality of the document store.
Sources
- Lewis, P. et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS 2020.
- Liu, N. F. et al. (2024). Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics 12, 157–173.
Relations
- related to