一句话:提出 TRAVEL,用规则引导 MCTS 推理与强化学习提升 LLM 的 C-to-Rust 翻译正确性。
将遗留 C 程序迁移到 Rust 可提升内存安全并降低人工重写成本,但现有 LLM 自动 C-to-Rust 翻译难以识别 Rust 特有规则、易生成语法错误代码,也难以准确捕捉复杂程序语义。论文提出 TRAVEL:用 Rust 规则引导 MCTS 推理路径构建,使搜索偏向符合语法的翻译步骤;再用结合执行反馈与推理质量信号的强化学习,促使模型生成保持原 C 程序语义的 Rust 代码。在 xCodeEval、OS-Bench 和 HW-Bench 上评估,相较 IRENE,计算准确率提升 26.22%、编译成功率提升 18.77%,工业与内核数据集上编译成功率继续提升、不安全率下降。
The migration of legacy C programs to Rust has become an important direction for improving software memory safety while alleviating the high cost of manual rewriting. Leveraging large language models (LLMs) for automated C-to-Rust translation has emerged as a promising direction. However, existing LLM-based approaches remain limited. On the one hand, LLMs exhibit limited capability in identifying Rust-specific rules, and inadequate handling of Rust syntax often results in incorrect translations. On the other hand, existing LLMs often struggle to accurately capture the semantics of complex code, resulting in incorrect translations. To address these challenges, we propose a Translation fRAmework Via rule-guided reasoning and rEinforcement Learning, namely TRAVEL, consisting of two modules. The first module employs Monte Carlo Tree Search (MCTS)-based reasoning path construction guided by Rust-specific rules, steering the search toward translation steps that respect the syntactic rules that LLMs frequently violate. The second module introduces reinforcement learning that couples execution feedback with reasoning-quality signals, encouraging the model to construct reasoning paths that accurately capture program semantics, thereby ensuring that the generated Rust code preserves the intended behavior of the original C program. We evaluate TRAVEL on three datasets: xCodeEval (a public benchmark), OS-Bench (functions collected from the Linux kernel), and HW-Bench (an industrial dataset from Huawei). On xCodeEval, TRAVEL outperforms all baselines across three backbone LLMs. In particular, compared to the strongest prompting baseline IRENE, TRAVEL improves computational accuracy (CA) by 26.22% and compilation success rate (CSR) by 18.77%. On HW-Bench and OS-Bench, TRAVEL further improves CSR by 18.28% and 16.51%, respectively, while reducing unsafe rate (UR) by 13.06% and 13.08%, respectively.
@inproceedings{paperbot12460,
title = {Towards Reliable C-to-Rust Translation with Rule-Guided Reasoning and Reinforcement Learning},
author = {Feng Luo and Jiachen Liu and Cuiyun Gao and Jia Feng and Kui Liu},
booktitle = {ASE},
year = {2026},
doi = {10.1145/3832783.3834534}
}