Text Generation
Transformers
Safetensors
Rust
qwen3_5
image-text-to-text
code
c
code-translation
c-to-rust
qwen3.5
fine-tuning
sactor
deepspeed
conversational
Instructions to use moxin-org/C2Rust with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use moxin-org/C2Rust with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="moxin-org/C2Rust") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("moxin-org/C2Rust") model = AutoModelForMultimodalLM.from_pretrained("moxin-org/C2Rust", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use moxin-org/C2Rust with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "moxin-org/C2Rust" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "moxin-org/C2Rust", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/moxin-org/C2Rust
- SGLang
How to use moxin-org/C2Rust with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "moxin-org/C2Rust" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "moxin-org/C2Rust", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "moxin-org/C2Rust" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "moxin-org/C2Rust", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use moxin-org/C2Rust with Docker Model Runner:
docker model run hf.co/moxin-org/C2Rust
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,7 @@ tags:
|
|
| 14 |
- fine-tuning
|
| 15 |
- sactor
|
| 16 |
- deepspeed
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# C2Rust
|
|
@@ -24,12 +25,23 @@ behaviorally equivalent Rust. The model is trained with a three-stage curriculum
|
|
| 24 |
an execution-based SACTOR harness that compiles each candidate and compares its behavior with the
|
| 25 |
source C program.
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
## Results
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
### C2Rust translation success rate
|
| 34 |
|
| 35 |
Success Rate (SR) is the percentage of programs that compile and pass every end-to-end test. Scores
|
|
@@ -118,6 +130,8 @@ agreement on the supplied test suite, not formal semantic equivalence.
|
|
| 118 |
|
| 119 |
## Resources
|
| 120 |
|
|
|
|
|
|
|
| 121 |
- [Benchmark, evaluation harness, and setup instructions](https://github.com/moxin-org/C2Rust)
|
| 122 |
- [Base model: Qwen/Qwen3.5-27B](https://huggingface.co/Qwen/Qwen3.5-27B)
|
| 123 |
- [SACTOR translation engine](https://github.com/qsdrqs/sactor)
|
|
@@ -180,15 +194,13 @@ it for correctness, safety, and maintainability before use.
|
|
| 180 |
|
| 181 |
## Citation
|
| 182 |
|
| 183 |
-
The supplied manuscript has not finalized its individual author list. Until citation metadata is
|
| 184 |
-
released, cite the software artifact:
|
| 185 |
-
|
| 186 |
```bibtex
|
| 187 |
-
@
|
| 188 |
-
title
|
| 189 |
-
author
|
| 190 |
-
|
| 191 |
-
|
|
|
|
| 192 |
}
|
| 193 |
```
|
| 194 |
|
|
|
|
| 14 |
- fine-tuning
|
| 15 |
- sactor
|
| 16 |
- deepspeed
|
| 17 |
+
- arxiv:2608.13681
|
| 18 |
---
|
| 19 |
|
| 20 |
# C2Rust
|
|
|
|
| 25 |
an execution-based SACTOR harness that compiles each candidate and compares its behavior with the
|
| 26 |
source C program.
|
| 27 |
|
| 28 |
+
## Paper
|
| 29 |
+
|
| 30 |
+
**[Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining,
|
| 31 |
+
Debugging-Aware SFT, and Task-Specific SFT](https://arxiv.org/abs/2608.13681)**
|
| 32 |
+
|
| 33 |
+
Pu Zhao, Changdi Yang, Yixiao Chen, Yi Gao, Yifan Cao, Haochen Zeng, and Yanzhi Wang.<br>
|
| 34 |
+
Northeastern University · EmbodyX Inc · Aibao LLC
|
| 35 |
+
|
| 36 |
+
The arXiv title uses “Qwen3-27B”; Section 3 identifies the released source checkpoint as
|
| 37 |
+
`Qwen/Qwen3.5-27B`, which is the identifier used throughout this model card.
|
| 38 |
|
| 39 |
## Results
|
| 40 |
|
| 41 |
+
> **87.30% execution-verified C2Rust Success Rate** — a **15.00 percentage-point gain** over the
|
| 42 |
+
> untuned Qwen3.5-27B base at identical model size. The 27B checkpoint also outperforms
|
| 43 |
+
> Qwen3.5-Plus (397B total), MiniMax-M2.5 (230B total), and GLM-5 (744B total) on this benchmark.
|
| 44 |
+
|
| 45 |
### C2Rust translation success rate
|
| 46 |
|
| 47 |
Success Rate (SR) is the percentage of programs that compile and pass every end-to-end test. Scores
|
|
|
|
| 130 |
|
| 131 |
## Resources
|
| 132 |
|
| 133 |
+
- [Paper: arXiv:2608.13681](https://arxiv.org/abs/2608.13681)
|
| 134 |
+
- [Project website](https://moxin-org.github.io/C2Rust/)
|
| 135 |
- [Benchmark, evaluation harness, and setup instructions](https://github.com/moxin-org/C2Rust)
|
| 136 |
- [Base model: Qwen/Qwen3.5-27B](https://huggingface.co/Qwen/Qwen3.5-27B)
|
| 137 |
- [SACTOR translation engine](https://github.com/qsdrqs/sactor)
|
|
|
|
| 194 |
|
| 195 |
## Citation
|
| 196 |
|
|
|
|
|
|
|
|
|
|
| 197 |
```bibtex
|
| 198 |
+
@article{zhao2026c2rust,
|
| 199 |
+
title = {Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFT},
|
| 200 |
+
author = {Zhao, Pu and Yang, Changdi and Chen, Yixiao and Gao, Yi and Cao, Yifan and Zeng, Haochen and Wang, Yanzhi},
|
| 201 |
+
journal = {arXiv preprint arXiv:2608.13681},
|
| 202 |
+
year = {2026},
|
| 203 |
+
doi = {10.48550/arXiv.2608.13681}
|
| 204 |
}
|
| 205 |
```
|
| 206 |
|