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") 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
Gemma-3-4B Urdu Education & Reasoning (full fine-tune)
A full fine-tune of google/gemma-3-4b-it for Urdu education, reasoning, and culture, trained on the UrduMMLU-aligned 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.
⚠️ Research / educational use. Not an authoritative source for exam preparation, religious rulings, or legal/medical advice.
At a glance
| Base | google/gemma-3-4b-it (Gemma3ForCausalLM, text) |
| Method | Full fine-tune (SFT) — all weights updated, not LoRA |
| Training data | adaption-urdu-edu-cultural-reasoning (~39.9K Urdu/English QA, UrduMMLU-aligned) |
| Epochs | 3 (75 steps) |
| Loss | 2.71 → 0.96 train; eval loss ~1.13 |
| Reported win rate | 62% vs. base (pairwise preference) |
| Languages | Urdu (primary) + English |
| Trained via | Adaption AutoScientist (Together.AI backend) |
Intended use
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.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
mid = "abdullah693/gemma-3-4b-it-urdu-edu-reasoning"
tok = AutoTokenizer.from_pretrained(mid)
model = AutoModelForCausalLM.from_pretrained(mid, torch_dtype=torch.bfloat16, device_map="auto")
msgs = [{"role": "user", "content": "سورج اور زمین کے درمیان فاصلے کو کیا کہتے ہیں؟ مختصر وضاحت کریں۔"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Evaluation
Designed to be evaluated on 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:
| Model | UrduMMLU (Urdu, 0-shot) |
|---|---|
| google/gemma-3-4b-it (this model's base) | 44.88% |
| Qwen3-4B | 51.70% |
| LLaMA-3.1-8B | 43.84% |
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.
Training data composition
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 for full provenance and licenses.
Limitations
- 4B scale — limited factual depth; can hallucinate, especially on long-tail Pakistan-specific facts.
- Urdu grammar and Pakistan geography/current-affairs coverage in training was thin (no permissive native datasets), so these remain weaker areas.
- Inherits the biases and knowledge cutoff of the Gemma-3 base.
License
Governed by the Gemma Terms of Use. Fine-tuned by abdullah693; Urdu data adaptation via Adaption AutoScientist.
Citation
@misc{gemma3_4b_urdu_edu_2026,
title = {Gemma-3-4B Urdu Education & Reasoning},
author = {abdullah693},
year = {2026},
url = {https://huggingface.co/abdullah693/gemma-3-4b-it-urdu-edu-reasoning}
}
- Downloads last month
- 11