CoolFace
Modelpublic

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

sourceHugging Facegemmaupdated 6mo agoView on Hugging Face
0likes81downloads
Model Card

RustMentor 4B — GGUF (Q4KM)

A Rust programming tutor fine-tuned from Gemma 3 4B-IT. Teaches Rust by drawing comparisons to Python, Go, and TypeScript.

Model Details

Base modelgoogle/gemma-3-4b-it
Fine-tuningQLoRA (r=16, alpha=16) via Unsloth + TRL
QuantizationQ4KM (k-quant mixed precision via llama.cpp)
Size~2.5 GB
FormatGGUF (compatible with llama.cpp, PocketPal AI, Maid)
LicenseGemma

Intended Use

Offline Android coding tutor for developers learning Rust. The model:

  • —Explains Rust concepts using parallels to Python, Go, and TypeScript
  • —Covers ownership, borrowing, lifetimes, traits, error handling, async, and more
  • —Refuses out-of-domain questions (non-Rust topics)
  • —Resists prompt injection attempts

How to Run

PocketPal AI (Android): Download from the Play Store, then load this model from the HF Hub.

llama.cpp (CLI):

bash
./llama-cli -m rust-mentor-4b-Q4_K_M.gguf -p "<start_of_turn>user
Explain ownership in Rust<end_of_turn>
<start_of_turn>model
"

Training Data

Fine-tuned on 500 samples covering:

  • —16 Rust teaching conversations (ownership, borrowing, lifetimes, traits, enums, pattern matching, async, iterators, structs, strings, serde, cargo, error handling, testing, memory model)
  • —10 out-of-domain refusal examples (Java, C++, Ruby, cooking, math, etc.)
  • —9 prompt injection hardening examples (persona override, instruction extraction, jailbreak roleplay, encoded bypass, etc.)

Limitations

  • —Focused exclusively on Rust — will refuse other programming languages
  • —Comparisons are anchored to Python, Go, and TypeScript only
  • —4B model may occasionally produce less precise answers than 8B+ models
  • —Q4KM quantization may reduce quality on nuanced reasoning tasks