Adversarial Agent Collaboration for C to Rust Translation

📅 2025-10-04
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing C-to-Rust translation approaches—including LLM-based methods—rely heavily on complex static program analysis, limiting scalability to large-scale code (>500 lines). Method: We propose the first end-to-end translation framework based on generative-discriminative agent adversarial collaboration, eliminating the need for static analysis. It integrates LLM-driven iterative translation, test-feedback loops, and adversarial optimization. Contribution/Results: Our framework robustly handles real-world C code averaging 485 lines. Evaluated on 63 authentic command-line utilities, it achieves a mean test pass rate exceeding 90%, outperforming baseline methods by +18.9% in correctness. To our knowledge, this is the first approach to enable reliable, scalable, and fully automated memory-safe migration at this scale.

Technology Category

Application Category

📝 Abstract
Translating C to memory-safe languages, like Rust, prevents critical memory safety vulnerabilities that are prevalent in legacy C software. Existing approaches for C to safe Rust translation, including LLM-assisted ones, do not generalize on larger (> 500 LoC) C codebases because they depend on complex program analyses that frequently break. In this work, we present ACToR (Adversarial C To Rust translator), a simple LLM agent-based approach. Inspired by GANs, ACToR pits a generator agent against a discriminator agent, which collaborate to iteratively generate a Rust translation. On each iteration, the translator agent synthesizes and refines a Rust translation to pass an existing suite of tests, and then the discriminator agent finds new failing tests. We demonstrate that ACToR translates all of the 63 real-world command line utilities considered in our benchmarks, which have an average size of 485 lines of code, and it achieves over 90% test pass rate with zero human intervention. To our knowledge, it is the first such system that reliably translates C programs of this scale. Furthermore, ACToR improves translation correctness by up to 18.9% compared to baseline, non-adversarial approaches.
Problem

Research questions and friction points this paper is trying to address.

Translating C to Rust prevents memory safety vulnerabilities in legacy software
Existing approaches fail on large C codebases due to complex program analyses
ACToR uses adversarial agent collaboration to reliably translate C programs
Innovation

Methods, ideas, or system contributions that make the work stand out.

Uses adversarial LLM agents for translation
Generator and discriminator agents iteratively refine code
Achieves high test pass rates without human intervention
🔎 Similar Papers
No similar papers found.
T
Tianyu Li
National University of Singapore, Singapore
R
Ruishi Li
National University of Singapore, Singapore
B
Bo Wang
National University of Singapore, Singapore
Brandon Paulsen
Brandon Paulsen
Amazon Web Services
Computer Science
Umang Mathur
Umang Mathur
Presidential Young Professor at National University of Singapore
ConcurrencyFormal MethodsVerificationLogicProgramming Languages
P
Prateek Saxena
National University of Singapore, Singapore