Paper
Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining,
Debugging-Aware SFT, and Task-Specific SFT
Pu Zhao, Changdi Yang, Yixiao Chen, Yi Gao, Yifan Cao, Haochen Zeng, and Yanzhi Wang.
Northeastern University · EmbodyX Inc · Aibao LLC
The arXiv title uses “Qwen3-27B”; Section 3 identifies the released source checkpoint as
Qwen/Qwen3.5-27B, which is the identifier used throughout this model card.
Results
87.30% execution-verified C2Rust Success Rate — a 15.00 percentage-point gain over the
untuned Qwen3.5-27B base at identical model size. The 27B checkpoint also outperforms
Qwen3.5-Plus (397B total), MiniMax-M2.5 (230B total), and GLM-5 (744B total) on this benchmark.
C2Rust translation success rate
Success Rate (SR) is the percentage of programs that compile and pass every end-to-end test. Scores
are arithmetic means over five random seeds under the same inference configuration.
Table with columns: Model, Model size, SR| Model | Model size | SR |
|---|
| Qwen3.5-Plus | 397B total / 17B active | 77.20% |
| MiniMax-M2.5 | 230B total / 10B active | 83.90% |
| GLM-5 | 744B total / 40B active | 84.40% |
| GLM-5.2 | 744B total / 40B active | 89.90% |
| Claude Code-4.6 | undisclosed | 90.01% |
| Qwen3.5-27B base | 27B dense | 72.30% |
| C2Rust (this model) | 27B dense | 87.30% |
The curriculum improves the direct Qwen3.5-27B baseline by 15.00 percentage points while keeping
model size and serving cost fixed. C2Rust outperforms Qwen3.5-Plus, MiniMax-M2.5, and GLM-5 on this
task, while remaining below GLM-5.2 and Claude Code-4.6.
General coding capability
Table with columns: Model, SWE-bench Verified pass@1| Model | SWE-bench Verified pass@1 |
|---|
| GPT-5-mini (2025-08-07) | 72.0 |
| GPT-OSS-120B | 62.0 |
| Qwen3.5-122B-A10B | 72.0 |
| Qwen3.5-27B base | 72.4 |
| C2Rust (this model) | 70.6 |
The 1.8-point difference from the untuned base suggests a modest specialization cost, while the model
retains strong general software-engineering performance.
Three-stage training curriculum
Table with columns: Stage, Objective, Data, Training configuration| Stage | Objective | Data | Training configuration |
|---|
| 1. Rust continued pretraining | Strengthen Rust syntax, idioms, completion, repair, and library knowledge | 1,673,289 examples from seven Rust-focused sources | Full-parameter BF16, 1 epoch, LR 1e-6 |
| 2. Debugging-aware SFT | Learn to consume structured verifier feedback and make targeted repairs | microsoft/Verus_Training_Data | Full-parameter BF16, 2 epochs, LR 2e-7 |
| 3. C2Rust task SFT |
Stage 1 combines Strandset-Rust, CodeFIM-Rust-Mellum, rust_instruction_dataset, humaneval-rust,
the Rust subset of Magicoder-OSS-Instruct-75K, the Rust program-synthesis and repair subsets of
xCodeEval, and the Rust subset of StarCoderData.
All three stages use a 16,384-token sequence length, DeepSpeed ZeRO Stage 3, and eight NVIDIA B300
GPUs. Training is text-only. The Qwen3.5 vision encoder remains in the released checkpoint but receives
no task input and plays no role in C-to-Rust translation.
Model details
Table with columns: Field, Value| Field | Value |
|---|
| Base model | Qwen/Qwen3.5-27B |
| Parameters | 27B language model (~28B including the retained vision encoder) |
| Weight format | Safetensors |
| Precision | BF16 |
| Context used in training | 16,384 tokens |
| Fine-tuning type | Full-parameter |
| Primary task | C-to-Rust program translation |
| License | Apache-2.0 |
The tokenizer, vocabulary, and architecture are unchanged from the base checkpoint; no task-specific
special tokens were added.
Evaluation protocol
The companion benchmark contains 200 C programs: 92 receive command-line arguments and 108
read standard input. Approximately 120 are derived from IBM Project CodeNet. A translation succeeds
only when the generated Rust program compiles and reproduces every reference output on the supplied
tests within a six-attempt translation and repair budget.
Table with columns: Setting, Value| Setting | Value |
|---|
| Temperature | 0.6 |
| Top-p | 0.95 |
| Top-k | 20 |
| Maximum output length | 1,536 tokens |
| Maximum translation attempts | 6 |
| Random seeds | 5 |
The released repository's default configs evaluate SACTOR's interface-preserving, unidiomatic stage.
Generated code may therefore contain raw pointers or unsafe Rust. Passing the benchmark measures
agreement on the supplied test suite, not formal semantic equivalence.
Resources
Running with the benchmark
Download the checkpoint:
hf download moxin-org/C2Rust --local-dir /path/to/C2Rust-model
Clone and prepare the benchmark:
git clone https://github.com/moxin-org/C2Rust.git
cd C2Rust
bash fix_paths.sh
cd engine
uv sync
./update_rust_ast_parser.sh
cargo build --release
cd ..
Launch the checkpoint with SGLang:
export SERVE_VENV=/path/to/sglang-venv
./scripts/launch_model.sh /path/to/C2Rust-model 0,1 30878 2
Run a two-program smoke test before the complete evaluation:
python3 scripts/run_eval.py configs/native_prompt.toml results/_smoke \
--modes argv --limit 2 --workers 1
See the benchmark README and
SETUP.md for the complete environment,
five-seed evaluation, aggregation, and troubleshooting workflow.
Intended use
This release is intended for research and experimentation on C-to-Rust translation. Treat every
generated program as a candidate: compile it, test it against the original implementation, and review
it for correctness, safety, and maintainability before use.
Limitations
- Passing the supplied tests is not proof of semantic equivalence, memory safety, or security.
- The default evaluation permits
unsafe Rust and prioritizes behavior preservation over idiomaticity.
- Stage 3 uses function- and program-level pairs, but excludes project-level training examples.
- The model scores 70.6 on SWE-bench Verified versus 72.4 for the base checkpoint, suggesting mild
capability narrowing after full-parameter specialization.
- The report does not yet provide an ablation isolating each curriculum stage's marginal contribution.
Citation
@article{zhao2026c2rust,
title = {Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFT},
author = {Zhao, Pu and Yang, Changdi and Chen, Yixiao and Gao, Yi and Cao, Yifan and Zeng, Haochen and Wang, Yanzhi},
journal = {arXiv preprint arXiv:2608.13681},
year = {2026},
doi = {10.48550/arXiv.2608.13681}
}
License and attribution
The checkpoint is released under Apache-2.0 and is derived from
Qwen/Qwen3.5-27B. The benchmark is Apache-2.0. Its
dataset includes material derived from IBM Project CodeNet under CDLA-Permissive-2.0; see the
dataset provenance and terms.