← Latest papers
🤖 AI

On the Role of Fault Localization Context for LLM-Based Program Repair

This paper presents a large-scale empirical study demonstrating that while file-level fault localization significantly enhances LLM-based program repair, simply increasing context volume often degrades performance due to noise, revealing that the most effective strategy combines broad semantic file context with precise line-level localization.

Original authors: Melika Sepidband, Hung Viet Pham, Hadi Hemmati

Published 2026-04-08
📖 5 min read🧠 Deep dive

Original authors: Melika Sepidband, Hung Viet Pham, Hadi Hemmati

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 detective (the AI) trying to solve a crime (a software bug) in a massive, sprawling city (the codebase). Your job is to find the exact spot where the crime happened and fix it.

For a long time, researchers thought the key to solving the crime was just giving the detective a perfectly precise address (the exact line of code). But this new paper asks a different question: What if we give the detective a map of the whole neighborhood, or even the whole city, instead of just the address? Does more information help, or does it just confuse them?

The authors of this paper ran a giant experiment with 500 real-world "crimes" to find out. Here is what they discovered, explained simply:

1. The "Neighborhood" Matters Most (File-Level)

The Finding: Giving the detective the exact building where the crime happened is a huge upgrade over giving them nothing. But, giving them the surrounding neighborhood (related files) makes them even better.

  • The Analogy: If you tell a detective, "The thief is in Building A," they can fix it. But if you say, "The thief is in Building A, and here are the blueprints for Building A, plus the buildings next door that share a wall with it," the detective understands the context. They see how the thief might have entered from the side or used a shared hallway.
  • The Surprise: The paper found that using an AI to pick the neighborhood works better than using a rigid rule (like "pick every building connected by a door"). The AI understands the story of the crime better than a simple map. Also, the AI picks a smaller, smarter neighborhood, saving time and money.

2. The "Room" is Helpful, but Don't Overdo It (Element-Level)

The Finding: Once the detective is in the right building, pointing out the specific room (function or class) helps. But, if you try to show them every room in the building that is connected to that room, it gets messy.

  • The Analogy: Knowing the thief is in the "Kitchen" is great. But if you also show them the "Living Room," "Garage," and "Attic" just because they are connected by hallways, the detective might get distracted.
  • The Nuance: If the AI picks the extra rooms based on meaning (e.g., "This room stores the ingredients the thief used"), it helps. If it picks them based on structure (e.g., "This room is next door"), it usually adds noise and hurts the solution.

3. The "Spotlight" Should Be Tiny (Line-Level)

The Finding: This is the most surprising part. When it comes to the exact spot on the floor where the crime happened (the specific line of code), more information is actually worse.

  • The Analogy: Imagine the detective is holding a flashlight. If you shine the light on the exact spot where the shoe print is, they fix it instantly. But if you turn on a floodlight that illuminates the entire floor, including the dust bunnies, the spilled coffee, and the cat toys, the detective gets overwhelmed. They can't see the shoe print anymore because it's lost in the glare.
  • The Result: Adding "context windows" (lines before and after) or "code slicing" (lines that logically connect) usually hurts the repair. The AI needs to know where to edit, not read 50 extra lines of irrelevant code.

4. The Golden Formula: Broad Understanding + Precise Focus

The paper concludes that the best strategy is a hybrid approach:

  • Give the AI a broad view of the neighborhood and the building (Files and Elements) so it understands the story and the system.
  • Give the AI a laser-focused view of the exact spot to fix (Lines) so it doesn't get distracted.

Think of it like this:

You want to fix a leaky pipe.

  • Bad Strategy: Hand the plumber a single photo of the leak, but no idea where the house is. (Too little context).
  • Bad Strategy: Hand the plumber the entire blueprints of the city, the house, the plumbing system, and a 10-foot zoomed-in photo of the pipe that includes the wall, the floor, and the neighbor's cat. (Too much noise).
  • Best Strategy: Give the plumber the blueprints of the house and the plumbing system (so they understand the flow) AND a laser pointer on the exact dripping joint (so they know exactly where to turn the wrench).

Why Does This Matter?

For a long time, people thought "More Context = Better AI." This paper proves that More Context = More Noise if you aren't careful.

  • Don't just dump data on the AI. Be smart about what you show them.
  • Use AI to find the relevant files, not just rigid rules.
  • Keep the "edit zone" small. Let the AI understand the big picture, but tell it exactly where to type the fix.

This research helps engineers build cheaper, faster, and smarter tools that can automatically fix software bugs without getting confused by too much information.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →