RepoRepair: Leveraging Code Documentation for Repository-Level Automated Program Repair
RepoRepair is a novel, cost-effective automated program repair framework that leverages LLM-generated hierarchical code documentation to enhance repository-level fault localization and achieve state-of-the-art repair rates on SWE-bench benchmarks.
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 master mechanic hired to fix a specific problem in a massive, sprawling city of buildings (a software repository). The city has thousands of buildings, millions of rooms, and complex plumbing and electrical systems connecting them all.
Your boss hands you a note describing a leak: "The water pressure is weird in the kitchen of the blue house on 5th Street."
The Old Way (Traditional Repair Tools):
Most automated repair tools act like a frantic intern who grabs a map, runs to the blue house, and starts tearing down walls in every room, hoping to find the leak. If the leak is actually caused by a valve in the green house three blocks away (a different file), the intern misses it completely. They get overwhelmed by the sheer size of the city, run out of time, and often break things while trying to fix them.
The New Way (RepoRepair):
The authors of this paper, RepoRepair, realized that the problem isn't the mechanic's skill; it's the lack of a good guidebook.
Instead of rushing into the dark city, RepoRepair first hires a team of expert architects (AI models) to write a hierarchical guidebook for the entire city before trying to fix anything.
Here is how it works, broken down into simple steps:
1. Writing the "City Guide" (Documentation Generation)
Before fixing the leak, RepoRepair generates two types of summaries for every building in the city:
- The "Building Summary" (File-Level): A short paragraph describing what the whole building does. "This is the library; it handles all book storage and search functions."
- The "Room Summary" (Function-Level): A detailed description of every specific room inside. "This is the 'Search' room; it takes a user's query and finds matching books."
The Analogy: Imagine if every building in your city had a clear sign outside saying exactly what it is, and every room inside had a label saying exactly what happens there. You don't need to open every door to know where to look.
2. Finding the Right Spot (Localization)
When the boss says, "Fix the water pressure in the kitchen," RepoRepair doesn't start tearing down walls.
- Step A: It looks at the Building Summaries. It quickly realizes, "The kitchen is in the Blue House, but the water pressure issue is actually caused by the main valve in the Green House (the plumbing hub)." It filters out 99% of the city instantly.
- Step B: It looks at the Room Summaries inside the Green House. It finds the specific valve room that controls the pressure.
The Magic: Because the AI understands the meaning of the buildings (via the guidebook) rather than just matching keywords, it can figure out that a problem in the "Kitchen" is actually caused by a "Plumbing Hub" in a different building. Old tools would have looked only in the kitchen and failed.
3. Making the Fix (Repair)
Once the exact room is found, RepoRepair doesn't rebuild the whole house. It creates a tiny, precise "patch" (a diff) that only changes the specific valve.
- Safety Check: Before handing the fix to the boss, it runs a simulation (tests) to make sure the new valve doesn't flood the basement.
- Iterative Guessing: If the first guess doesn't work, it tries a slightly different angle (changing the "temperature" of the AI) until it finds a solution that passes all tests.
Why is this a Big Deal?
The paper tested this on two huge challenges:
- SWE-bench Lite: A standard test of fixing code. RepoRepair fixed 45.7% of the problems.
- SWE-bench Multimodal: A harder test involving visual bugs (like a button looking wrong on a screen) and complex code. RepoRepair fixed 37.1% of these, beating all other current tools.
The Cost:
Most other tools are like hiring a team of 100 interns to search the city. They are expensive and slow. RepoRepair is like hiring one smart architect with a perfect map. It is cheaper (about 44 cents per fix) and smarter.
The Bottom Line
RepoRepair is like giving a repair robot a comprehensive, AI-written encyclopedia of the software before asking it to fix a bug. Instead of guessing and searching blindly, the robot reads the encyclopedia to understand how the whole system connects, finds the real source of the problem (even if it's in a different file), and makes a precise, safe fix.
It turns the chaotic task of fixing a giant software city into a structured, logical process of reading a map and turning a single screw.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.