Deroau commited on
Commit
e19d110
·
verified ·
1 Parent(s): cb3fcfc

Update Aroow-Rust-Coder-9B model card

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