Text Generation
Transformers
Safetensors
Rust
English
qwen3_5
image-text-to-text
code
code-generation
code-completion
fill-in-the-middle
conversational
Instructions to use Convence/Aroow-Rust-Coder-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Convence/Aroow-Rust-Coder-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Convence/Aroow-Rust-Coder-9B") 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)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Convence/Aroow-Rust-Coder-9B") model = AutoModelForImageTextToText.from_pretrained("Convence/Aroow-Rust-Coder-9B") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Convence/Aroow-Rust-Coder-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Convence/Aroow-Rust-Coder-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Convence/Aroow-Rust-Coder-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Convence/Aroow-Rust-Coder-9B
- SGLang
How to use Convence/Aroow-Rust-Coder-9B 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 "Convence/Aroow-Rust-Coder-9B" \ --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": "Convence/Aroow-Rust-Coder-9B", "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 "Convence/Aroow-Rust-Coder-9B" \ --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": "Convence/Aroow-Rust-Coder-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Convence/Aroow-Rust-Coder-9B with Docker Model Runner:
docker model run hf.co/Convence/Aroow-Rust-Coder-9B
File size: 7,920 Bytes
cb3fcfc ebcc82d cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc 8754c53 e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 cb3fcfc e19d110 ebcc82d | 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | ---
library_name: transformers
license: apache-2.0
license_link: https://www.apache.org/licenses/LICENSE-2.0
pipeline_tag: text-generation
base_model:
- Qwen/Qwen3.5-9B
language:
- en
tags:
- rust
- code
- code-generation
- code-completion
- fill-in-the-middle
---
<div align="center">
<img src="assets/aroow-rust-coder-9b-banner.png" alt="Aroow-Rust-Coder-9B banner">
</div>
<p align="center">
<a href="https://huggingface.co/Convence/Aroow-Rust-Coder-9B" target="_blank">Model Repository</a>
|
<a href="https://huggingface.co/Qwen/Qwen3.5-9B" target="_blank">Base Model</a>
|
<a href="https://www.rust-lang.org/" target="_blank">Rust</a>
<br>
<b>License</b>: <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache 2.0</a>
|
<b>Author</b>: Convence
</p>
# **Aroow-Rust-Coder-9B**
**Aroow-Rust-Coder-9B** is a Rust-focused coding model by **Convence**, finetuned off **`Qwen/Qwen3.5-9B`**. It is designed for Rust code generation, code completion, source understanding, fill-in-the-middle editing, unit-test drafting, and practical programming assistance.
The model is intended for developers who want a Rust-specialized assistant that can work with function signatures, module snippets, tests, compiler errors, and implementation requirements. It should be used as part of a normal Rust development workflow with compiler checks, tests, formatting, and review.
## **Model Summary**
| Property | Value |
| :---- | :---- |
| **Model Name** | Aroow-Rust-Coder-9B |
| **Base Model** | `Qwen/Qwen3.5-9B` |
| **Primary Task** | Rust code generation and completion |
| **Output Focus** | Rust source code, tests, explanations, refactors |
| **License** | Apache 2.0 |
## **Intended Use**
Aroow-Rust-Coder-9B is intended for Rust programming assistance in editor, notebook, local inference, and agent-style coding workflows.
Suitable use cases include:
* generating Rust functions from requirements
* completing partial Rust files
* writing unit tests
* explaining Rust code
* rewriting snippets into more idiomatic Rust
* assisting with ownership, borrowing, and trait-related issues
* creating examples for APIs, structs, enums, traits, and modules
* filling missing code between existing prefix and suffix context
The model is most useful when prompts include concrete constraints, function signatures, examples, or expected behavior.
## **Core Capabilities**
* **Rust Code Generation** - Produces functions, structs, enums, traits, impl blocks, modules, and tests.
* **Code Completion** - Continues partial Rust code with awareness of surrounding context.
* **Fill-in-the-Middle Editing** - Completes missing code between prefix and suffix blocks.
* **Unit-Test Drafting** - Generates `#[test]` functions and `#[cfg(test)]` modules.
* **Code Explanation** - Explains Rust snippets, control flow, type behavior, and common compiler issues.
* **Refactoring Assistance** - Suggests cleaner structure, safer patterns, and more idiomatic Rust.
* **Error-Handling Patterns** - Supports `Result`, `Option`, `?`, pattern matching, and recoverable error flow.
* **Standard Library Usage** - Works with common collections, iterators, slices, strings, traits, and modules.
## **Getting Started**
Install the required packages:
```bash
pip install -U transformers peft torch accelerate
```
Load the base model and adapter:
```python
import torch
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoProcessor
BASE_MODEL = "Qwen/Qwen3.5-9B"
ADAPTER_ID = "Convence/Aroow-Rust-Coder-9B"
processor = AutoProcessor.from_pretrained(BASE_MODEL, trust_remote_code=True)
tokenizer = processor.tokenizer
model = AutoModelForImageTextToText.from_pretrained(
BASE_MODEL,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
model = PeftModel.from_pretrained(model, ADAPTER_ID)
model.eval()
```
Generate a Rust answer:
```python
messages = [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are Aroow-Rust-Coder-9B, a Rust-focused coding assistant made by Convence. Write clear, safe, idiomatic Rust.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Write a Rust function that returns the first duplicate integer in a slice, or None if there is no duplicate. Include unit tests.",
}
],
},
]
prompt = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
input_len = inputs["input_ids"].shape[-1]
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.2,
top_p=0.95,
)
response = tokenizer.decode(outputs[0][input_len:], skip_special_tokens=True)
print(response)
```
## **Prompt Examples**
### Function Implementation
```text
Write a Rust function:
fn normalize_counts(values: &[u32]) -> Vec<f64>
Requirements:
* return an empty vector for empty input
* divide each value by the total sum
* avoid division by zero
* include unit tests
```
### Compiler Error Help
````text
This Rust code does not compile. Explain the issue and rewrite it idiomatically:
```rust
fn main() {
let values = vec![String::from("alpha"), String::from("beta")];
let first = values[0];
println!("{:?}", values);
println!("{}", first);
}
```
````
### Fill-in-the-Middle Completion
````text
Fill in the missing Rust code between this prefix and suffix. Return only the missing code.
Prefix:
```rust
impl Cache {
pub fn get_or_insert_with<F>(&mut self, key: String, f: F) -> &Value
where
F: FnOnce() -> Value,
{
```
Suffix:
```rust
}
}
```
````
## **Recommended Usage**
For best results:
* provide exact function signatures when possible
* include edge cases and expected behavior
* state whether external crates are allowed
* ask for tests when correctness matters
* run generated code through `cargo check`
* run tests with `cargo test`
* format generated code with `cargo fmt`
* inspect suggestions before applying them to production code
For deterministic code generation, use a low temperature such as `0.1` to `0.3`. For brainstorming alternative designs, use a higher temperature with careful review.
## **Validation Workflow**
Generated code should be treated as a draft. A recommended Rust validation workflow is:
```bash
cargo fmt
cargo check
cargo test
cargo clippy
```
For security-sensitive code, add manual review, dependency review, fuzzing, property tests, and threat modeling where appropriate.
## **Limitations**
Aroow-Rust-Coder-9B may:
* produce code that does not compile
* comit imports, feature flags, or crate dependencies
* misunderstand complex lifetimes or trait bounds
* generate tests that do not cover important edge cases
* hallucinate APIs or crate behavior
* produce code that appears correct but fails under real inputs
* give incomplete explanations of compiler errors
The model should not be used as the sole authority for security-critical, safety-critical, medical, legal, financial, cryptographic, or infrastructure-critical code.
## **Safety**
Developers should avoid sending secrets, credentials, private keys, unreleased proprietary source code, personal data, or regulated information to public inference endpoints.
Generated code should be reviewed before use. Pay special attention to:
* `unsafe` blocks
* FFI
* raw pointers
* authentication logic
* cryptography
* file-system access
* network-facing code
* dependency and supply-chain risk
## **Citation**
```bibtex
@misc{convence2026aroowrustcoder9b,
title={Aroow-Rust-Coder-9B},
author={Convence},
year={2026},
url={https://huggingface.co/Convence/Aroow-Rust-Coder-9B}
}
``` |