{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/realm-retrieval-augmented-language-model-pre","title":"REALM: Retrieval-Augmented Language Model Pre-Training","arxiv_id":"2002.08909","date":"2020-02-10","proceeding":null,"authors":["Kelvin Guu","Kenton Lee","Zora Tung","Panupong Pasupat","Ming-Wei Chang"],"abstract":"Language model pre-training has been shown to capture a surprising amount of world knowledge, crucial for NLP tasks such as question answering. However, this knowledge is stored implicitly in the parameters of a neural network, requiring ever-larger networks to cover more facts. To capture knowledge in a more modular and interpretable way, we augment language model pre-training with a latent knowledge retriever, which allows the model to retrieve and attend over documents from a large corpus such as Wikipedia, used during pre-training, fine-tuning and inference. For the first time, we show how to pre-train such a knowledge retriever in an unsupervised manner, using masked language modeling as the learning signal and backpropagating through a retrieval step that considers millions of documents. We demonstrate the effectiveness of Retrieval-Augmented Language Model pre-training (REALM) by fine-tuning on the challenging task of Open-domain Question Answering (Open-QA). We compare against state-of-the-art models for both explicit and implicit knowledge storage on three popular Open-QA benchmarks, and find that we outperform all previous methods by a significant margin (4-16% absolute accuracy), while also providing qualitative benefits such as interpretability and modularity.","url_abs":"https://arxiv.org/abs/2002.08909v1","url_pdf":"https://arxiv.org/pdf/2002.08909v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/google-research/language/tree/master/language/realm","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/Zefty/rag-end2end-retriever","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/deepset-ai/haystack","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/lucidrains/mlm-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/martiansideofthemoon/relic-retrieval","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"realm-retrieval-augmented-language-model-pre","repo_url":"https://github.com/snjstudent/MyREALM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"masked-language-modeling","task_name":"Masked Language Modeling"},{"task_slug":"open-domain-question-answering","task_name":"Open-Domain Question Answering"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"world-knowledge","task_name":"World Knowledge"},{"task_slug":"model","task_name":"model"}],"methods":[{"method_slug":"interpretability","method_name":"Interpretability"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/question-answering-on-natural-questions","task":"Question Answering","dataset":"Natural Questions","model":"REALM","rank_in_archive_order":24,"of":47,"metrics":{"EM":"40.4"},"uses_additional_data":false},{"leaderboard":"/sota/question-answering-on-webquestions","task":"Question Answering","dataset":"WebQuestions","model":"REALM","rank_in_archive_order":19,"of":37,"metrics":{"EM":"40.7"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2002.08909","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2002.08909"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Zefty/rag-end2end-retriever","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/snjstudent/MyREALM","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/deepset-ai/haystack","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/google-research/language/tree/master/language/realm","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/mlm-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/martiansideofthemoon/relic-retrieval","reach":null}],"summary":{"ran":1,"ran_violates":2,"ran_draft_wrong":1},"by_repo_kind":{"listed":{"samples":4,"ran":4,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"3b2b6f543ceae53e","entry":"PrefixSuffixModel","repo":"martiansideofthemoon/relic-retrieval","repo_kind":"listed","path":"retriever_train/utils.py","file_url":"https://github.com/martiansideofthemoon/relic-retrieval/blob/HEAD/retriever_train/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3b2b6f543ceae53e"}},{"code_sha256_prefix":"e33ada12822bb56c","entry":"get_mask_subset_with_prob","repo":"lucidrains/mlm-pytorch","repo_kind":"listed","path":"mlm_pytorch/mlm_pytorch.py","file_url":"https://github.com/lucidrains/mlm-pytorch/blob/HEAD/mlm_pytorch/mlm_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e33ada12822bb56c"}},{"code_sha256_prefix":"5573a79bdc0a0a09","entry":"mask_with_tokens","repo":"lucidrains/mlm-pytorch","repo_kind":"listed","path":"mlm_pytorch/mlm_pytorch.py","file_url":"https://github.com/lucidrains/mlm-pytorch/blob/HEAD/mlm_pytorch/mlm_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5573a79bdc0a0a09"}},{"code_sha256_prefix":"0a27e49623646a01","entry":"prob_mask_like","repo":"lucidrains/mlm-pytorch","repo_kind":"listed","path":"mlm_pytorch/mlm_pytorch.py","file_url":"https://github.com/lucidrains/mlm-pytorch/blob/HEAD/mlm_pytorch/mlm_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0a27e49623646a01"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}