{"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/when-to-retrieve-teaching-llms-to-utilize","title":"When to Retrieve: Teaching LLMs to Utilize Information Retrieval Effectively","arxiv_id":"2404.19705","date":"2024-04-30","proceeding":null,"authors":["Tiziano Labruna","Jon Ander Campos","Gorka Azkune"],"abstract":"In this paper, we demonstrate how Large Language Models (LLMs) can effectively learn to use an off-the-shelf information retrieval (IR) system specifically when additional context is required to answer a given question. Given the performance of IR systems, the optimal strategy for question answering does not always entail external information retrieval; rather, it often involves leveraging the parametric memory of the LLM itself. Prior research has identified this phenomenon in the PopQA dataset, wherein the most popular questions are effectively addressed using the LLM's parametric memory, while less popular ones require IR system usage. Following this, we propose a tailored training approach for LLMs, leveraging existing open-domain question answering datasets. Here, LLMs are trained to generate a special token, <RET>, when they do not know the answer to a question. Our evaluation of the Adaptive Retrieval LLM (Adapt-LLM) on the PopQA dataset showcases improvements over the same LLM under three configurations: (i) retrieving information for all the questions, (ii) using always the parametric memory of the LLM, and (iii) using a popularity threshold to decide when to use a retriever. Through our analysis, we demonstrate that Adapt-LLM is able to generate the <RET> token when it determines that it does not know how to answer a question, indicating the need for IR, while it achieves notably high accuracy levels when it chooses to rely only on its parametric memory.","url_abs":"https://arxiv.org/abs/2404.19705v2","url_pdf":"https://arxiv.org/pdf/2404.19705v2.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":"when-to-retrieve-teaching-llms-to-utilize","repo_url":"https://github.com/tLabruna/Adapt-LLM","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"CC-BY-4.0"}}],"tasks":[{"task_slug":"information-retrieval","task_name":"Information Retrieval"},{"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"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.19705","atlas_url":"https://app.syntology.ai/?focus=2404.19705","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.19705"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/tLabruna/Adapt-LLM","reach":{"status":"ok","spdx":"CC-BY-4.0"}}],"summary":{"ran":5,"ran_honours":1,"unverified":2},"by_repo_kind":{"official":{"samples":8,"ran":6,"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":8,"samples":[{"code_sha256_prefix":"637b51b8df78832a","entry":"check_answer","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/evaluation.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/evaluation.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"637b51b8df78832a"}},{"code_sha256_prefix":"9fb6e57668661c38","entry":"gather","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/dist_utils.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/dist_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"9fb6e57668661c38"}},{"code_sha256_prefix":"01971cc37e6fe583","entry":"gather_nograd","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/dist_utils.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/dist_utils.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"01971cc37e6fe583"}},{"code_sha256_prefix":"fa4ecbff4b9a354b","entry":"has_answer","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/evaluation.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/evaluation.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"fa4ecbff4b9a354b"}},{"code_sha256_prefix":"e037474365501512","entry":"randomcrop","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/data.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"e037474365501512"}},{"code_sha256_prefix":"b1ad8cd3a7168b7f","entry":"varsize_gather_nograd","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/dist_utils.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/dist_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"b1ad8cd3a7168b7f"}},{"code_sha256_prefix":"7a4988952dd3a127","entry":"calculate_matches","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/evaluation.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/evaluation.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"7a4988952dd3a127"}},{"code_sha256_prefix":"806114c1fae3d57e","entry":"normalize","repo":"tLabruna/Adapt-LLM","repo_kind":"official","path":"contriever/src/normalize_text.py","file_url":"https://github.com/tLabruna/Adapt-LLM/blob/HEAD/contriever/src/normalize_text.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"806114c1fae3d57e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}