HackerPapers

arXiv:2005.11401cs.CL

Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, Douwe Kiela

Abstract

Large pre-trained language models have been shown to store factual knowledge in their parameters, and achieve state-of-the-art results when fine-tuned on downstream NLP tasks. However, their ability to access and precisely manipulate knowledge is still limited, and hence on knowledge-intensive tasks, their performance lags behind task-specific architectures. Additionally, providing provenance for their decisions and updating their world knowledge remain open research problems. Pre-trained models with a differentiable access mechanism to explicit non-parametric memory can overcome this issue, but have so far been only investigated for extractive downstream tasks. We explore a general-purpose fine-tuning recipe for retrieval-augmented generation (RAG) -- models which combine pre-trained parametric and non-parametric memory for language generation. We introduce RAG models where the parametric memory is a pre-trained seq2seq model and the non-parametric memory is a dense vector index of Wikipedia, accessed with a pre-trained neural retriever. We compare two RAG formulations, one which conditions on the same retrieved passages across the whole generated sequence, the other can use different passages per token. We fine-tune and evaluate our models on a wide range of knowledge-intensive NLP tasks and set the state-of-the-art on three open domain QA tasks, outperforming parametric seq2seq models and task-specific retrieve-and-extract architectures. For language generation tasks, we find that RAG models generate more specific, diverse and factual language than a state-of-the-art parametric-only seq2seq baseline.

arXiv comments
Accepted at NeurIPS 2020
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.LGMachine Learning

On Hacker News

Linked by 16 identifiable commenters in 16 comments across 15 threads, from Jan 2023 to Jul 2026. Found in 4 HN submissions from Mar 2021 to May 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments15 threads

    • Don't blame me, blame the people who invented the concept and wrote the original RAG paper. https://arxiv.org/pdf/2005.11401

      seanhunterView on HNParent context

    • I think the key quote is: >"Claude's extensive context window has also transformed their approach to handling large codebases. When the 200K context window was released, Hedley notes they "ripped out the entire RAG and just put it in the context window instead and it went from…

      peter_d_shermanView on HNParent context

    • Ragdoll is based on RAG - the knowledge is scoped to documents you define, and is uncensored, even if the model you're using has censorship. For example, if you provided some raunchy URLs as Lara Croft's source of knowledge, you could have realistic conversations about the…

      _akheView on HNParent context

    • Sometimes the terminology is around but not well distributed. I'm not sure this is the paper that coined it, but here's an example from 2020: https://arxiv.org/abs/2005.11401

      regularfryView on HNParent context

    • Yeah that's a fairly well studied one. Most of these techniques are rather "lossy" compared to extending the context window. The most likely "real solution" is going to be using various tricks and finetuning on higher context lengths to just extend the context window. Here's a…

      filterfiberView on HNParent context

    • > You could just sum it up for us all rather than do a divert to your blog? Why? Have links gone out of fashion? I even linked directly to the relevant section rather than linking to the top of the page. The paper that coined the term used the hyphen, though I think I prefer it…

      simonwView on HNParent context

  1. RAG is a hack 1 comment
    • Because "RAG" is shorter than "use a vector db/embeddings coupled with LLM to generate better answers" But better answer: "retrieval augmented" has been used in papers since at least 2018 [1], the full "RAG" acronym since at least 2020 [2], and it was recently repopularized when…

      sprobertsonView on HNParent context

    • Research: https://arxiv.org/abs/2005.11401 An implementation on Hugging Face: https://huggingface.co/docs/transformers/model_doc/rag

      ingridpanView on HNParent context

    • this concept already exists and is in practice at many companies that require knowledge driven results. https://arxiv.org/abs/2005.11401

      chankView on HNParent context

    • This idea is a simplified version of Retrieval-Augmented Generation (RAG), and RAG has been studied in various research papers, such as the one available at https://arxiv.org/abs/2005.11401

      lqhlView on HNParent context

    • I was taken aback by the terminology too. Isn’t Retrieval-Augmented Generation the standard nomenclature for this pattern? https://arxiv.org/abs/2005.11401

      nonfamousView on HNParent context

  2. 100K Context Windows 2 comments
    • This more or less is already a thing and it's called RAG [1][2]. It essentially allows you to have a database of embeddings (in this case your book) from which a model can pull knowledge from while producing answers. As for the standard operation of these generative models, the…

      pyth0View on HNParent context

    • Pretty sure it's not "real" (model) context width. Another wide context model is MosaicML's MPT-7B-StoryWriter-65k+ which they are describing as having a context width of 65k, but then give a bit more detail to say they are using ALiBi - a type of positional encoding that allows…

      HarHarVeryFunnyView on HNParent context

    • There was a 2020 paper called Retrieval Augmented Generation that describes this technique too [1]. That paper used BERT embeddings which are a little cheaper and uses BART as a generator. One of the common failure modes of RAG (and I assume your technique as well) is…

      salamoView on HNParent context

  3. Wolfram Alpha and ChatGPT 1 comment
    • Thats true for the physics and math but some of the things are updated all the time. For example you can get a current weather report. And they have structured data about movies, TV shows, music, and notable people [1]. Every time any country has an election you’re going to…

      janalsncmView on HNParent context

Submitted to Hacker News

  • Show HN: I made a better Perplexity for developers

    Hi HN, I am Jiayuan, and I'm here to introduce a tool we've been building over the past few months: Devv (https://devv.ai). In simple terms, it is an AI-powered search engine specifically designed for developers. Now, you might ask, with so many AI search engines already available—Perplexity, You.com, Phind, and several open-source projects—why do we need another one? We all know that Generative Search Engines are built on RAG (Retrieval-Augmented Generation)[1] combined with Large Language…

  • Show HN: Devv – AI search engine for devs, built on a custom search index

    Hi HN, I am Jiayuan, and I'm here to introduce a tool we've been building over the past few months: Devv (https://devv.ai). In simple terms, it is an AI-powered search engine specifically designed for developers. Now, you might ask, with so many AI search engines already available—Perplexity, You.com, Phind, and several open-source projects—why do we need another one? We all know that Generative Search Engines are built on RAG (Retrieval-Augmented Generation)[1] combined with Large Language…

  • RAG: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Connected through shared HN threads, not inferred similarity or a recommendation.