MassivDash's picture
Create README.md
b0ea4f1 verified
|
Raw
History Blame Contribute Delete
3.83 kB
metadata
base_model:
  - google/gemma-4-12B-it
pipeline_tag: text-generation
library_name: transformers
datasets:
  - Fortytwo-Network/Strandset-Rust-v1
license: mit
tags:
  - fine-tuned
  - rust
  - coding
  - unsloth
  - spaceout.pl

Gemma-4-12B-Rust-Coder

This model is a specialized fine-tune of Google's Gemma-4-12B-it, rigorously optimized for Rust systems programming, memory safety patterns, and high-performance application development.

While the base model provides excellent general reasoning, this fine-tune specifically enhances idiomatic Rust code generation, handling of advanced concurrency constraints, and standard library familiarity.

πŸ¦€ Fine-Tuning Focus & Model Details

  • Base Model: google/gemma-4-12B-it
  • Target Domain: Rust software development and debugging.
  • Key Improvements:
    • Idiomatic Rust: Generates clean, "Rusty" code utilizing modern patterns (e.g., proper Result and Option handling, idiomatic error propagation).
    • Concurrency & Safety: Enhanced understanding of strict borrow checker rules, lifetimes, Send/Sync traits, and async runtimes like Tokio.
    • Instruction Following: Tuned to deliver concise, code-first responses with minimal conversational overhead compared to the base model.

🀝 Training Data & Acknowledgments

Special thanks to Fortytwo-Network for providing the Strandset-Rust-v1 dataset. This model's specialized knowledge of the Rust ecosystem is a direct result of fine-tuning on this high-quality, domain-specific instruction set.

βš™οΈ Training Procedure

This model was trained using Unsloth Studio for optimal memory efficiency and throughput.

  • Method: QLoRA
  • Steps: 30
  • Tokens Processed: 148,306
  • Learning Rate: 8.00e-6
  • Final Loss: 1.1045
  • Training Time: 3 minutes 57 seconds
  • Hardware: [Enter your GPU here, e.g., 1x RTX 4090 / A100]

πŸš€ Usage

You can easily load and run this model using the Hugging Face transformers library.

Installation:

pip install transformers accelerate torch

Inference Snippet:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "MassivDash/Gemma-4-12B-Rust-Coder"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
    torch_dtype=torch.bfloat16
)

messages = [
    {"role": "user", "content": "Write an asynchronous Rust function using Tokio to fetch a URL and return its body as a String. Handle errors idiomatically."}
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda")

outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

⚠️ Limitations & Out-of-Scope Use

  • Language Degradation: Because this model was heavily fine-tuned on Rust, its performance in other languages (like Python or JavaScript) may have degraded relative to the base model (catastrophic forgetting).
  • Non-Coding Tasks: It is designed specifically for technical and programming queries. It is not recommended for creative writing, general knowledge trivia, or non-technical instruction following.
  • Compilation Guarantees: While fine-tuned for syntax and borrow-checker compliance, the model may still occasionally generate code that fails to compile or contains logical bugs. Always review and test generated code.

πŸ”— Stay Connected

For more insights on AI development, custom integrations, and fine-tuning, visit my blog: πŸ‘‰ spaceout.pl


This model was trained 2x faster with Unsloth