mathAI-Gemma is a specialized mathematical reasoning model based on Gemma 2B, fine-tuned specifically for solving JEE (Joint Entrance Examination) level mathematics problems. This model has been trained using Chain-of-Thought reasoning to provide detailed, step-by-step solutions to complex mathematical problems.
Key Features
🧮 Mathematical Reasoning: Specialized for JEE-level mathematics
🔗 Chain-of-Thought: Provides step-by-step problem solving
📚 Educational Focus: Designed for learning and teaching
🎯 High Accuracy: Trained on curated JEE problem datasets
💡 Formula Integration: Shows relevant formulas and calculations
Training Details
Base Model: google/gemma-2b
Training Method: Full fine-tuning with custom data collator
Training Dataset: JEE Mathematics Problems with Chain-of-Thought reasoning
Problem Areas: Algebra, Calculus, Geometry, Trigonometry, Physics Mathematics
Training Framework: Hugging Face Transformers
Hardware: NVIDIA A100 GPU
Usage
Quick Start
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
34# Load model and tokenizer5model = AutoModelForCausalLM.from_pretrained(6"kalkiai3000/mathAI-Gemma",7 torch_dtype=torch.bfloat16,8 device_map="auto"9)10tokenizer = AutoTokenizer.from_pretrained("kalkiai3000/mathAI-Gemma")1112# Solve a math problem13question ="Find the derivative of f(x) = x³ + 2x² - 5x + 3"14prompt =f'''Question: {question}1516Let me solve this step by step:
1718'''1920inputs = tokenizer(prompt, return_tensors="pt")21with torch.no_grad():22 outputs = model.generate(23**inputs,24 max_new_tokens=256,25 temperature=0.7,26 do_sample=True,27 pad_token_id=tokenizer.eos_token_id
28)2930response = tokenizer.decode(outputs[0], skip_special_tokens=True)31print(response)
Advanced Usage
python
1# For better results, use structured prompting2defsolve_math_problem(question:str, model, tokenizer):3 prompt =f'''Question: {question}45Let me solve this step by step:
67Step 1: '''89 inputs = tokenizer(prompt, return_tensors="pt")10 outputs = model.generate(11**inputs,12 max_new_tokens=512,13 temperature=0.3,# Lower temperature for more focused responses14 do_sample=True,15 top_p=0.9,16 repetition_penalty=1.1,17 pad_token_id=tokenizer.eos_token_id
18)1920return tokenizer.decode(outputs[0], skip_special_tokens=True)