🌸 Sindhi Gemma 4 E2B IT (128k Pruned, SFT)
sindhi-gemma-4-E2B-it-128k-sft is a state-of-the-art, instruction-fine-tuned, lightweight language model engineered specifically for the Sindhi language (سنڌي).
Built upon Google's Gemma 4 2B architecture, this model introduces two groundbreaking milestones for low-resource NLP:
- Structural Vocabulary & Modality Pruning: The vocabulary was cleanly pruned by 50.0% (from 262,144 down to 131,072 tokens) while completely removing multimodal/vision parameters, reducing VRAM usage by 36.3% and active GPU power by 28.9% with zero degradation on strict reasoning benchmarks.
- Culturally Grounded Supervised Fine-Tuning (SFT): Fine-tuned on the audited dataset
Kashif786/Sindhi-Assistant-IFT-1500covering 380+ distinct academic, legal, cultural, and everyday domains in authentic Perso-Arabic Sindhi script with strict ASCII numerals (0-9).
⚡ Key Highlights & Benchmark Victories
- Universal Dependencies (
UD_Sindhi-Isra): Achieved 73.00% UPOS zero-shot grammatical accuracy on the official Sindhi treebank (curated by Dr. Mutee U Rahman), outperforming the standard Gemma baseline (66.00%) by +10.61% relative (+7.00% absolute). - Strict Semantic Parity (Belebele
snd_Arab): Maintained an identical 45.00% reading comprehension accuracy on the standardized 100-question test set, demonstrating that reducing the vocabulary by 50% incurred zero cognitive or reasoning loss. - Dramatic Cross-Lingual Translation & Purity Boost:
- English to Sindhi translation ChrF++ skyrocketed from 14.88 (Base collapsed into English commentary) to 52.08 (+249.9% gain).
- Urdu to Sindhi translation ChrF++ jumped from 52.74 to 72.63.
- Text summarization ChrF++ advanced from 38.78 to 58.08.
- Green AI & Resource Efficiency:
- Disk Checkpoint Footprint: Reduced from 10.20 GB → 6.51 GB (-36.2%).
- Static VRAM Footprint: Reduced from 9.51 GB → 6.06 GB (-36.3%, saving 3.53 GB), enabling deployment on accessible 8GB VRAM consumer GPUs (RTX 3070/4060).
- Energy per Generated Token: Dropped by 30.8% (4.64 J/token → 3.21 J/token).
- Active GPU Power: Reduced by 28.9% (55.47 W → 39.43 W).
✂️ Architectural Breakdown & Vocabulary Pruning
Standard multimodal Gemma 4 checkpoints allocate immense parameter overhead to multi-modal visual projection matrices and an oversized 262,144-token multilingual tokenizer containing millions of dead embedding weights irrelevant to Perso-Arabic text.
How Vocabulary Pruning Was Implemented:
- Multimodal Weight Elimination: All non-text layers (vision encoders, spatial resamplers, multimodal projection bridges) were excised, yielding a streamlined, text-only transformer backbone.
- Embedding & Head Dimension Slicing: The input embedding matrix (
embed_tokens.weight) and output classification projection (lm_head.weight) were truncated from[262144, d_model]to[131072, d_model](exact 128k size). - Sindhi & Cross-Lingual Token Preservation: Full retention of all ASCII characters, standard English, Urdu, Arabic diacritics, and all 16 unique Sindhi Perso-Arabic glyphs (
ڄ,ڃ,ڪ,ڳ,ڱ,ٻ,ڌ,ڇ,ٽ,ڊ,ڦ,ٺ,ڙ,ڍ,ڏ). - ChatML / Gemma 4 Jinja Template Alignment: The fast tokenizer preserves official Gemma 4 turn delimiters (
<start_of_turn>,<end_of_turn>,user,model).
Original Gemma 4 (262,144 Vocab + Vision) -> 10.20 GB Disk / 9.51 GB VRAM
│
[Pruning Pipeline]
- Remove Vision Encoders & Projections
- Truncate Embedding / LM Head to 131,072
- Retain Complete Perso-Arabic & Latin Unicode
│
▼
Base Pruned Backbone: Kashif786/gemma-4-E2B-it-text-only-128k-pruned -> 6.51 GB Disk / 6.06 GB VRAM
│
[LoRA SFT on Sindhi-Assistant-IFT-1500]
│
▼
Standalone Merged Model: Kashif786/sindhi-gemma-4-E2B-it-128k-sft
📊 Comprehensive Empirical Benchmarks
1. Hardware, Latency & Energy Consumption Benchmarks
Evaluated on server-grade hardware comparing baseline google/gemma-4-E2B-it vs pruned sindhi-gemma-4-E2B-it-128k-sft:
| Performance Dimension | Baseline (google/gemma-4-E2B-it) | Pruned SFT (sindhi-gemma-4-E2B-it-128k-sft) | Net Gain / Delta |
|---|---|---|---|
| Vocabulary Size | 262,144 tokens | 131,072 tokens | -50.0% (Pruned) |
| Checkpoint Disk Size | 10.20 GB | 6.51 GB | -36.2% Footprint |
| Static VRAM (Model Weights) | 9,736.17 MB (~9.51 GB) | 6,204.32 MB (~6.06 GB) | -36.3% VRAM (-3.53 GB) |
| Average Peak Active VRAM | 9,826.16 MB (~9.60 GB) | 6,252.55 MB (~6.11 GB) | -36.4% Peak VRAM |
| Time-To-First-Token (TTFT) | 203.93 ms | 188.10 ms | 7.8% Faster Prefill |
| Decoding Throughput | 11.94 tokens/sec | 12.30 tokens/sec | +3.0% Throughput |
| Average Active GPU Power | 55.47 W | 39.43 W | -28.9% Lower Power (-16W) |
| Average Energy Consumption | 4.64 J/token | 3.21 J/token | -30.8% Energy Reduction |
2. Universal Dependencies Morphosyntax (UD_Sindhi-Isra)
Tested on the official Sindhi treebank UD_Sindhi-Isra (curated by Dr. Mutee U Rahman) under zero-shot Universal Part-of-Speech (UPOS) sequence labeling:
| Metric / Task | Gemma Baseline (google/gemma-4-E2B-it) | Pruned SFT Model (Kashif786/sindhi-gemma-4-E2B-it-128k-sft) | Absolute Gain (Δ) | Relative Improvement |
|---|---|---|---|---|
| UPOS Tagging Accuracy | 66.00% (66/100) | 73.00% (73/100) | +7.00% | +10.61% |
| Target Treebank | UD_Sindhi-Isra (Test) | UD_Sindhi-Isra (Test) | — | — |
| Evaluation Type | Zero-Shot UPOS Classification | Zero-Shot UPOS Classification | — | — |
3. Natural Language Understanding & Reasoning (Belebele snd_Arab)
Evaluated across 100 questions from the standardized Belebele benchmark (snd_Arab.jsonl):
| Model | Evaluated | Correct | Accuracy |
|---|---|---|---|
google/gemma-4-E2B-it (Baseline) | 100 | 45 | 45.00% |
Kashif786/sindhi-gemma-4-E2B-it-128k-sft (Ours) | 100 | 45 | 45.00% |
Key Finding: Despite removing 131,072 vocabulary tokens and stripping all multimodal projections, the model maintained 100% semantic parity on high-level reading comprehension, disproving the common hypothesis that vocabulary pruning impairs linguistic cognition.
4. Cross-Lingual Translation & Text Summarization Benchmarks
| Task | Metric | Base Gemma | Pruned SFT Model | Delta | Observations |
|---|---|---|---|---|---|
| EN → SD Translation | ChrF++ ROUGE-L Sindhi Purity | 14.88 0.00% 1.54% | 52.08 28.57% 8.93% | +37.20 — +7.39% | Base model hallucinated English disclaimers and Urdu transliterations; SFT model output concise, native Sindhi syntax. |
| UR → SD Translation | ChrF++ ROUGE-L Sindhi Purity | 52.74 0.00% 5.24% | 72.63 42.11% 2.99% | +19.89 — — | Baseline output conversational alternatives; SFT model translated with direct grammatical precision. |
| Text Summarization | ChrF++ ROUGE-L Sindhi Purity | 38.78 12.50% 4.69% | 58.08 31.58% 7.55% | +19.30 — +2.86% | SFT model produced succinct executive summaries without English formatting artifacts. |
| Aggregate Score | ChrF++ BLEU | 20.45 2.77 | 26.48 3.44 | +6.03 (+29.49%) +0.67 (+24.19%) | Consistent high-fidelity generation in native script. |
5. Qualitative 20-Domain Sindhi Instruction Benchmark
Tested across 20 distinct categories in native Sindhi:
- Conversation & Persona: Authentic polite greeting (وعليڪم اسلام) without English boilerplate.
- Sindhi Culture & Heritage: Accurate historical exposition on Ajrak (اجرڪ) and Sindhi Topi (سنڌي ٽوپي).
- Sindhi Literature & Sufism: Philosophical analysis of Shah Abdul Latif Bhittai's Sur Marui (سُر مارئي).
- History & Archaeology: 4 verified facts on Mohenjo-daro (موئن جو دڙو) including drainage and lower town.
- Instructional Recipe: Step-by-step culinary preparation of Bajhre ji Maani & Sarhanh jo Saag (ٻاجهري جي ماني ۽ سرنهن جو ساڳ).
- Technical Coding in Sindhi: Complete Python function implementation explained with native Sindhi terminology.
- English to Sindhi Translation: Standard translation without lexical borrowings.
- Mathematical Reasoning: Word problem solved step-by-step with standard ASCII digits (
120 - 25 + 40 = 135). - Formal Letter Writing: Authentic academic leave request formatted for school headmasters.
- Sindhi Proverbs & Idioms: Interpretation of 'جهڙي نيت تهڙي مراد'.
- Science Explanation: Spheroid celestial mechanics and seasonal cycles explained in accessible Sindhi.
- Roleplay & Empathy: Student exam stress counseling and cognitive hygiene tips.
- Geography & Hydrology: River Indus (Sindhu Darya / Mehran) agrarian significance.
- Creative Moral Story: Short narrative centered on an honest farmer.
- Urdu to Sindhi Translation: Clean translation with grammatical decomposition.
- Text Summarization: Core points distilled from regional cultural text.
- Sindhi Linguistics & Grammar: Detailed distinction between Noun (اسم) and Pronoun (ضمير) with examples.
- Health & Nutrition: Hydration and circadian sleep physiology.
- Sindhi Music & Folk Instruments: Descriptions of Yaktaro (يڪتارو), Chanh (چنگ), and Alghuzo (الڳوزو).
- AI for Low-Resource Languages: Strategic analysis on building open digital corpora for Sindhi.
🛠️ Training Methodology & Hyperparameters
The model was fine-tuned on Modal Cloud utilizing an NVIDIA L40S GPU (48GB VRAM) in native bfloat16 precision.
Training Configuration
- Base Checkpoint:
Kashif786/gemma-4-E2B-it-text-only-128k-pruned - Dataset:
Kashif786/Sindhi-Assistant-IFT-1500(Config:all, 1,500 conversations) - Training Framework: Hugging Face
TRL(SFTTrainer0.16+) +PEFT - LoRA Target Modules: Explicitly bound to
["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"](Safely bypassing internalGemma4ClippableLinearmodules to avoid PEFT dimension mismatch errors). - LoRA Rank ($r$):
16 - LoRA Alpha ($\alpha$):
32 - LoRA Dropout:
0.05 - Trainable Parameters:
24,158,208(0.7372% of 3,276,995,840 total params) - Batch Size: 4 per device × 4 gradient accumulation steps = Effective Batch Size: 16
- Learning Rate:
2e-4with Cosine Annealing schedule - Warmup Ratio:
0.08 - Optimizer:
adamw_torch_fused(Weight Decay:0.01) - Epochs:
3(282 total optimizer steps) - Max Sequence Length:
4096tokens - Total Training Runtime: 2,263.2 seconds (~37.7 minutes)
- Total Tokens Trained: ~4,936,000 tokens
- Weight Merge: Standalone parameter merge into clean FP16/BF16 safetensors shards.
📉 Training Loss & Convergence Trajectory
The model exhibited exceptional convergence stability, dropping from an initial cross-entropy loss of 4.466 to 1.629, while token accuracy climbed from 41.98% to 63.32%:
| Step | Epoch | Learning Rate | Training Loss | Token Accuracy | Entropy | Grad Norm |
|---|---|---|---|---|---|---|
| 20 | 0.11 | 7.20e-05 | 4.466 | 41.98% | 0.940 | 2.967 |
| 40 | 0.21 | 1.52e-04 | 2.975 | 45.08% | 2.378 | 0.884 |
| 60 | 0.32 | 1.99e-04 | 2.442 | 52.10% | 2.206 | 0.435 |
| 80 | 0.43 | 1.98e-04 | 2.289 | 53.38% | 2.296 | 0.465 |
| 100 | 0.53 | 1.95e-04 | 2.186 | 54.87% | 2.185 | 0.385 |
| 120 | 0.75 | 1.85e-04 | 2.049 | 56.27% | 2.027 | 0.483 |
| 140 | 0.96 | 1.70e-04 | 1.985 | 57.56% | 1.962 | 0.617 |
| 160 | 1.17 | 1.51e-04 | 1.855 | 59.22% | 1.860 | 0.564 |
| 180 | 1.38 | 1.29e-04 | 1.789 | 60.78% | 1.794 | 5.706 |
| 200 | 1.70 | 9.32e-05 | 1.783 | 60.42% | 1.771 | 0.611 |
| 220 | 1.92 | 6.93e-05 | 1.772 | 60.61% | 1.769 | 0.614 |
| 240 | 2.13 | 4.72e-05 | 1.635 | 63.24% | 1.619 | 0.729 |
| 260 | 2.45 | 2.02e-05 | 1.681 | 62.10% | 1.682 | 0.600 |
| 270 | 2.66 | 8.02e-06 | 1.645 | 63.32% | 1.630 | 0.594 |
| 280 | 2.77 | 3.92e-06 | 1.629 | 63.29% | 1.620 | 0.607 |
| 282 | 3.00 | 6.72e-08 | 1.651 | 62.81% | 1.643 | 0.615 |
- Final Cumulative Train Loss:
1.979 - Final Mean Token Accuracy:
62.08%
Loss
4.5 ┼*
4.0 ┼
3.5 ┼
3.0 ┼ *
2.5 ┼ * *
2.0 ┼ * * *
1.5 ┼ * * * * * * * *
└─────────────────────────────────────────► Steps (0 → 282)
💻 Quickstart: How to Use
Install required packages:
pip install -q transformers torch accelerate huggingface_hub
1. Generating Responses with Chat Template
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
MODEL_ID = "Kashif786/sindhi-gemma-4-E2B-it-128k-sft"
# Load tokenizer and model in bfloat16 (or float16)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Format your conversation
messages = [
{"role": "user", "content": "سنڌ جي ثقافت، اجرڪ ۽ سنڌي ٽوپي بابت مختصر ٻڌايو۔"}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=300,
temperature=0.6,
top_p=0.9,
repetition_penalty=1.1,
do_sample=True,
eos_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
2. Using Transformers Pipeline
from transformers import pipeline
import torch
generator = pipeline(
"text-generation",
model="Kashif786/sindhi-gemma-4-E2B-it-128k-sft",
torch_dtype=torch.bfloat16,
device_map="auto"
)
messages = [
{"role": "user", "content": "شاهه عبداللطيف ڀٽائي جي شاعريءَ جو مرڪزي پيغام ڇا آهي؟"}
]
output = generator(messages, max_new_tokens=256, temperature=0.6)
print(output[0]['generated_text'][-1]['content'])
⚖️ Intended Use & Best Practices
Recommended Use Cases:
- Interactive Sindhi Assistant: Question answering, information synthesis, creative writing, and dialogue.
- Cross-Lingual Translation: High-fidelity translation between English, Urdu, and Sindhi.
- Educational Tutoring: Grammar, literature, historical analysis, and introductory programming instruction in Sindhi.
- Low-Resource & Edge Deployment: Lightweight footprint (6.06 GB VRAM) suitable for consumer GPUs, cloud containers, and local offline inference.
Limitations:
- Current Affairs / Knowledge Cutoff: Like all base models, knowledge of real-time post-training events may require external retrieval-augmented generation (RAG).
- Dialectal Variation: Optimized for standard Perso-Arabic literary Sindhi; performance may vary on localized colloquial sub-dialects (e.g. Lasi, Kachi).
📜 Citation & Credits
If you utilize this model or its evaluation benchmarks in your research or application, please cite:
@misc{sindhi_gemma_4_128k_sft_2026,
author = {Kashif Ali},
title = {Sindhi Gemma 4 E2B IT 128k SFT: A Vocab-Pruned, Culturally Grounded Sindhi Large Language Model},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Kashif786/sindhi-gemma-4-E2B-it-128k-sft}},
note = {Fine-tuned on Kashif786/Sindhi-Assistant-IFT-1500 using Modal Cloud NVIDIA L40S}
}
Acknowledgements
- Dr. Mutee U Rahman for curating the
UD_Sindhi-Isratreebank under Universal Dependencies. - Google DeepMind for the Gemma 4 base architecture.
- Modal Labs for cloud compute acceleration.