{"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/ircan-mitigating-knowledge-conflicts-in-llm","title":"IRCAN: Mitigating Knowledge Conflicts in LLM Generation via Identifying and Reweighting Context-Aware Neurons","arxiv_id":"2406.18406","date":"2024-06-26","proceeding":null,"authors":["Dan Shi","Renren Jin","Tianhao Shen","Weilong Dong","Xinwei Wu","Deyi Xiong"],"abstract":"It is widely acknowledged that large language models (LLMs) encode a vast reservoir of knowledge after being trained on mass data. Recent studies disclose knowledge conflicts in LLM generation, wherein outdated or incorrect parametric knowledge (i.e., encoded knowledge) contradicts new knowledge provided in the context. To mitigate such knowledge conflicts, we propose a novel framework, IRCAN (Identifying and Reweighting Context-Aware Neurons) to capitalize on neurons that are crucial in processing contextual cues. Specifically, IRCAN first identifies neurons that significantly contribute to context processing, utilizing a context-aware attribution score derived from integrated gradients. Subsequently, the identified context-aware neurons are strengthened via reweighting. In doing so, we steer LLMs to generate context-sensitive outputs with respect to the new knowledge provided in the context. Extensive experiments conducted across a variety of models and tasks demonstrate that IRCAN not only achieves remarkable improvements in handling knowledge conflicts but also offers a scalable, plug-and-play solution that can be integrated seamlessly with existing models. Our codes are released at https://github.com/danshi777/IRCAN.","url_abs":"https://arxiv.org/abs/2406.18406v2","url_pdf":"https://arxiv.org/pdf/2406.18406v2.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":"ircan-mitigating-knowledge-conflicts-in-llm","repo_url":"https://github.com/danshi777/ircan","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.18406","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.18406"}},"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/danshi777/IRCAN","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/danshi777/ircan","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":7,"ran_honours":2,"ran":2,"unverified":1},"by_repo_kind":{"official":{"samples":12,"ran":11,"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":12,"samples":[{"code_sha256_prefix":"87348b6e69e519df","entry":"completion_task_generation","repo":"danshi777/ircan","repo_kind":"official","path":"src/3_enhance_and_evaluate.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/3_enhance_and_evaluate.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":"87348b6e69e519df"}},{"code_sha256_prefix":"7ca5f6affb7142af","entry":"convert_to_triplet_ig","repo":"danshi777/ircan","repo_kind":"official","path":"src/1_calculate_attribution_completion.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/1_calculate_attribution_completion.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7ca5f6affb7142af"}},{"code_sha256_prefix":"f53b8b1219f680f8","entry":"enhance_neurons","repo":"danshi777/ircan","repo_kind":"official","path":"src/utils/enhance_model.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/utils/enhance_model.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":"f53b8b1219f680f8"}},{"code_sha256_prefix":"2c0175fb3a85802d","entry":"get_context_attr","repo":"danshi777/ircan","repo_kind":"official","path":"src/1_calculate_attribution_completion.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/1_calculate_attribution_completion.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":"2c0175fb3a85802d"}},{"code_sha256_prefix":"58b2480c8dfcb07b","entry":"get_context_attr","repo":"danshi777/IRCAN","repo_kind":"official","path":"src/1_calculate_attribution_mcq.py","file_url":"https://github.com/danshi777/IRCAN/blob/HEAD/src/1_calculate_attribution_mcq.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"58b2480c8dfcb07b"}},{"code_sha256_prefix":"5c4128b72feca7a9","entry":"get_information","repo":"danshi777/ircan","repo_kind":"official","path":"src/3_enhance_and_evaluate.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/3_enhance_and_evaluate.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":"5c4128b72feca7a9"}},{"code_sha256_prefix":"e2d17a2e0e06f143","entry":"get_prompts","repo":"danshi777/ircan","repo_kind":"official","path":"src/3_enhance_and_evaluate.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/3_enhance_and_evaluate.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":"e2d17a2e0e06f143"}},{"code_sha256_prefix":"dbb7a4fa7b6bb8d1","entry":"pos_list2str","repo":"danshi777/ircan","repo_kind":"official","path":"src/utils/enhance_model.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/utils/enhance_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dbb7a4fa7b6bb8d1"}},{"code_sha256_prefix":"dae759b7f6c3b29d","entry":"pos_str2list","repo":"danshi777/ircan","repo_kind":"official","path":"src/utils/enhance_model.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/utils/enhance_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dae759b7f6c3b29d"}},{"code_sha256_prefix":"0478177ef6964221","entry":"scaled_input","repo":"danshi777/ircan","repo_kind":"official","path":"src/1_calculate_attribution_completion.py","file_url":"https://github.com/danshi777/ircan/blob/HEAD/src/1_calculate_attribution_completion.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0478177ef6964221"}},{"code_sha256_prefix":"4e8f7031219b2572","entry":"scaled_input","repo":"danshi777/IRCAN","repo_kind":"official","path":"src/1_calculate_attribution_mcq.py","file_url":"https://github.com/danshi777/IRCAN/blob/HEAD/src/1_calculate_attribution_mcq.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4e8f7031219b2572"}},{"code_sha256_prefix":"69e1d21af1cdf8ca","entry":"analysis_context_file","repo":"danshi777/IRCAN","repo_kind":"official","path":"src/2_get_cns.py","file_url":"https://github.com/danshi777/IRCAN/blob/HEAD/src/2_get_cns.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":"69e1d21af1cdf8ca"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}