Hierarchical Knowledge Injection for Improving LLM-based Program Repair
Ramtin Ehsani, Esteban Parra, Sonia Haiduc, Preetha Chatterjee

TL;DR
This paper introduces a layered knowledge injection framework that incrementally provides structured context to LLMs, significantly improving automated program repair rates across diverse bug types.
Contribution
It proposes a novel layered framework for injecting structured repository and project knowledge into LLMs to enhance program repair effectiveness.
Findings
Achieved 79% fix rate on BugsInPy dataset with Llama 3.3, a 23% improvement.
Knowledge injection benefits all bug types, especially with repository-level context.
Complex bugs like Program Anomaly remain challenging despite layered knowledge injection.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
