mathAI-Gemma

Model Description

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

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
    "kalkiai3000/mathAI-Gemma",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("kalkiai3000/mathAI-Gemma")

# Solve a math problem
question = "Find the derivative of f(x) = x³ + 2x² - 5x + 3"
prompt = f'''Question: {question}

Let me solve this step by step:

'''

inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=256,
        temperature=0.7,
        do_sample=True,
        pad_token_id=tokenizer.eos_token_id
    )

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Advanced Usage

# For better results, use structured prompting
def solve_math_problem(question: str, model, tokenizer):
    prompt = f'''Question: {question}

Let me solve this step by step:

Step 1: '''

    inputs = tokenizer(prompt, return_tensors="pt")
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        temperature=0.3,  # Lower temperature for more focused responses
        do_sample=True,
        top_p=0.9,
        repetition_penalty=1.1,
        pad_token_id=tokenizer.eos_token_id
    )
    
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

Model Performance

The model excels at:

  • Calculus: Derivatives, integrals, limits, optimization
  • Algebra: Quadratic equations, polynomials, systems of equations
  • Geometry: Area, volume, coordinate geometry, trigonometry
  • Physics Mathematics: Mechanics, waves, thermodynamics calculations
  • Step-by-step reasoning: Clear explanation of solution methodology

Example Outputs

Calculus Problem

Question: Find the derivative of f(x) = x³ + 2x² - 5x + 3

Let me solve this step by step:

Step 1: Apply the power rule to each term
Step 2: d/dx(x³) = 3x²
Step 3: d/dx(2x²) = 4x  
Step 4: d/dx(-5x) = -5
Step 5: d/dx(3) = 0

Therefore, f'(x) = 3x² + 4x - 5

Limitations

  • Domain Specific: Optimized for mathematics, may not perform well on general tasks
  • Language: Primarily trained on English mathematical problems
  • Complexity: Best suited for JEE-level problems (may struggle with research-level mathematics)
  • Format Dependency: Works best with structured prompting format

Responsible AI Usage

  • Designed as an educational tool to assist learning
  • Should be used alongside human verification for critical applications
  • Not intended to replace mathematical education or understanding
  • Users should verify results for important calculations

Citation

If you use this model in your research or applications, please cite:

@misc{mathAI-Gemma,
  title={MathAI-Gemma: A Specialized Mathematical Reasoning Model for JEE Problems},
  author={kalkiai3000},
  year={2024},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/kalkiai3000/mathAI-Gemma}}
}

License

This model is released under the Apache 2.0 License, following the base Gemma model licensing.

Acknowledgments

  • Google for the base Gemma 2B model
  • Hugging Face for the transformers library and hosting
  • JEE problem dataset contributors
  • Mathematical education community

Built with ❤️ for mathematical education and learning

Downloads last month
6
Safetensors
Model size
2.61B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kalkiai3000/mathAI-Gemma

Base model

google/gemma-2b
Finetuned
(226)
this model