Hierarchical Knowledge Injection for Improving LLM-based Program Repair
This paper proposes a layered knowledge injection framework that incrementally augments LLMs with bug, repository, and project-level context to improve automated program repair, achieving a significant increase in fix rates across various bug types.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a detective trying to solve a mystery in a massive, sprawling mansion.
Currently, most AI "detectives" (Large Language Models) are being sent into a room with a broken vase, a single note from a witness, and a photo of the broken pieces. They try to figure out who broke it and how to fix it using only what is in that one room. Sometimes they succeed, but often they fail because they don't know that the person who broke the vase was actually running from a ghost in the hallway, or that the vase was part of a set that requires a specific type of glue found only in the basement.
This paper, "Hierarchical Knowledge Injection for Improving LLM-based Program Repair," proposes a better way to train these AI detectives. Instead of just throwing them into a room, the researchers give them a "Layered Briefing."
The Three Layers of the Briefing
Think of the researchers' method like a detective getting more and more information as the case gets tougher:
Layer 1: The "Crime Scene" Knowledge (Bug Knowledge)
This is the basic stuff. The AI gets the broken code (the broken vase), the error message (the witness statement), and the failed test (the evidence). This works for "simple" crimes—like someone accidentally tripping over the vase.
Layer 2: The "Floor Plan" Knowledge (Repository Knowledge)
If the AI can't solve it with just the crime scene, the researchers give it the blueprints of the house. Now the AI knows which doors lead where, which rooms are connected, and who was moving through the hallways recently (the history of the code). This helps the AI realize, "Oh, the vase didn't just fall; it was pushed by a change made in the kitchen next door!"
Layer 3: The "Family History" Knowledge (Project Knowledge)
If it’s still not solved, the AI gets the family archives. This includes the "house rules" (documentation) and stories of how previous broken items were fixed in the past (previous bug fixes). This is crucial for complex mysteries, like realizing, "In this house, we always use silver polish for all glassware, even if it looks like ceramic."
Why does this matter? (The Results)
The researchers tested this on a large set of coding "mysteries" using two different AI models (Llama 3.3 and GPT-4o-mini). Here is what they found:
- It actually works: By adding these layers, the AI's success rate jumped significantly. One model went from a 56% success rate to a 79% success rate. That is a massive leap in the world of AI.
- Don't dump everything at once: Interestingly, if you give the AI all the information (the crime scene, the blueprints, and the archives) at the very beginning, it actually gets confused. It’s like giving a detective a 500-page book of history when they just need to know where the hammer is. The "layered" approach—giving info only when needed—is much smarter.
- Some mysteries are still too hard: Even with all the info, some "crimes" (like complex network errors or visual/GUI bugs) are still too tricky. These are like "ghost stories"—they require a level of intuition and real-time interaction that current AI just hasn't mastered yet.
The Big Picture
The paper concludes that if we want AI to help humans write and fix software, we shouldn't just give it the "broken part." We need to give it the context—the history, the connections, and the rules of the world it is working in. We are moving from "AI that looks at code" to "AI that understands the whole system."
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.