RustMentor 1B Mobile
A 1B-parameter Gemma3-based model fine-tuned for Rust programming education and code review, optimized for on-device mobile inference on Pixel 8 Pro.
This repository hosts the LoRA adapter weights. For the LiteRT (.litertlm) version for Google AI Edge Gallery, see rust-mentor-1b-mobile-LiteRT.
Model Description
- Base Model: google/gemma-3-1b-it
- Parameters: 1B
- Context Length: 2048 tokens
- Fine-tuning: QLoRA (r=16, alpha=16) with Unsloth
- License: Gemma
- Language: English, Rust code
- Target: Offline Rust tutor on Android (Pixel 8 Pro)
What It Does
- Explains Rust ownership, borrowing, and lifetimes with Go/Python/TS comparisons
- Code review with borrow checker explanations
- Error handling patterns (Result, Option, ?, thiserror, anyhow)
- Async/await and Tokio patterns
- Smart pointers, pattern matching, traits, generics
- CLI tooling with clap, Cargo project structure
- Serde & JSON serialization, testing patterns
Prompt Examples
"In Go, I just pass values or pointers. What's this ownership thing in Rust?"
"Review this Rust code and explain what the borrow checker is doing"
"How do I handle errors in Rust? I'm used to Go's if err != nil pattern."
"How does async work in Rust? In Go I just use goroutines."
Training Data
- Strandset-Rust-v1: 3,000 samples of Rust code generation, review, refactoring
- Synthetic tutor conversations: 46 unique hand-crafted dialogues across 28 Rust topics
- Style: All conversations draw parallels to Go/Python/TypeScript
Training Configuration
| Parameter | Value |
|---|---|
| Base Model | google/gemma-3-1b-it |
| Method | QLoRA via Unsloth |
| LoRA Rank | 16 |
| Epochs | 3 |
| Batch Size | 2 x 4 (effective 8) |
| Learning Rate | 2e-4 (cosine) |
| Max Sequence Length | 2048 |
Safety & Limitations
- May generate incorrect code — always compile and test
- Optimized for tutoring, not production code generation
- Training data focuses on CLI/systems patterns
License
Gemma license — free for commercial use. See Gemma Terms.
Contact
- Maintainer: Sylvester Francis
- Repository: github.com/sylvester-francis/slm-rust-model