paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Hierarchical Knowledge Injection for Improving LLM-based Program Repair

面向 LLM 程序修复的分层知识注入
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 3/10 · 论文属于 LLM 驱动的自动程序修复,虽与 PL+AI 交叉领域相关,但不涉及用户核心关注的静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也非将静态分析应用于 Agentic/ML 系统。其分层知识注入主要是通过上下文/提示增强 LLM 修复能力,属于用户不太感兴趣的研究目标为 LLM 本身的方向。引用 2 inbox
Ramtin Ehsani, Esteban Parra, Sonia Haiduc, Preetha Chatterjee
crossref: 2026-09-12

AI 速览

一句话:提出分层知识注入框架,用 Bug、仓库、项目三层上下文逐步增强 LLM 程序修复。

仅提供错误消息、堆栈等局部上下文时,LLM 程序修复仍难处理许多缺陷,而开发者常借助仓库和项目级知识。本文提出分层知识注入框架,逐步向 LLM 注入 Bug 知识层(缺陷函数、失败测试)、仓库知识层(结构依赖、相关文件、提交历史)和项目知识层(文档、历史修复缺陷)。在 BugsInPy 的 314 个缺陷上,用 Llama 3.3 与 GPT-4o-mini 评估六类缺陷的修复率。Llama 3.3 达到 79%(250/314),较先前工作提升 23%;所有类型在仓库层后均有改善,仅部分类型继续受益于项目层。程序异常、GUI 等复杂且结构孤立的缺陷仍难修复,说明需要交互式、自适应 APR 系统。

问题
LLM 程序修复依赖 bug 局部上下文,但真实开发中许多缺陷需要仓库与项目级信息,如何自动提取并注入这些知识尚待研究。
方法
提出分层知识注入框架,按 Bug、仓库、项目三层增量提供结构化上下文,并在 BugsInPy 数据集上使用两个 LLM 评估修复率与缺陷类型差异。
评估
在 314 个 BugsInPy 缺陷上评估 Llama 3.3 和 GPT-4o-mini,Llama 3.3 修复率达 79%,较先前工作提升 23%,并分析各类缺陷的受益差异与未修复原因。
原文摘要(Abstract)

Prompting LLMs with bug-related context (e.g., error messages, stack traces) improves automated program repair, but many bugs still remain unresolved. In real-world projects, developers often rely on broader repository and project-level context beyond the local code to resolve such bugs. In this paper, we investigate how automatically extracting and providing such knowledge can improve LLM-based program repair. We propose a layered knowledge injection framework that incrementally augments LLMs with structured context. It starts with the Bug Knowledge Layer, which includes information such as the buggy function and failing tests; expands to the Repository Knowledge Layer, which adds structural dependencies, related files, and commit history; and finally injects the Project Knowledge Layer, which incorporates relevant details from documentation and previously fixed bugs. We evaluate this framework on a dataset of 314 bugs from BugsInPy using two LLMs (Llama 3.3 and GPT-4o-mini), and analyze fix rates across six bug types. By progressively injecting knowledge across layers, our approach achieves a fix rate of 79% (250/314) using Llama 3.3, a significant improvement of 23% over previous work. All bug types show improvement with the addition of repository-level context, while only a subset benefit further from project-level knowledge, highlighting that different bug types require different levels of contextual information for effective repair. We also analyze the remaining unresolved bugs and find that more complex and structurally isolated bugs, such as Program Anomaly and GUI bugs, remain difficult even after injecting all available information. Our results show that layered context injection improves program repair and suggest the need for interactive and adaptive APR systems.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot9290,
  title = {Hierarchical Knowledge Injection for Improving LLM-based Program Repair},
  author = {Ramtin Ehsani and Esteban Parra and Sonia Haiduc and Preetha Chatterjee},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00122}
}