--- 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 ---
Aroow-Rust-Coder-9B banner

Model Repository | Base Model | Rust
License: Apache 2.0 | Author: Convence

# **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 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(&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} } ```