Text Generation
Transformers
Safetensors
Urdu
English
gemma3_text
urdu
pakistan
gemma3
education
reasoning
instruction-tuning
adaption
autoscientist
adaptive-data
urdummlu
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use abdullah693/gemma-3-4b-it-urdu-edu-reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abdullah693/gemma-3-4b-it-urdu-edu-reasoning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="abdullah693/gemma-3-4b-it-urdu-edu-reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("abdullah693/gemma-3-4b-it-urdu-edu-reasoning") model = AutoModelForCausalLM.from_pretrained("abdullah693/gemma-3-4b-it-urdu-edu-reasoning", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use abdullah693/gemma-3-4b-it-urdu-edu-reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "abdullah693/gemma-3-4b-it-urdu-edu-reasoning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdullah693/gemma-3-4b-it-urdu-edu-reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/abdullah693/gemma-3-4b-it-urdu-edu-reasoning
- SGLang
How to use abdullah693/gemma-3-4b-it-urdu-edu-reasoning with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "abdullah693/gemma-3-4b-it-urdu-edu-reasoning" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdullah693/gemma-3-4b-it-urdu-edu-reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "abdullah693/gemma-3-4b-it-urdu-edu-reasoning" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdullah693/gemma-3-4b-it-urdu-edu-reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use abdullah693/gemma-3-4b-it-urdu-edu-reasoning with Docker Model Runner:
docker model run hf.co/abdullah693/gemma-3-4b-it-urdu-edu-reasoning
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: google/gemma-3-4b-it
|
| 4 |
+
language:
|
| 5 |
+
- ur
|
| 6 |
+
- en
|
| 7 |
+
library_name: transformers
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- urdu
|
| 11 |
+
- pakistan
|
| 12 |
+
- gemma3
|
| 13 |
+
- full-finetune
|
| 14 |
+
- education
|
| 15 |
+
- reasoning
|
| 16 |
+
- instruction-tuning
|
| 17 |
+
- adaption
|
| 18 |
+
- urdummlu
|
| 19 |
+
datasets:
|
| 20 |
+
- abdullah693/adaption-urdu-edu-cultural-reasoning
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Gemma-3-4B Urdu Education & Reasoning (full fine-tune)
|
| 24 |
+
|
| 25 |
+
A **full fine-tune** of [`google/gemma-3-4b-it`](https://huggingface.co/google/gemma-3-4b-it) for **Urdu education, reasoning, and culture**, trained on the UrduMMLU-aligned [abdullah693/adaption-urdu-edu-cultural-reasoning](https://huggingface.co/datasets/abdullah693/adaption-urdu-edu-cultural-reasoning) dataset. The goal is a strong **sub-5B** Urdu model: math/science reasoning, social-science and Islamic knowledge, Pakistan studies, and native Urdu literature/grammar.
|
| 26 |
+
|
| 27 |
+
> ⚠️ **Research / educational use.** Not an authoritative source for exam preparation, religious rulings, or legal/medical advice.
|
| 28 |
+
|
| 29 |
+
## At a glance
|
| 30 |
+
|
| 31 |
+
| | |
|
| 32 |
+
|---|---|
|
| 33 |
+
| **Base** | google/gemma-3-4b-it (`Gemma3ForCausalLM`, text) |
|
| 34 |
+
| **Method** | Full fine-tune (SFT) — all weights updated, not LoRA |
|
| 35 |
+
| **Training data** | [adaption-urdu-edu-cultural-reasoning](https://huggingface.co/datasets/abdullah693/adaption-urdu-edu-cultural-reasoning) (~39.9K Urdu/English QA, UrduMMLU-aligned) |
|
| 36 |
+
| **Epochs** | 3 (75 steps) |
|
| 37 |
+
| **Loss** | 2.71 → 0.96 train; eval loss ~1.13 |
|
| 38 |
+
| **Reported win rate** | 62% vs. base (pairwise preference) |
|
| 39 |
+
| **Languages** | Urdu (primary) + English |
|
| 40 |
+
| **Trained via** | Adaption AutoScientist (Together.AI backend) |
|
| 41 |
+
|
| 42 |
+
## Intended use
|
| 43 |
+
|
| 44 |
+
Urdu question answering, explanation, and reasoning across STEM, humanities/social science, Islamic studies, Pakistan studies, and Urdu language/literature. Prompt it in Urdu; it can produce concise answers or worked explanations, and can be steered into MCQ-style answers.
|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 50 |
+
import torch
|
| 51 |
+
|
| 52 |
+
mid = "abdullah693/gemma-3-4b-it-urdu-edu-reasoning"
|
| 53 |
+
tok = AutoTokenizer.from_pretrained(mid)
|
| 54 |
+
model = AutoModelForCausalLM.from_pretrained(mid, torch_dtype=torch.bfloat16, device_map="auto")
|
| 55 |
+
|
| 56 |
+
msgs = [{"role": "user", "content": "سورج اور زمین کے درمیان فاصلے کو کیا کہتے ہیں؟ مختصر وضاحت کریں۔"}]
|
| 57 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 58 |
+
out = model.generate(ids, max_new_tokens=256, do_sample=False)
|
| 59 |
+
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Evaluation
|
| 63 |
+
|
| 64 |
+
Designed to be evaluated on **[UrduMMLU](https://huggingface.co/datasets/MBZUAI/UrduMMLU)** (26,431 Urdu MCQs, 5 domains) using the paper's protocol — generation + parse the option letter, Urdu prompt, 0-/5-shot. Reference baselines (Urdu, 0-shot) for the sub-5B tier:
|
| 65 |
+
|
| 66 |
+
| Model | UrduMMLU (Urdu, 0-shot) |
|
| 67 |
+
|---|---|
|
| 68 |
+
| google/gemma-3-4b-it (this model's base) | 44.88% |
|
| 69 |
+
| Qwen3-4B | 51.70% |
|
| 70 |
+
| LLaMA-3.1-8B | 43.84% |
|
| 71 |
+
|
| 72 |
+
Goal: beat the base (~45%) and approach the sub-5B leader. *UrduMMLU scores for this fine-tune will be added once evaluated; the training set was deduplicated against UrduMMLU.*
|
| 73 |
+
|
| 74 |
+
## Training data composition
|
| 75 |
+
|
| 76 |
+
The dataset is composed to mirror UrduMMLU's domain mix (rather than over-weighting math): Urdu language/literature/grammar, MMLU humanities & social science (adapted to Urdu), STEM reasoning (GSM8K/MATH/ARC/AQuA), Islamic studies, Pakistan studies, and general knowledge. See the [dataset card](https://huggingface.co/datasets/abdullah693/adaption-urdu-edu-cultural-reasoning) for full provenance and licenses.
|
| 77 |
+
|
| 78 |
+
## Limitations
|
| 79 |
+
|
| 80 |
+
- 4B scale — limited factual depth; can hallucinate, especially on long-tail Pakistan-specific facts.
|
| 81 |
+
- Urdu grammar and Pakistan geography/current-affairs coverage in training was thin (no permissive native datasets), so these remain weaker areas.
|
| 82 |
+
- Inherits the biases and knowledge cutoff of the Gemma-3 base.
|
| 83 |
+
|
| 84 |
+
## License
|
| 85 |
+
|
| 86 |
+
Governed by the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). Fine-tuned by `abdullah693`; Urdu data adaptation via Adaption AutoScientist.
|
| 87 |
+
|
| 88 |
+
## Citation
|
| 89 |
+
|
| 90 |
+
```bibtex
|
| 91 |
+
@misc{gemma3_4b_urdu_edu_2026,
|
| 92 |
+
title = {Gemma-3-4B Urdu Education & Reasoning},
|
| 93 |
+
author = {abdullah693},
|
| 94 |
+
year = {2026},
|
| 95 |
+
url = {https://huggingface.co/abdullah693/gemma-3-4b-it-urdu-edu-reasoning}
|
| 96 |
+
}
|
| 97 |
+
```
|