{"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/locagent-graph-guided-llm-agents-for-code","title":"LocAgent: Graph-Guided LLM Agents for Code Localization","arxiv_id":"2503.09089","date":"2025-03-12","proceeding":null,"authors":["Zhaoling Chen","Xiangru Tang","Gangda Deng","Fang Wu","Jialong Wu","Zhiwei Jiang","Viktor Prasanna","Arman Cohan","Xingyao Wang"],"abstract":"Code localization--identifying precisely where in a codebase changes need to be made--is a fundamental yet challenging task in software maintenance. Existing approaches struggle to efficiently navigate complex codebases when identifying relevant code sections. The challenge lies in bridging natural language problem descriptions with the appropriate code elements, often requiring reasoning across hierarchical structures and multiple dependencies. We introduce LocAgent, a framework that addresses code localization through graph-based representation. By parsing codebases into directed heterogeneous graphs, LocAgent creates a lightweight representation that captures code structures (files, classes, functions) and their dependencies (imports, invocations, inheritance), enabling LLM agents to effectively search and locate relevant entities through powerful multi-hop reasoning. Experimental results on real-world benchmarks demonstrate that our approach significantly enhances accuracy in code localization. Notably, our method with the fine-tuned Qwen-2.5-Coder-Instruct-32B model achieves comparable results to SOTA proprietary models at greatly reduced cost (approximately 86% reduction), reaching up to 92.7% accuracy on file-level localization while improving downstream GitHub issue resolution success rates by 12% for multiple attempts (Pass@10). Our code is available at https://github.com/gersteinlab/LocAgent.","url_abs":"https://arxiv.org/abs/2503.09089v2","url_pdf":"https://arxiv.org/pdf/2503.09089v2.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":"locagent-graph-guided-llm-agents-for-code","repo_url":"https://github.com/gersteinlab/locagent","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"github-issue-resolution","task_name":"GitHub issue resolution"},{"task_slug":"navigate","task_name":"Navigate"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2503.09089","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2503.09089"}},"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/gersteinlab/locagent","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/gersteinlab/LocAgent","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":2,"ran_violates":1,"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":4,"ran":4,"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":0,"samples":[{"code_sha256_prefix":"3ffc6363f552738d","entry":"RepoDependencySearcher","repo":"gersteinlab/LocAgent","repo_kind":"official","path":"dependency_graph/traverse_graph.py","file_url":"https://github.com/gersteinlab/LocAgent/blob/HEAD/dependency_graph/traverse_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3ffc6363f552738d"}},{"code_sha256_prefix":"c6a7782e9a902680","entry":"RepoEntitySearcher","repo":"gersteinlab/LocAgent","repo_kind":"official","path":"dependency_graph/traverse_graph.py","file_url":"https://github.com/gersteinlab/LocAgent/blob/HEAD/dependency_graph/traverse_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c6a7782e9a902680"}},{"code_sha256_prefix":"6ff966d192844369","entry":"is_test_file","repo":"gersteinlab/LocAgent","repo_kind":"official","path":"dependency_graph/traverse_graph.py","file_url":"https://github.com/gersteinlab/LocAgent/blob/HEAD/dependency_graph/traverse_graph.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6ff966d192844369"}},{"code_sha256_prefix":"4eaf41e329447227","entry":"wrap_code_snippet","repo":"gersteinlab/LocAgent","repo_kind":"official","path":"dependency_graph/traverse_graph.py","file_url":"https://github.com/gersteinlab/LocAgent/blob/HEAD/dependency_graph/traverse_graph.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4eaf41e329447227"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}