Validated Code Translation for Projects with External Libraries
Hanliang Zhang, Arindam Sharma, Cristina David, Meng Wang, Brandon Paulsen, Daniel Kroening, Wenjia Ye, Taro Sekiyama

TL;DR
This paper introduces a framework for translating Go projects with external libraries to Rust, using retrieval and validation techniques to handle opaque library types and improve translation success.
Contribution
It presents a novel translation and validation system that effectively manages external dependencies and opaque types, significantly improving translation success rates.
Findings
Up to 100% compilation success in dependency-heavy cases
Approximately 2x improvement in translation success rate
Effective handling of opaque, library-defined types
Abstract
Large Language Models (LLMs) have shown promise for program translation, particularly for migrating systems code to memory-safe languages such as Rust. However, existing approaches struggle when source programs depend on external libraries: LLMs frequently hallucinate non-existent target APIs and fail to generate call-enabling imports; moreover, validating semantic equivalence is challenging when the code manipulates opaque, library-defined types. We present a translation and validation framework for translating Go projects with external dependencies to Rust. Our approach combines (i) a retrieval mechanism that maps Go library APIs to Rust APIs, and (ii) a cross-language validation pipeline that establishes language interoperability in the presence of opaque library types by synthesising adapters exclusively from public library APIs, prior to validating I/O equivalence. We evaluate our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsArtificial Intelligence in Games · Software Testing and Debugging Techniques · Software Engineering Research
