Technical report · August 2026

C2Rust

Fine-Tuning Qwen3.5-27B for C-to-Rust Code Translation

A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFT

Moxin Organization

Open-source model, benchmark, and evaluation harness

Three-Stage Training Framework

Figure 1. C2Rust training curriculum. Progressive specialization first strengthens Rust priors, then teaches structured repair, and finally aligns the model directly with C-to-Rust translation.

Abstract

General-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.

87.30%C2Rust success rate
+15.00points over base
27Bdense parameters
70.6SWE-bench Verified

Why a curriculum?

C-to-Rust translation requires language fluency, feedback-driven repair, and direct task alignment. No single dataset supplies all three.

01

Rust fluency

General code pretraining underrepresents ownership, borrowing, idiomatic APIs, and natural Rust style.

02

Repair under feedback

Translation succeeds only when a model can turn compiler and verifier failures into targeted revisions.

03

Semantic alignment

Paired C/Rust programs teach the source-to-target mapping required at inference time.

Progressive specialization

0Qwen3.5-27B72.30% SR
1Rust priorcontinued pretraining
2Self-repairdebugging-aware SFT
3C2Rust87.30% SR
The final checkpoint retains the base architecture and parameter count; the improvement comes from the training curriculum.

Training Curriculum

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.

Stage 1 · 1 epoch

Rust-focused continued pretraining

Seven complementary sources contribute 1,673,289 examples spanning natural Rust code, fill-in-the-middle completion, synthesis, repair, instructions, and benchmarks.

Stage 2 · 2 epochs

Debugging-aware SFT

Verus Training Data teaches the model to consume structured verifier failures and make targeted revisions without changing intended behavior.

Stage 3 · 2 epochs

Task-specific C2Rust SFT

Aligned function- and program-level C/Rust pairs teach direct semantic translation. Project-level examples are not used in this stage.

Execution-based evaluation

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.

Reference lane
C source
C compiler
Expected output
Candidate lane
Model + prompt
Rust compiler
Observed output
Shared test inputs
exact comparisonPASS iff every output matches
Figure 2. Differential execution. Each candidate receives the reference program's inputs and succeeds only when every observed output matches.

Evaluation Results

Task-specific specialization closes a large portion of the gap between a 27B dense model and frontier systems.

C2Rust Success Rate

ModelSizeSR
Qwen3.5-Plus397B / 17B77.20%
MiniMax-M2.5230B / 10B83.90%
GLM-5744B / 40B84.40%
GLM-5.2744B / 40B89.90%
Claude Code-4.690.01%
Qwen3.5-27B base27B72.30%
C2Rust (ours)27B87.30%

SWE-bench Verified

Modelpass@1
GPT-5-mini72.0
GPT-OSS-120B62.0
Qwen3.5-122B-A10B72.0
Qwen3.5-27B base72.4
C2Rust (ours)70.6

Fixed evaluation protocol

The 200-program benchmark contains 92 argv and 108 stdin tasks. Each score is averaged over five stochastic seeds.

Temperature
0.6
Top-p / Top-k
0.95 / 20
Maximum output
1,536 tokens
Repair budget
6 attempts
Evaluation
5 seeds
Benchmark
200 programs

Open Model & Evaluation

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.

BaseQwen3.5-27BTrainingFull parameterPrecisionBF16
View model card
Quick start
# 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 2

Reproducing the Evaluation

Use the released SACTOR-based harness, smoke-test the environment, and aggregate five complete seeds.

1

Prepare paths

bash fix_paths.sh
2

Build the engine

cd engine && uv sync
3

Smoke test

python3 scripts/run_eval.py ... --limit 2
4

Run five seeds

TAG=mymodel ./run_5seed.sh

Limitations & Future Work

  1. 1

    Passing the supplied tests demonstrates observed behavioral agreement; it is not a formal proof of semantic equivalence, memory safety, or security.

  2. 2

    Stage 3 uses function- and program-level pairs but excludes project-level examples, leaving a gap for full-codebase migration.

  3. 3

    SWE-bench Verified decreases from 72.4 for the base checkpoint to 70.6, indicating modest capability narrowing after specialization.

  4. 4

    The report does not yet isolate the marginal contribution of each curriculum stage through a systematic ablation.

Citation

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}
}