Rust fluency
General code pretraining underrepresents ownership, borrowing, idiomatic APIs, and natural Rust style.
Technical report · August 2026
Fine-Tuning Qwen3.5-27B for C-to-Rust Code Translation
A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFT
Open-source model, benchmark, and evaluation harness
1 epoch · LR 1e-62 epochs · LR 2e-72 epochs · LR 2e-7General-purpose language models rarely emphasize idiomatic Rust generation, cross-language semantic equivalence, or productive use of compiler and runtime feedback. C2Rust specializes Qwen3.5-27B with Rust-focused continued pretraining, debugging-aware supervised fine-tuning on Verus data, and task-specific supervised fine-tuning on paired C/Rust programs.
The resulting 27B model is evaluated with SACTOR's verification-driven methodology on 200 C programs. It reaches a five-seed Success Rate of 87.30%, improving the untuned Qwen3.5-27B baseline by 15.00 percentage points and outperforming several substantially larger open-weight systems. On SWE-bench Verified, it scores 70.6 versus 72.4 for the base model, retaining strong general coding ability with a modest specialization cost.
C-to-Rust translation requires language fluency, feedback-driven repair, and direct task alignment. No single dataset supplies all three.
General code pretraining underrepresents ownership, borrowing, idiomatic APIs, and natural Rust style.
Translation succeeds only when a model can turn compiler and verifier failures into targeted revisions.
Paired C/Rust programs teach the source-to-target mapping required at inference time.
All stages use full-parameter BF16 training with DeepSpeed ZeRO Stage 3 and a 16,384-token sequence length on eight NVIDIA B300 GPUs. The Qwen3.5 vision encoder remains in the checkpoint but is unused because every training stage is text-only.
Seven complementary sources contribute 1,673,289 examples spanning natural Rust code, fill-in-the-middle completion, synthesis, repair, instructions, and benchmarks.
Verus Training Data teaches the model to consume structured verifier failures and make targeted revisions without changing intended behavior.
Aligned function- and program-level C/Rust pairs teach direct semantic translation. Project-level examples are not used in this stage.
SACTOR validates generated programs through compilation and end-to-end execution instead of textual similarity. The default released configuration evaluates its interface-preserving translation stage and may retain unsafe Rust.
Task-specific specialization closes a large portion of the gap between a 27B dense model and frontier systems.
| Model | Size | SR |
|---|---|---|
| Qwen3.5-Plus | 397B / 17B | 77.20% |
| MiniMax-M2.5 | 230B / 10B | 83.90% |
| GLM-5 | 744B / 40B | 84.40% |
| GLM-5.2 | 744B / 40B | 89.90% |
| Claude Code-4.6 | — | 90.01% |
| Qwen3.5-27B base | 27B | 72.30% |
| C2Rust (ours) | 27B | 87.30% |
| Model | pass@1 |
|---|---|
| GPT-5-mini | 72.0 |
| GPT-OSS-120B | 62.0 |
| Qwen3.5-122B-A10B | 72.0 |
| Qwen3.5-27B base | 72.4 |
| C2Rust (ours) | 70.6 |
The 200-program benchmark contains 92 argv and 108 stdin tasks. Each score is averaged over five stochastic seeds.
moxin-org/C2Rust
The released checkpoint preserves the Qwen3.5-27B architecture and tokenizer, uses BF16 Safetensors weights, and is distributed under Apache-2.0.
# Download the checkpoint
hf download moxin-org/C2Rust \
--local-dir /models/C2Rust
# Serve on the benchmark port
./scripts/launch_model.sh \
/models/C2Rust 0,1 30878 2Use the released SACTOR-based harness, smoke-test the environment, and aggregate five complete seeds.
bash fix_paths.shcd engine && uv syncpython3 scripts/run_eval.py ... --limit 2TAG=mymodel ./run_5seed.shPassing the supplied tests demonstrates observed behavioral agreement; it is not a formal proof of semantic equivalence, memory safety, or security.
Stage 3 uses function- and program-level pairs but excludes project-level examples, leaving a gap for full-codebase migration.
SWE-bench Verified decreases from 72.4 for the base checkpoint to 70.6, indicating modest capability narrowing after specialization.
The report does not yet isolate the marginal contribution of each curriculum stage through a systematic ablation.
The manuscript's individual author list is not finalized. Until complete citation metadata is released, cite the open software artifact:
@software{moxin2026c2rust,
title = {C2Rust: Fine-Tuned Qwen3.5-27B for C-to-Rust Translation},
author = {{Moxin Organization}},
year = {2026},
url = {https://github.com/moxin-org/C2Rust}
}