{"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/disentangling-memory-and-reasoning-ability-in","title":"Disentangling Memory and Reasoning Ability in Large Language Models","arxiv_id":"2411.13504","date":"2024-11-20","proceeding":null,"authors":["Mingyu Jin","Weidi Luo","Sitao Cheng","Xinyi Wang","Wenyue Hua","Ruixiang Tang","William Yang Wang","Yongfeng Zhang"],"abstract":"Large Language Models (LLMs) have demonstrated strong performance in handling complex tasks requiring both extensive knowledge and reasoning abilities. However, the existing LLM inference pipeline operates as an opaque process without explicit separation between knowledge retrieval and reasoning steps, making the model's decision-making process unclear and disorganized. This ambiguity can lead to issues such as hallucinations and knowledge forgetting, which significantly impact the reliability of LLMs in high-stakes domains. In this paper, we propose a new inference paradigm that decomposes the complex inference process into two distinct and clear actions: (1) memory recall: which retrieves relevant knowledge, and (2) reasoning: which performs logical steps based on the recalled knowledge. To facilitate this decomposition, we introduce two special tokens memory and reason, guiding the model to distinguish between steps that require knowledge retrieval and those that involve reasoning. Our experiment results show that this decomposition not only improves model performance but also enhances the interpretability of the inference process, enabling users to identify sources of error and refine model responses effectively. The code is available at https://github.com/MingyuJ666/Disentangling-Memory-and-Reasoning.","url_abs":"https://arxiv.org/abs/2411.13504v3","url_pdf":"https://arxiv.org/pdf/2411.13504v3.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":"disentangling-memory-and-reasoning-ability-in","repo_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"decision-making","task_name":"Decision Making"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2411.13504","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2411.13504"}},"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/mingyuj666/disentangling-memory-and-reasoning","reach":{"status":"ok"}}],"summary":{"unverified":8},"by_repo_kind":{"official":{"samples":8,"ran":0,"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":"976872a507c933a4","entry":"extract_labeled_content_as_list","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/data_agent.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/data_agent.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":"976872a507c933a4"}},{"code_sha256_prefix":"b82b37c35d49aafd","entry":"format_example","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/data_agent.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/data_agent.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":"b82b37c35d49aafd"}},{"code_sha256_prefix":"3842459b68f0f8a0","entry":"get_response","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/data_agent.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/data_agent.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":"3842459b68f0f8a0"}},{"code_sha256_prefix":"5187be23c430fe41","entry":"get_response","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/data_agent_modify_version.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/data_agent_modify_version.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":"5187be23c430fe41"}},{"code_sha256_prefix":"6571c6d3a61d5838","entry":"get_response","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/data_agent_order_modify_version.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/data_agent_order_modify_version.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":"6571c6d3a61d5838"}},{"code_sha256_prefix":"e280f41397ef1d22","entry":"make_constant_len_data_module","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"load_data/constant_len_dataset.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/load_data/constant_len_dataset.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":"e280f41397ef1d22"}},{"code_sha256_prefix":"d6fb9c5bed407a12","entry":"make_sparse_mask","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"model/generation_utils.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/model/generation_utils.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":"d6fb9c5bed407a12"}},{"code_sha256_prefix":"f7c8ecc9fe3dc748","entry":"safe_str","repo":"mingyuj666/disentangling-memory-and-reasoning","repo_kind":"official","path":"model/my_trainer.py","file_url":"https://github.com/mingyuj666/disentangling-memory-and-reasoning/blob/HEAD/model/my_trainer.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":"f7c8ecc9fe3dc748"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}