[Paper Review] Repair Is Nearly Generation: Multilingual Program Repair with LLMs
This paper introduces ring, a multilingual program repair system powered by Codex that treats repair as a prompt-based task involving localization, transformation, and candidate ranking. It achieves performance competitive with or better than language-specific repair engines across six languages, including PowerShell, demonstrating that large language models enable effective, low-effort multilingual repair with a flipped interaction model where AI fixes code instead of suggesting completions.
Most programmers make mistakes when writing code. Some of these mistakes are small and require few edits to the original program -- a class of errors recently termed last mile mistakes. These errors break the flow for experienced developers and can stump novice programmers. Existing automated repair techniques targeting this class of errors are language-specific and do not easily carry over to new languages. Transferring symbolic approaches requires substantial engineering and neural approaches require data and retraining. We introduce RING, a multilingual repair engine powered by a large language model trained on code (LLMC) such as Codex. Such a multilingual engine enables a flipped model for programming assistance, one where the programmer writes code and the AI assistance suggests fixes, compared to traditional code suggestion technology. Taking inspiration from the way programmers manually fix bugs, we show that a prompt-based strategy that conceptualizes repair as localization, transformation, and candidate ranking, can successfully repair programs in multiple languages with minimal effort. We present the first results for such a multilingual repair engine by evaluating on 6 different languages and comparing performance to language-specific repair engines. We show that RING can outperform language-specific repair engines for three of these languages.
Motivation & Objective
- To address the challenge of repairing small, syntax-level errors—termed 'last-mile mistakes'—across multiple programming languages with minimal engineering effort.
- To explore whether a single large language model (LLM) can serve as a multilingual repair engine, avoiding the need for language-specific training or symbolic engineering.
- To evaluate the feasibility and effectiveness of prompt-based repair strategies that emulate how human developers localize, transform, and rank fixes.
- To introduce a new benchmark for PowerShell program repair, extending the scope of last-mile repair beyond mainstream languages.
- To enable a 'flipped' AI programming assistance model where the user writes code and the AI suggests fixes, rather than the AI generating code from prompts.
Proposed method
- The system decomposes program repair into three stages: fault localization using error messages or vectors, code transformation via few-shot prompt templates, and candidate ranking using similarity-based retrieval.
- It uses Codex as the underlying LLM, leveraging its few-shot learning capability to generalize across languages without retraining.
- A curated example bank of buggy-fixed code pairs is used for few-shot prompting, with retrieval based on error message similarity or error category vectors.
- For error localization, the system abstracts error messages by removing location-specific details, improving generalization across similar errors.
- The method supports both error vector-based and message embedding-based few-shot selection, depending on the granularity of error reporting from the language tool.
- The system is adapted to new languages by building a language-specific example bank and configuring error abstraction and retrieval strategies accordingly.
Experimental results
Research questions
- RQ1Can a single large language model (LLM) effectively perform multilingual program repair with minimal engineering, outperforming language-specific repair systems?
- RQ2How well does a prompt-based strategy—emulating human debugging behavior—generalize across diverse programming languages including PowerShell and C?
- RQ3What design choices in few-shot example selection (e.g., error vectors vs. message embeddings) most significantly impact repair success?
- RQ4To what extent can abstracted error messages improve repair generalization, especially in low-code or natural-language-error environments?
- RQ5Can a 'flipped' interaction model—where AI fixes code instead of completing it—be effectively implemented using LLMs for last-mile repairs?
Key findings
- ring outperforms language-specific repair engines in three of the six evaluated languages: Python, JavaScript, and C, demonstrating that multilingual repair with LLMs can surpass single-language systems.
- The system achieves competitive performance in two additional languages, PowerShell and Power Fx, with a new benchmark for PowerShell showing feasibility for low-code environments.
- Using abstracted error messages—removing location-specific details—improves repair generalization, particularly in languages like Excel and PowerShell with natural language error messages.
- Error vector-based few-shot selection outperforms message embedding-based selection in languages with fine-grained error categories, such as C and Python.
- The system's performance is robust even with a strict leave-one-out example bank, indicating that retrieval-based few-shot learning works effectively with minimal example sets.
- The results validate the feasibility of a 'flipped' AI programming model where the AI acts as a debugger rather than a code completer, significantly reducing friction in the development workflow.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.