AI
New Framework Uses AI Reasoning and Learning to Convert C Code to Rust More Reliably
Researchers introduce TRAVEL, a system that combines language models with rule-guided reasoning to improve automated translation from legacy C programs to memory-safe Rust.
Migrating aging C codebases to Rust offers a path to better memory safety, but manual conversion is expensive and time-consuming. A new research approach tackles automated translation by pairing large language models with specialized reasoning techniques.
The Challenge#
LLMs struggle with two fundamental problems when translating C to Rust. First, they frequently overlook Rust-specific syntax rules, producing code that fails to compile. Second, they often misinterpret the semantics of complex code, leading to translations that compile but don't behave correctly. These issues limit the practical use of LLM-based translation for real-world codebases.
How TRAVEL Works#
Researchers from multiple institutions developed TRAVEL (Translation fRAmework Via rule-guided reasoning and rEinforcement Learning), which combines two complementary strategies:
- Rule-guided search: Uses Monte Carlo Tree Search guided by Rust syntax rules, steering the model away from common mistakes and ensuring generated code respects language constraints.
- Learning from execution: Applies reinforcement learning that incorporates both whether code actually runs and how well the reasoning process captures program semantics, training the model to preserve the original program's behavior.
Performance Gains#
Testing on three datasets revealed substantial improvements:
On xCodeEval (a public benchmark), TRAVEL outperformed existing baselines across multiple underlying language models, improving computational accuracy by 26.22% and compilation success rate by 18.77% compared to the strongest existing approach.
On industrial and kernel code sources, the gains persisted: HW-Bench (Huawei dataset) and OS-Bench (Linux kernel functions) both saw compilation success rates jump by around 16–18%, while the rate of unsafe code dropped by roughly 13% on both datasets.
Why It Matters#
As organizations seek to strengthen security in legacy systems, automated tools that reliably convert C to Rust could significantly reduce both development time and the risk of introducing human error during translation.

