CoolFace
Modelpublic

sylvester-francis/rust-mentor-0.6b-GGUF

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
1likes78downloads
Model Card

RustMentor-0.6B-GGUF

RustMentor-0.6B-GGUF is a 0.6B-parameter Qwen3-based model fine-tuned for Rust programming education and code review. It merges the base model with LoRA adapters and includes GGUF quantization for local/mobile/Ollama workflows.

This repository hosts the GGUF quantized model (Q4KM) for lightweight inference. For the LoRA adapter, see rust-mentor-0.6b.

Model Description

  • —Base Model: Qwen/Qwen3-0.6B
  • —Model Type: Causal LM (code tutoring + review)
  • —Parameters: 0.6B
  • —Context Length: 2048 tokens
  • —Fine-tuning: QLoRA (r=8, alpha=8) with Unsloth optimization
  • —Quantization: Q4KM (~0.4GB)
  • —License: Apache 2.0
  • —Language: English, Rust code
  • —System Prompt: Rust programming tutor for experienced Go/Python/TypeScript developers learning Rust by building CLI tools.

What It Is Good At

  • —Explaining 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 (Box, Rc, Arc, RefCell)
  • —Pattern matching and enum-based design
  • —Trait-based architecture and generics
  • —Type conversions (From, Into, AsRef, Deref)
  • —Serde & JSON serialization
  • —CLI tooling with clap
  • —Cargo project structure, modules, and workspaces
  • —Testing patterns and documentation

Intended Uses

Primary: Offline Rust programming tutor on Android (Pixel 8 Pro tested) via PocketPal AI, or local inference via Ollama/llama.cpp.

Out-of-scope: General-purpose chat, non-Rust programming, safety-sensitive or factual tasks outside Rust development.

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:\n\nfn get_longest(a: String, b: String) -> String {\n    if a.len() > b.len() { a } else { b }\n}"

"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 and it's simple."

How to Use

PocketPal AI (Android — Offline)

  1. 1.Install PocketPal AI from Play Store
  2. 2.Tap "Add from Hugging Face"
  3. 3.Search: sylvester-francis/rust-mentor-0.6b-GGUF
  4. 4.Download the Q4KM quantization (~0.4GB)
  5. 5.Create a "Pal" with the Rust tutor system prompt
  6. 6.Enable airplane mode and start learning!

Ollama (Local)

bash
# Download the GGUF
huggingface-cli download sylvester-francis/rust-mentor-0.6b-GGUF \
  --local-dir ./models/rust-mentor

# Create Modelfile
cat > Modelfile << 'MODELFILE'
FROM ./models/rust-mentor/<gguf-filename>.gguf

SYSTEM """You are RustMentor, an expert Rust programming tutor. The student is an experienced Go, Python, and TypeScript developer learning Rust by building CLI tools. Draw parallels to Go/Python/TypeScript concepts. Explain ownership, borrowing, and lifetimes with practical examples."""

PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER num_ctx 2048
MODELFILE

ollama create rust-mentor -f Modelfile
ollama run rust-mentor "Explain Rust's ownership vs Go's garbage collector"

llama.cpp

bash
huggingface-cli download sylvester-francis/rust-mentor-0.6b-GGUF \
  --local-dir ./models

./llama-cli -m ./models/<gguf-filename>.gguf \
  -p "Explain and fix this Rust borrow checker error..."

Training Data (Summary)

  • —Strandset-Rust-v1: 3,000 samples of Rust code generation, review, refactoring, and bug detection tasks
  • —Synthetic tutor conversations: 46 unique hand-crafted Rust tutoring dialogues across 28 topics, covering ownership, error handling, traits, async, smart pointers, macros, serde, testing, and more
  • —Style: All conversations draw parallels to Go/Python/TypeScript equivalents

Training Configuration (QLoRA)

ParameterValue
Base ModelQwen/Qwen3-0.6B
MethodQLoRA via Unsloth
LoRA Rank (r)8
LoRA Alpha8
Target Modulesqproj, kproj, vproj, oproj, gateproj, upproj, down_proj
Epochs3
Batch Size4 x 2 (effective 8)
Learning Rate2e-4 (cosine schedule)
Max Sequence Length2048
HardwareNVIDIA A100 40GB (Google Colab)

Evaluation

Qualitative checks on Rust tutoring prompts show:

  • —Clear explanations with Go/Python/TypeScript comparisons
  • —Accurate code examples with proper ownership and borrowing
  • —Borrow checker explanations in code reviews
  • —Appropriate use of idiomatic Rust patterns

Safety & Limitations

  • —May generate incorrect code or hallucinate crate APIs — review before production use.
  • —Not a replacement for the Rust compiler or clippy — always compile and test generated code.
  • —Optimized for tutoring, not production code generation at scale.
  • —Training data focuses on CLI/systems patterns; web framework coverage (Axum, Actix) is limited.

License

Apache 2.0 for the fine-tuned model; base model (Qwen/Qwen3-0.6B) license also applies.

Contact