{"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/generate-rather-than-retrieve-large-language","title":"Generate rather than Retrieve: Large Language Models are Strong Context Generators","arxiv_id":"2209.10063","date":"2022-09-21","proceeding":null,"authors":["Wenhao Yu","Dan Iter","Shuohang Wang","Yichong Xu","Mingxuan Ju","Soumya Sanyal","Chenguang Zhu","Michael Zeng","Meng Jiang"],"abstract":"Knowledge-intensive tasks, such as open-domain question answering (QA), require access to a large amount of world or domain knowledge. A common approach for knowledge-intensive tasks is to employ a retrieve-then-read pipeline that first retrieves a handful of relevant contextual documents from an external corpus such as Wikipedia and then predicts an answer conditioned on the retrieved documents. In this paper, we present a novel perspective for solving knowledge-intensive tasks by replacing document retrievers with large language model generators. We call our method generate-then-read (GenRead), which first prompts a large language model to generate contextutal documents based on a given question, and then reads the generated documents to produce the final answer. Furthermore, we propose a novel clustering-based prompting method that selects distinct prompts, resulting in the generated documents that cover different perspectives, leading to better recall over acceptable answers. We conduct extensive experiments on three different knowledge-intensive tasks, including open-domain QA, fact checking, and dialogue system. Notably, GenRead achieves 71.6 and 54.4 exact match scores on TriviaQA and WebQ, significantly outperforming the state-of-the-art retrieve-then-read pipeline DPR-FiD by +4.0 and +3.9, without retrieving any documents from any external knowledge source. Lastly, we demonstrate the model performance can be further improved by combining retrieval and generation. Our code and generated documents can be found at https://github.com/wyu97/GenRead.","url_abs":"https://arxiv.org/abs/2209.10063v3","url_pdf":"https://arxiv.org/pdf/2209.10063v3.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":"generate-rather-than-retrieve-large-language","repo_url":"https://github.com/wyu97/GenRead","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"generate-rather-than-retrieve-large-language","repo_url":"https://github.com/mingdali6717/ensemble-of-retrievers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"open-domain-question-answering","task_name":"Open-Domain Question Answering"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2209.10063","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2209.10063"}},"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":"deterministic:regex_extraction","url":"https://github.com/wyu97/GenRead","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mingdali6717/ensemble-of-retrievers","reach":{"status":"ok"}}],"summary":{"ran":1,"ran_draft_wrong":4,"unverified":1},"by_repo_kind":{"official":{"samples":6,"ran":5,"repositories":1}},"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":6,"samples":[{"code_sha256_prefix":"251dbd78999130c3","entry":"TimeoutException","repo":"wyu97/GenRead","repo_kind":"official","path":"inference.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"251dbd78999130c3"}},{"code_sha256_prefix":"516d32b8af5f75d7","entry":"add_prompt","repo":"wyu97/GenRead","repo_kind":"official","path":"inference.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"516d32b8af5f75d7"}},{"code_sha256_prefix":"2dfa6c5cb8089dca","entry":"clustering_prompt","repo":"wyu97/GenRead","repo_kind":"official","path":"inference.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2dfa6c5cb8089dca"}},{"code_sha256_prefix":"ed1a7cdd6a385a75","entry":"readfiles","repo":"wyu97/GenRead","repo_kind":"official","path":"mainfunc.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/mainfunc.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ed1a7cdd6a385a75"}},{"code_sha256_prefix":"e1e837332edb0441","entry":"time_limit","repo":"wyu97/GenRead","repo_kind":"official","path":"inference.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e1e837332edb0441"}},{"code_sha256_prefix":"002e293469caa46e","entry":"run_inference","repo":"wyu97/GenRead","repo_kind":"official","path":"inference.py","file_url":"https://github.com/wyu97/GenRead/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"002e293469caa46e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}