AI
XL-CoGen tackles multilingual code generation with multi-agent pipeline
A new three-stage system uses intermediate languages and repair strategies to improve AI code generation across programming languages where models perform unevenly.
Modern software rarely lives in a single programming language, yet large language models struggle to generate code equally well across the full spectrum. This uneven capability is especially problematic for less commonly used languages, where AI assistance remains unreliable. Researchers have now introduced XL-CoGen, a pipeline designed to bridge these gaps by working from natural-language specifications to produce working code in multiple target languages.
How XL-CoGen Works#
The approach unfolds in three stages, starting with a shared test suite and a plain-English description of what the code should do. First, the system attempts direct generation, building and validating the test harness to catch failures early. When direct generation falls short—which happens often for underperforming languages—XL-CoGen pivots to transfer through intermediate languages: it generates code in a language where the model performs well, then translates that solution to the target language. Finally, it applies repair strategies, diagnosing bugs and applying minimal fixes to strengthen the best candidate.
This design avoids common bottlenecks. It requires no target-language fine-tuning, no language-specific test suites, and no pre-existing source code to learn from—just the spec and tests.
Results and Improvements#
Testing across multiple benchmarks and language models, XL-CoGen consistently outperformed naive direct generation. The gains were most dramatic for weak-performing languages. In one case study involving Rust fine-tuning, the pipeline exceeded even the best fine-tuned baseline by 22 percentage points, and lifted performance on challenging languages by up to 33 points.
Transfer and Repair Working in Tandem#
Ablation studies revealed that transfer and repair strategies serve different roles depending on task difficulty. For simpler problems, repair alone was often enough; as difficulty climbed, transfer grew more critical, particularly for languages where the base model already struggles. Together, the two mechanisms create a system that adapts its strategy to the problem at hand.
The work is available on arXiv.

