Probe-and-Refine Tuning of Repository Guidance for Coding Agents
This paper introduces "probe-and-refine tuning," a method that iteratively optimizes repository guidance files (AGENTS.md) using synthetic bug-fix probes to significantly improve coding agent performance on SWE-bench Verified by expanding the coverage of evaluable patches rather than increasing per-patch precision.
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 hire a brilliant but inexperienced apprentice to fix a massive, ancient library (the code repository). The apprentice is smart enough to read books and fix broken pages, but they don't know the library's secret rules: which shelf holds the rare maps, how to ask the librarian for help without waking the sleeping cats, or which ladders are safe to climb.
Without this "local knowledge," the apprentice wanders aimlessly, climbs the wrong ladder, or tries to fix a book in the wrong section, often breaking things in the process.
This paper introduces a method called "Probe-and-Refine Tuning" to solve this problem. Here is how it works, using simple analogies:
The Problem: The "One-Size-Fits-All" Manual
Engineers often write a "cheat sheet" (like an AGENTS.md file) for their AI coding agents.
- The Old Way (Static Knowledge): They ask a smart AI to write a generic manual: "Always check the index before fixing," or "Look for the main entry point." This is like giving the apprentice a map of every library in the world. It's helpful, but it doesn't tell them where the specific library's secret stash is hidden.
- The Result: The apprentice does okay, but they still get lost often.
The Solution: The "Trial-and-Error" Coach
The authors created a new process called Probe-and-Refine. Instead of just writing a manual once, they treat the manual like a living document that gets trained by making mistakes.
Think of it like a coach training a new player:
- The Probes (The Drills): The coach generates 10 fake, made-up problems (probes) specific to this library.
- The Attempt: The apprentice tries to solve these fake problems using the current manual.
- The Diagnosis: The coach watches the attempt. "Oh, you tried to fix the plumbing in the kitchen, but the pipes are actually in the basement. And you forgot to check the blueprints first."
- The Refinement: The coach updates the manual immediately with a specific rule: "For this library, plumbing is in the basement, and always check the blueprints first."
- Repeat: They do this 3 to 5 times. The manual evolves from a generic guide into a hyper-specific, "insider" guide.
Crucially, this whole training process happens without the agent actually fixing real bugs. It's a simulation loop where the AI writes the manual, tests it on fake problems, and fixes the manual based on the results.
What They Found
The researchers tested this on a famous coding benchmark (SWE-bench) with four different runs. Here is what happened:
- No Guide: The apprentice solved 25.5% of the problems.
- Generic Guide: The apprentice solved 28.3% of the problems.
- Probe-and-Refine Guide: The apprentice solved 33.0% of the problems.
The Big Secret: It's About Finding the Right Door, Not Fixing Better
You might think the improved manual made the apprentice smarter or better at fixing things. It didn't.
- When the apprentice did fix something, the quality of the fix was exactly the same (about 59% success rate) regardless of which manual they used.
- The real magic was "Coverage." The improved manual helped the apprentice find the right file to fix much more often.
- Analogy: The generic manual made the apprentice knock on 100 doors, but only 40 were the right ones. The refined manual made them knock on 100 doors, and 56 were the right ones. Once they found the right door, their ability to fix the lock was the same.
The "Step Budget" Trap
The paper also discovered that the guide only works if you give the apprentice enough time.
- If you give the apprentice only 25 steps to solve a problem, the fancy manual doesn't help. They don't have time to follow the complex instructions.
- If you give them 200 steps, the fancy manual shines. It tells them a workflow (Reproduce -> Trace -> Fix) that takes time but works. Without the manual, they just rush and fail.
- Analogy: If you tell someone, "Take a scenic route to avoid traffic," but you only give them 5 minutes to get to work, they will just get lost. You need to give them enough time to actually take the scenic route.
The "Model Mismatch" Warning
The most surprising finding was that this guide is not universal.
- They tried using the guide trained on one AI model (Qwen) with a different, slightly weaker AI model (Nemotron).
- Result: The second model crashed. It got so confused by the specific instructions that it stopped working entirely.
- Analogy: It's like giving a detailed, high-speed racing manual to a driver in a slow, old sedan. The instructions are too complex for the car, and the driver freezes up. The guide must be "tuned" specifically for the brain (model) that will read it.
Summary
This paper proves that how you write the instructions matters more than just having instructions.
By using a simple loop of "make a fake problem, try to solve it, and fix the instructions based on the failure," you can turn a generic guide into a specialized expert manual. This doesn't make the AI smarter at fixing code; it just stops it from looking in the wrong place, allowing it to use its full potential to solve more problems.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.