arXiv:2604.16021cs.SEcs.AI2026-04

提出新方法解决代码定位中依赖关键词的虚假匹配问题

Neurosymbolic Repo-level Code Localization

论文配图:Neurosymbolic Repo-level Code Localization
图 1 · 摘自论文原文
  • 用逻辑编程与大模型结合,实现无需命名提示的精准代码定位
  • 在无关键词提示的新基准上,现有模型性能暴跌,暴露出推理缺陷
  • 适合关注代码智能与可验证推理的研究者和工程团队

代码定位是自主软件工程的核心。现有方法在真实问题数据集上表现优异,但存在关键而被忽视的偏差:这些数据集充斥着文件路径、函数名等关键词引用,导致模型依赖表面词汇匹配而非真正的结构推理。我们称之为关键词捷径。为此,我们提出了关键词无关的逻辑代码定位(KA-LCL)挑战,并构建了KA-LogicQuery诊断基准,要求模型在无命名提示下进行结构推理。评估显示,主流方法在该基准上性能急剧下降,暴露其缺乏确定性推理能力。我们提出LogicLoc框架,将大语言模型与Datalog的严格逻辑推理相结合,从代码库中提取程序事实,由LLM生成Datalog程序,通过解析器约束验证和基于变异的中间规则诊断反馈确保正确性与效率。经验证的程序由高性能推理引擎执行,实现全自动闭环的准确且可验证定位。实验表明,LogicLoc在KA-LogicQuery上显著优于现有方法,同时在主流问题驱动基准上保持竞争力。特别地,通过将结构遍历交给确定性引擎,LogicLoc以更低的令牌消耗和更快的执行速度实现更优性能。

原文摘要 · Abstract (English)

Code localization is a cornerstone of autonomous software engineering. Recent advancements have achieved impressive performance on real-world issue benchmarks. However, we identify a critical yet overlooked bias: these benchmarks are saturated with keyword references (e.g. file paths, function names), encouraging models to rely on superficial lexical matching rather than genuine structural reasoning. We term this phenomenon the Keyword Shortcut. To address this, we formalize the challenge of Keyword-Agnostic Logical Code Localization (KA-LCL) and introduce KA-LogicQuery, a diagnostic benchmark requiring structural reasoning without any naming hints. Our evaluation reveals a catastrophic performance drop of state-of-the-art approaches on KA-LogicQuery, exposing their lack of deterministic reasoning capabilities. We propose LogicLoc, a novel agentic framework that combines large language models with the rigorous logical reasoning of Datalog for precise localization. LogicLoc extracts program facts from the codebase and leverages an LLM to synthesize Datalog programs, with parser-gated validation and mutation-based intermediate-rule diagnostic feedback to ensure correctness and efficiency. The validated programs are executed by a high-performance inference engine, enabling accurate and verifiable localization in a fully automated, closed-loop workflow. Experimental results demonstrate that LogicLoc significantly outperforms SOTA methods on KA-LogicQuery while maintaining competitive performance on popular issue-driven benchmarks. Notably, LogicLoc attains superior performance with significantly lower token consumption and faster execution by offloading structural traversal to a deterministic engine, reducing the overhead of iterative LLM inference.

代码定位逻辑推理大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。