This model is a fine-tuned version of Qwen/Qwen2.5-3B-Instruct specifically trained on Urdu mathematical reasoning tasks. The model was trained on the PuristanLabs1/GSM8K_Urdu dataset, enabling it to solve grade school math problems with step by step reasoning in Urdu (اردو).
Training Method: Parameter-efficient fine-tuning with LoRA
Usage
Installation
pip install unsloth transformers accelerate
Basic Usage
python
1from unsloth import FastLanguageModel
23# Load model4model, tokenizer = FastLanguageModel.from_pretrained(5"PuristanLabs1/qwen2.5-3B-GSM8K-urdu",6 max_seq_length=1024,7 load_in_4bit=True,8)910# Enable inference mode11FastLanguageModel.for_inference(model)1213# Prepare your question14question ="احمد کے پاس 15 سیب ہیں۔ وہ اپنے 3 دوستوں میں برابر تقسیم کرنا چاہتا ہے۔ ہر دوست کو کتنے سیب ملیں گے؟"1516# Format prompt17prompt =f"""<|im_start|>system
18آپ ایک ریاضی کے ماہر ہیں جو اردو میں مسائل حل کرتے ہیں۔ ہر مسئلے کو قدم بہ قدم حل کریں۔<|im_end|>
19<|im_start|>user
20{question}<|im_end|>
21<|im_start|>assistant
22"""2324# Generate response25inputs = tokenizer(prompt, return_tensors="pt").to("cuda")26outputs = model.generate(27**inputs,28 max_new_tokens=512,29 temperature=0.7,30 top_p=0.9,31 eos_token_id=tokenizer.encode("<|im_end|>", add_special_tokens=False)[0],32)3334# Extract answer35response = tokenizer.decode(outputs[0], skip_special_tokens=False)36answer = response.split("<|im_start|>assistant")[-1].split("<|im_end|>")[0].strip()37print(answer)
Output:
ہر دوست کو 15/3=<<15/3=5>>5 سیب ملتے ہیں۔
Advanced Usage with Custom Parameters
python
1# For more creative responses2outputs = model.generate(3**inputs,4 max_new_tokens=512,5 temperature=0.8,6 top_p=0.95,7 do_sample=True,8 repetition_penalty=1.1,9)1011# For more deterministic responses12outputs = model.generate(13**inputs,14 max_new_tokens=512,15 temperature=0.3,16 top_p=0.9,17 do_sample=True,18)
Example Outputs
Example 1: Simple Division
Question: احمد کے پاس 15 سیب ہیں۔ وہ اپنے 3 دوستوں میں برابر تقسیم کرنا چاہتا ہے۔ ہر دوست کو کتنے سیب ملیں گے؟
Model Output:
ہر دوست کو 15/3=<<15/3=5>>5 سیب ملتے ہیں۔
Example 2: Multi-step Problem
Question: ایک دکان میں 5 قلم 125 روپے میں ملتے ہیں۔ اگر میں 12 قلم خریدوں تو کتنے روپے خرچ ہوں گے؟
Model Output:
ایک قلم کی قیمت 125/5 = <<125/5=25>>25 ڈالر ہے۔
لہذا، 12 قلم کی قیمت 25*12 = <<25*12=300>>300 ڈالر ہے۔
Example 3: Complex Word Problem
Question: احمد کے پاس 50 روپے تھے۔ اس نے 15 روپے کی کتاب اور 12 روپے کا قلم خریدا۔ پھر اس کے والد نے اسے 30 روپے دیے۔ اب احمد کے پاس کتنے روپے ہیں؟
Model Output:
اُس نے کتابوں اور قلم پر $15 + $12 = $<<15+12=27>>27 خرچ کیے۔
اُس کے پاس $50 - $27 = $<<50-27=23>>23 باقی بچے۔
اُس کے والد نے اُسے $30 مزید ملے، تو اب اُس کے پاس $23 + $30 = $<<23+30=53>>53 ہیں۔
Performance
Accuracy on Test Set
Mathematical Correctness: 100% on tested examples
Step-by-step Reasoning: Excellent
Urdu Fluency: Very Good
Multi-step Problems: Handles well
Strengths
✅ Accurate Calculations - Performs arithmetic operations correctly
✅ Step-by-step Reasoning - Shows work using <<calculation>> format
✅ Multi-step Problems - Handles complex word problems with multiple operations
✅ Urdu Fluency - Generates natural Urdu text
✅ Consistent Format - Follows GSM8K-style reasoning format
Known Limitations
[!WARNING]
Currency Symbol Inconsistency
The model sometimes uses "$" or "ڈالر" (dollar) instead of "روپے" (rupees) in responses, even when the question uses "روپے". This is an artifact from the original GSM8K dataset which uses dollars.
Impact: This does not affect mathematical accuracy, only the currency symbol used in the output.
Planned Fix: This will be addressed in the next version.
[!NOTE]
Real-world Constraints
The model may not always recognize practical constraints (e.g., calculating 7.5 students per group when dividing 45 students into 6 groups). It provides mathematically correct answers but may not account for real-world impossibilities.
Other Limitations
Trained on grade-school level math (GSM8K difficulty)
May struggle with very advanced mathematical concepts
Limited to problems that can be solved with basic arithmetic
Best performance on problems similar to training data
Intended Use
Primary Use Cases
✅ Educational tools for Urdu-speaking students
✅ Math tutoring applications
✅ Automated homework assistance
✅ Mathematical reasoning research
✅ Urdu NLP benchmarking
Out of Scope
❌ Advanced mathematics (calculus, linear algebra, etc.)
❌ Financial calculations requiring precision
❌ Real-time production systems without validation
❌ Medical or safety-critical applications
Ethical Considerations
Educational Aid: This model is designed to assist learning, not replace teachers
Verification Required: Always verify model outputs, especially in educational settings
Language Preservation: Contributes to Urdu language technology development
Accessibility: Makes mathematical reasoning tools available in Urdu
Future Improvements
The following improvements are planned for v2:
Currency Symbol Fix - Replace "$" with "روپے" in outputs
Extended Training - More epochs for better convergence
Larger Dataset - Include more diverse Urdu math problems
Real-world Constraints - Add training data for practical limitations
Advanced Math - Expand to higher-level mathematical concepts
Model Card Authors
PuristanLabs
Citation
If you use this model in your research or applications, please cite:
bibtex
1@misc{qwen25-math-urdu-2025,
2 author = {PuristanLabs},
3 title = {Qwen2.5-Math-7B Fine-tuned on Urdu GSM8K},
4 year = {2025},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/PuristanLabs1/qwen2.5-math-7b-GSM8K-urdu}},
7}