Gemma-3 270M Fine-tuned with Unsloth on HelpSteer2
Made with Unsloth
📜 Model Description
This repository contains a version of Google's Gemma-3 270M IT model, fine-tuned for conversational instruction-following. The fine-tuning was performed using Unsloth for significantly faster training and reduced memory usage, making it possible to train on consumer-grade hardware.
The model was trained on the nvidia/HelpSteer2 dataset to improve its ability to generate helpful, safe, and contextually relevant responses in interactive chat scenarios.
⚙️ Model Details
Base Model:unsloth/gemma-3-270m-it
Fine-tuning Method: LoRA adaptation via PEFT
Dataset:nvidia/HelpSteer2
Frameworks:
Unsloth
Hugging Face Transformers
TRL
🚀 How to Use
You can easily run this model using the transformers library. Make sure you have transformers, unsloth, and torch installed.
python
1from transformers import pipeline
2import torch
34# Load the model using the text-generation pipeline5# Make sure to use your Hugging Face username and repo name6generator = pipeline(7"text-generation",8 model="farhanahmedconnect/gemma-3_finetuned",9 torch_dtype=torch.bfloat16,10 device_map="auto"11)1213# Use the Gemma-3 chat template14messages =[15{"role":"user","content":"What are the top 3 benefits of using Unsloth for model training?"},16]1718# Generate a response19outputs = generator(20 messages,21 max_new_tokens=256,22)2324# Print the generated text from the assistant25print(outputs[0]["generated_text"][-1]['content'])
🔧 Training Details
Training Data
The model was fine-tuned using the high-quality conversational dataset nvidia/HelpSteer2, which is specifically designed for instruction-following tasks. The dataset includes dialogues formatted into clear user and assistant turns, allowing the model to learn how to generate helpful, safe, and contextually relevant responses.
The training process utilized a masking technique, ensuring that the loss calculation focused solely on the assistant's replies, making the training more efficient and better aligned with conversational objectives.
Training Procedure
The fine-tuning was performed using Unsloth's FastLanguageModel and the SFTTrainer from the TRL library, which optimize both training speed and memory usage. The process involved several key steps:
Model Loading: The base model was loaded and optimized using unsloth.FastModel to ensure faster performance and memory efficiency.
LoRA Adapters: LoRA (Low-Rank Adaptation) adapters were applied for parameter-efficient fine-tuning, allowing for faster adaptation of the model with fewer parameters.
Training: The model was trained using the SFTTrainer, which enabled supervised fine-tuning specifically focused on instruction-following.
Final Model Saving: The fine-tuned LoRA adapters were saved as separate artifacts, which can easily be merged with the base model for deployment, ensuring seamless model updates and scalability.
Final Artifacts
The fine-tuned LoRA adapters and model checkpoint are available for deployment and further fine-tuning, ensuring adaptability to evolving use cases and datasets.
These artifacts provide a high-quality, efficient model that balances speed, memory efficiency, and conversational accuracy.
📊 Performance
This model demonstrates improved instruction-following capabilities compared to the base model, with enhanced performance in: