Downloads · 30 days
0
Mohamed-Fasidh/math-tutor-gemma-lora
math-tutor-gemma-lora is a machine learning model from Mohamed-Fasidh. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This project presents a fine-tuned AI Tutor built on top of Gemma-2B using QLoRA (LoRA + 4-bit quantization). The model is designed to solve linear algebra equations step-by-step with structured and consistent outputs.
Downloads · 30 days
0
Access
Public
Updated Mar 29, 2026
Repo size
38.1 MB
Likes
1
Public
Click a slice to open those files.
.json34.4 MB · 90%
From the Hugging Face model README
This project presents a fine-tuned AI Tutor built on top of Gemma-2B using QLoRA (LoRA + 4-bit quantization). The model is designed to solve linear algebra equations step-by-step with structured and consistent outputs.
The goal of this project is to transform a general-purpose language model into a domain-specific tutoring system that demonstrates improved correctness and instructional clarity.
The fine-tuned model is designed as a math tutor that:
Evaluation was conducted on 30 unseen test problems.
| Model | Accuracy |
|---|---|
| Base Model | 1 / 30 |
| Fine-Tuned | 30 / 30 |
The fine-tuned model shows significant improvement in correctness and reliability.
Input: Solve 2x + 4 = 10
Output: 2x = 10 - 4 2x = 6 x = 3
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
model_name = "google/gemma-2b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
base_model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "your-username/math-tutor-gemma-lora")
prompt = """You are a math tutor.
Solve step-by-step.
### Question:
Solve 2x + 4 = 10
### Answer:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
lora-adapter/ → Fine-tuned LoRA weightsREADME.md → Project documentationMohamed Fasidh
🔗 https://github.com/Mohamed-Fasidh
🔗 https://www.linkedin.com/in/mohamed-fasidh/
This project uses publicly available models and synthetic data. Ensure compliance with base model licensing when using commercially.