MatchFixAgent: Language-Agnostic Autonomous Repository-Level Code Translation Validation and Repair
Ali Reza Ibrahimzada ⋅ Brandon Paulsen ⋅ Reyhaneh Jabbarvand ⋅ Joey Dodds ⋅ Daniel Kroening
Abstract
Code translation transforms source code from one programming language (PL) to another. Validating the functional equivalence of translation and repairing, if necessary, are critical steps in code translation. Existing automated validation and repair approaches struggle to generalize to many PLs due to high engineering overhead, and they rely on existing and often inadequate test suites, which results in false claims of equivalence and ineffective translation repair. To bridge this gap, we develop MatchFixAgent, a large language model (LLM)-based, PL-agnostic framework for equivalence validation and repair of translations. MatchFixAgent features a multi-agent architecture that divides equivalence validation into several sub-tasks to ensure thorough and consistent semantic analysis of the translation. We compare MatchFixAgent's validation and repair results with four repository-level code translation techniques. Our results demonstrate that MatchFixAgent produces (in)equivalence verdicts for $99.2$% of translation pairs, with the same equivalence validation result as prior work on $72.8$% of them. When MatchFixAgent's result disagrees with prior work, we find that $60.7$% of the time MatchFixAgent's result is actually correct. In addition, we show that MatchFixAgent can repair $50.6$% of inequivalent translation, compared to prior work’s $18.5$%.
Lay Summary
When software developers need to move code from one programming language to another—say, from Python to Java—it's not enough to just translate it; you also need to verify that the translated version actually *behaves* the same way as the original. Existing tools for checking this equivalence rely on pre-written tests, which are often incomplete, leading to false assurances that a translation is correct when it isn't. These tools also tend to work only for specific programming languages, limiting their usefulness. We built MatchFixAgent, a system powered by large language models that can check—and fix—code translations across many programming languages without needing pre-written tests. Instead of making one big judgment call, MatchFixAgent breaks the problem into smaller reasoning steps handled by multiple specialized agents working together, which leads to more thorough and consistent analysis. We tested MatchFixAgent against four state-of-the-art translation tools. It successfully delivered a verdict on $99.2$% of translation pairs, and when it disagreed with prior tools, it turned out to be correct over $60$% of the time. It also repaired faulty translations at nearly triple the rate of existing approaches—$50.6$% versus $18.5$%—making it a substantially more reliable partner for automated code migration.
Successful Page Load