Skip to content

Towards Reliable C-to-Rust Translation with Rule-Guided Reasoning and Reinforcement Learning

Jul 2026 · arXiv.org · Vol abs/2607.19966 · 0 citations
Computer Science

TL;DR

A Translation fRAmework Via rule-guided reasoning and rEinforcement Learning, namely TRAVEL, consisting of two modules that employs Monte Carlo Tree Search-based reasoning path construction guided by Rust-specific rules, and introduces reinforcement learning that couples execution feedback with reasoning-quality signals.

Abstract

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.

View source

Similar papers

Book Open access Jul 2026

The Price of Reasoning: Cost-Quality Tradeoffs in Reinforcement Learning for Neural Machine Translation

This work investigates the importance of including the model's reasoning trace in the generated responses during both training and inference by systematically omitting it from one of the phases and shows that including the reasoning, specifically during inference, has a positive effect on the overall translation qualit...

Michael Jungo, Aixiu An · 0 citations
Open access Aug 2026

RL–LLMfuzzer: reinforcement learning–guided dual–model differential fuzzing for compiler testing

RL-LLMfuzzer, a reinforcement learning and LLM-based differential fuzzing framework that has successfully unearthed 28 officially confirmed vulnerabilities in GCC and LLVM/Clang, establishing a highly efficient and scalable paradigm for LLM-driven compiler validation.

Dong-Hui Li, Ying-Ying Li, Bo Zhao et al. · 0 citations
Preprint Jul 2026

SCOPE: Leveraging Subgoal Critiques for Code Generation

SCOPE is presented, a prover-initialized subgoal critic for code generation that adapts a Lean-oriented prover model to produce three parseable feedback fields for downstream code generation: subgoals, gap analysis, and a robustness checklist.

Yueke Zhang, Yifan Zhang, Zihan Fang et al. · 0 citations
#artificial intelligence Preprint Aug 2026

ReToolSQL: Agentic Reinforcement Learning for Robust Text-to-SQL

ReToolSQL is presented, a two-stage training framework for text-to-SQL that combines a supervised warm-start on rejection-sampled reasoning traces with agentic reinforcement fine-tuning (RFT) over multi-turn tool-use trajectories and shows that a properly designed SFT$\to-RFT pipeline over tool-use trajectories is a pr...

Pratik Kakkar, Chandra Dhir, Ravi Shankar et al. · 0 citations
Book Open access Jul 2026

Learning to Refine Specifications for Code Generation

This work proposes a novel Reinforcement Learning from AI Feedback (RLAIF) framework, finding that specifications can be iteratively refined by leveraging feedback from the LLM's own outputs, creating a self-improving loop.

Jaykithan Y Patel · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.