File size: 1,526 Bytes
931ee76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ---
title: RustGen
emoji: π¦
colorFrom: gray
colorTo: red
sdk: gradio
sdk_version: 6.18.0
app_file: app.py
pinned: false
short_description: Paste Python, get execution-verified Rust
---
# RustGen
Teaching a small code model a new language. You give it a Python function or an
English description; a vanilla **Qwen2.5-Coder-1.5B** writes the Rust, and `rustc`
compiles and tests the result before it is shown. When the first attempt fails to
compile, a **compile-guided cascade** retries with a retrieved idiom exemplar plus
similar examples β retrieval is only used to recover compile failures, never to
inflate the output blindly.
## What it does
- **Python β Rust** β the primary task; the model translates a Python function.
- **English β Rust** β direct, or via a Python pivot (Qwen drafts Python first).
- **Verification** β every output is compiled and run against tests; paste your own
asserts in *Reference tests* to check against ground truth.
## Results (MultiPL-E humaneval-rs, 156 problems, same harness)
| System | pass@1 |
|---|---|
| Qwen-1.5B vanilla | 37.8% |
| + compile-guided cascade | 44.9% |
| + compiler-feedback repair | 46.2% |
| Qwen-7B-4bit + full pipeline | 62.8% |
The live demo runs the 1.5B cascade. The 7B figures are measured offline.
## Notes
- On a free CPU Space, generation takes a while per attempt (the cascade may run a
few). Upgrade the Space hardware to a GPU for interactive speed.
- The models are downloaded from the Hub on first use; no token required.
|