Skip to content
Preprint

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

Jul 2026 · 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

Preprint Aug 2026

Bootstrapping Niche Multilingual Code Translation via Reinforcement Learning with Execution-Based Verifiable Supervision

Code translation must preserve executable behavior across many programming languages, yet neural code translation has largely focused on a few popular languages such as C++, Java, and Python. This leaves a niche, many-to-many setting where parallel supervision is sparse, producing plausible but non-executable translations. We address this setting with preference-based reinforcement learning driven by execution-based supervision. Our pipeline firstly expands verifiable seed Python programs into a multilingual pool of execution-validated codes. Using the pool, a base LLM generates translation candidates across language pairs, which we label by their execution outcomes. The resulting preferences are used to train a reward model that scores cross-language translation quality. Finally, we optimize our base LLMs with GRPO over 600 directed language pairs (25 x 24) using the reward model as a signal. To evaluate the niche translation capability, we introduce HumanEval-X++, an execution-based benchmark that extends HumanEval-X to a broad many-to-many language space. We evaluate our approach using Qwen-3.5 4B and 9B models. On HumanEval-X++ and existing benchmarks, it yields consistent gains over the untrained baselines. In particular, the 4B model achieves an average improvement of 13% across all languages on HumanEval-X++, with a gain of 21% on mid-tier languages. Our study establishes a reliable approach of data generation, training, and benchmarking, paving the way toward further bootstrapping the quality of many-to-many translation for programming languages.

Kouki Yuki, Jie Zeng, Kyoko Ogawa et al. · 0 citations
Book Open access Jul 2026

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

Reinforcement learning with verifiable rewards (RLVR) has been established as a viable paradigm for the post-training of Large Language Models (LLMs), including downstream tasks, such as Neural Machine Translation (NMT). With the latest research indicating that RLVR could be the preferred training method for translating legal documents due to the induced reasoning capabilities, it raises the question whether it is really attributed to the reasoning or more generally to the training paradigm. We investigate 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. Our experiments show that including the reasoning, specifically during inference, has a positive effect on the overall translation quality. Furthermore, we recognise that the reasoning leads to an increase in output tokens, hence we study the cost-quality tradeoff between the increased computational demands and the improved translation quality.

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.

Donghui Li, Yingying 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 practical path toward robust enterprise-grade text-to-SQL.

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