← Latest papers
💻 computer science

MultiMend: Multilingual Program Repair with Context Augmentation and Multi-Hunk Patch Generation

This paper presents MultiMend, a multilingual automated program repair approach that leverages retrieval-augmented context augmentation and multi-hunk patch generation to effectively fix bugs across four programming languages, outperforming state-of-the-art methods by successfully repairing 2,227 bugs including complex multi-location issues.

Original authors: Reza Gharibi, Mohammad Hadi Sadreddini, Seyed Mostafa Fakhrahmad

Published 2026-04-14
📖 4 min read☕ Coffee break read

Original authors: Reza Gharibi, Mohammad Hadi Sadreddini, Seyed Mostafa Fakhrahmad

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 editor tasked with fixing typos and errors in thousands of books written in different languages (like Python, Java, C, and JavaScript). Usually, finding the right fix is like trying to solve a puzzle in the dark; you only see the specific sentence with the error, and you have to guess what the author meant based on that tiny snippet.

This paper introduces MultiMend, a new "super-editor" designed to automate this process. It doesn't just guess; it uses two clever tricks to make fixing code much faster and more accurate.

The Problem: The "Tunnel Vision" Editor

Traditional automated repair tools are like editors who only look at the sentence with the typo. They don't know what the character said three paragraphs ago, or what variable was defined in a different chapter. Because they lack this "big picture," they often suggest fixes that look right locally but break the story elsewhere. Also, if a bug requires changing three different sentences in three different chapters, old tools often give up or try to fix them one by one, which is slow and inefficient.

The Solution: MultiMend's Two Superpowers

1. The "Smart Librarian" (Context Augmentation)

Instead of just looking at the buggy sentence, MultiMend acts like a smart librarian.

  • How it works: When it finds an error, it doesn't just stare at the immediate neighborhood. It uses a "retrieval system" to scan the entire file where the error happened. It looks for other lines of code that are similar in meaning or structure to the error.
  • The Analogy: Imagine you are trying to fix a sentence that says "The cat meowed at the moon." If you only see that sentence, you might think the cat is crazy. But if your librarian hands you a note from earlier in the book saying, "The cat is actually a werewolf in disguise," you suddenly understand the context!
  • The Result: MultiMend pulls these "helpful notes" (relevant lines) from the same file and feeds them to the AI along with the error. This helps the AI understand the "story" of the code better, leading to smarter fixes without needing an external database of past mistakes.

2. The "Team Captain" (Multi-Hunk Patch Generation)

Some bugs are like a plot hole that spans three different chapters. You have to change the beginning, the middle, and the end to fix the story.

  • The Challenge: If you have 3 places to fix, and the AI generates 100 possible fixes for each place, you have 1,000,000 combinations to check. That's impossible to do quickly.
  • The Strategy: MultiMend acts like a team captain who organizes the work.
    1. The "One-Size-Fits-All" Check: First, it asks, "Can we fix all three chapters with the exact same change?" If yes, it applies that change everywhere instantly.
    2. The "Partial Victory" Approach: If the fixes are different, it doesn't try to check every single combination. Instead, it fixes one chapter, sees if the story gets better (passes the tests), keeps that improvement, and then moves to the next chapter. It builds the final solution piece by piece, keeping the "partial wins" along the way.
  • The Result: This turns a massive, impossible mountain of combinations into a manageable staircase, allowing the tool to fix complex, multi-part bugs that other tools miss.

The Results: How Well Did It Work?

The authors tested MultiMend on 5,501 real-world bugs across four programming languages. Think of this as testing the editor on a massive library of books.

  • Total Fixes: It successfully fixed 2,227 bugs.
  • Perfect Matches: Out of those, 1,545 were fixed exactly the way a human developer would have done it (identical patches).
  • Complex Bugs: It managed to fix 121 of those tricky "multi-chapter" bugs that require changes in multiple places.

The paper shows that MultiMend is competitive with the best existing tools, often fixing more bugs and doing so efficiently. It proves that giving the AI a "library card" to find relevant context and a "team captain" to organize complex fixes makes a huge difference in automating software repair.

What It Doesn't Do (Based Strictly on the Paper)

  • It does not claim to replace human developers entirely; it is a tool to assist them.
  • It does not claim to work on every bug in existence, only the ones in the specific datasets they tested.
  • It does not claim to be a "magic wand" that requires no testing; the fixes still need to be validated against the software's test suite to ensure they actually work.

In short, MultiMend is a smarter, more organized editor that reads the whole file before making a change and knows how to tackle big, complicated problems step-by-step.

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 →