SemLoc:基于结构化语义绑定的自由形式LLM推理故障定位
SemLoc: Structured Grounding of Free-Form LLM Reasoning for Fault Localization
AI总结:
SemLoc通过结构化语义绑定将自由形式LLM推理转化为封闭中间表示,结合语义违反光谱提升故障定位精度,实现7.6%的代码检查效率提升。
摘要:
故障定位旨在识别导致观察到故障的程序位置。现有技术通过语法光谱对可疑代码进行排名,这些信号源于执行结构如语句覆盖、控制流分歧或依赖可达性。这些信号在语义故障中失效,因为失败和通过执行遵循相同代码路径,仅在语义意图是否满足上存在差异。最近的LLM方法引入了语义推理,但生成的输出具有随机性和不可验证性,无法系统地跨测试交叉参考或区分根本原因与级联效应。我们提出了SemLoc,一个基于结构化语义绑定的故障定位框架。SemLoc将自由形式LLM推理转化为封闭的中间表示,将每个推导的属性绑定到类型化的程序锚点,从而实现运行时检查和归因于程序结构。它执行仪器化的程序以构建语义违反光谱——一个约束-测试矩阵——从其中推导出可疑性分数,类似于基于覆盖的方法。反事实验证步骤进一步修剪过度近似的约束并隔离主要因果语义约束。我们在SemFault-250数据集上评估SemLoc,该数据集包含250个带有单一语义故障的Python程序。SemLoc在覆盖、缩减和LLM基线中表现优异,实现Top-1准确率42.8%和Top-3 68%,同时将检查减少到可执行代码的7.6%。反事实验证提供了额外的12%准确率提升并识别了主要因果语义约束。
英文摘要:
Fault localization identifies program locations responsible for observed failures. Existing techniques rank suspicious code using syntactic spectra--signals derived from execution structure such as statement coverage, control-flow divergence, or dependency reachability. These signals collapse for semantic bugs, where failing and passing executions follow identical code paths and differ only in whether semantic intent is satisfied. Recent LLM-based approaches introduce semantic reasoning but produce stochastic, unverifiable outputs that cannot be systematically cross-referenced across tests or distinguish root causes from cascading effects. We present SemLoc, a fault localization framework based on structured semantic grounding. SemLoc converts free-form LLM reasoning into a closed intermediate representation that binds each inferred property to a typed program anchor, enabling runtime checking and attribution to program structure. It executes instrumented programs to construct a semantic violation spectrum--a constraint-by-test matrix--from which suspiciousness scores are derived analogously to coverage-based methods. A counterfactual verification step further prunes over-approximate constraints and isolates primary causal violations. We evaluate SemLoc on SemFault-250, a corpus of 250 Python programs with single semantic faults. SemLoc outperforms five coverage-, reduction-, and LLM-based baselines, achieving Top-1 accuracy of 42.8% and Top-3 of 68%, while reducing inspection to 7.6% of executable lines. Counterfactual verification provides an additional 12% accuracy gain and identifies primary causal semantic constraints.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。