File size: 18,424 Bytes
61d0c88 5789f0e 61d0c88 5789f0e 61d0c88 5789f0e 61d0c88 5789f0e 61d0c88 5789f0e 61d0c88 5789f0e 61d0c88 5789f0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
---
license: apache-2.0
base_model: unsloth/gemma-3-4b-it
tags:
- gemma3
- unsloth
- conversational
- education
- instruction-tuning
- question-answering
- bengali
- indian-universities
- trl
- sft
language:
- en
datasets:
- millat/indian_university_guidance_for_bangladeshi_students
metrics:
- perplexity
- loss
library_name: transformers
pipeline_tag: text-generation
---
# Gemma-3-4B Indian University Guide for Bangladeshi Students
<div align="center">
<img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.png" width="200"/>
**A specialized educational counselor AI fine-tuned on 7,044 high-quality Q&A pairs**
[](https://opensource.org/licenses/Apache-2.0)
[](https://huggingface.co/google/gemma-3-4b-it)
[](https://huggingface.co/datasets/millat/indian_university_guidance_for_bangladeshi_students)
[](https://github.com/unslothai/unsloth)
</div>
---
## ๐ Model Description
**Gemma-3-4B Indian University Guide** is a fine-tuned Large Language Model specifically designed to assist Bangladeshi students in navigating the admission process for Indian universities. The model provides accurate, culturally-sensitive guidance on topics including:
- ๐ **Admissions Requirements** - Entry criteria, eligibility, and application processes
- ๐ **Documentation** - Required documents, equivalence certificates, and attestation
- ๐ฐ **Scholarships** - Merit-based scholarships, GPA requirements, and eligibility
- ๐ซ **University Information** - Programs, fees, accommodation, and facilities
- ๐ **Visa Guidance** - Student visa process, requirements, and timelines
- ๐ **Grade Conversion** - Bangladesh to India GPA/percentage equivalence
- ๐ **Lateral Entry** - Polytechnic diploma to B.Tech admission pathways
- ๐ฏ **Program Equivalence** - Degree recognition between Bangladesh and India
### Model Details
- **Developed by:** [MD Millat Hosen](https://huggingface.co/millat)
- **Model type:** Causal Language Model (Instruction-tuned)
- **Base Model:** [unsloth/gemma-3-4b-it](https://huggingface.co/unsloth/gemma-3-4b-it)
- **Language:** English
- **License:** Apache 2.0
- **Parameters:** 4 Billion
- **Fine-tuning Method:** QLoRA (Quantized Low-Rank Adaptation)
- **Training Framework:** Unsloth + HuggingFace TRL
- **Precision:** 16-bit (BF16)
- **Context Length:** 1024 tokens
---
## ๐ฏ Intended Use
### Primary Use Cases
1. **Educational Counseling Chatbot** - Deploy as an AI assistant for Bangladeshi students seeking admission to Indian universities
2. **University Admission Support** - Provide instant, accurate answers about admission requirements, processes, and eligibility
3. **Scholarship Guidance** - Help students understand scholarship criteria and calculate their eligibility
4. **Document Preparation** - Guide students through required documentation and equivalence procedures
5. **Research Applications** - Academic research on instruction-tuned LLMs for specialized domains
### Target Users
- ๐ Bangladeshi students applying to Indian universities
- ๐ข Educational consultancy firms
- ๐ซ University admission offices
- ๐ Academic researchers in NLP and education technology
---
## ๐ Training Details
### Dataset
**Dataset:** [millat/indian_university_guidance_for_bangladeshi_students](https://huggingface.co/datasets/millat/indian_university_guidance_for_bangladeshi_students)
- **Size:** 7,044 instruction-formatted Q&A pairs
- **Format:** Question-Answer with context and metadata
- **Quality:** Multi-stage pipeline with deduplication and validation
- **Coverage:** Comprehensive guidance across 8 major topics
- **Cultural Sensitivity:** Designed specifically for Bangladesh-India educational context
**Data Split:**
- Training: 90% (6,340 examples)
- Validation: 10% (704 examples)
### Training Configuration
```python
Training Parameters:
- Epochs: 3
- Batch Size: 2 per device
- Gradient Accumulation Steps: 8
- Effective Batch Size: 16
- Learning Rate: 2e-5 (cosine schedule)
- Warmup Steps: 100
- Max Sequence Length: 1024 tokens
- Optimizer: AdamW 8-bit
- Weight Decay: 0.01
LoRA Configuration:
- Rank (r): 16
- Alpha: 16
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Dropout: 0
- Bias: None
Hardware:
- GPU: NVIDIA T4 (Google Colab)
- Training Time: ~45 minutes
- Speed: 2x faster with Unsloth optimizations
```
### Training Results
| Metric | Value | Assessment |
|--------|-------|------------|
| **Final Training Loss** | 0.593 | Excellent |
| **Validation Loss** | 0.614 | Excellent |
| **Perplexity** | 1.85 | Excellent |
| **Improvement vs Base** | 38% | Strong |
| **Trainable Parameters** | 83.9M (2.09%) | Efficient |
**Training Notebook:** [Google Colab](https://colab.research.google.com/drive/1rmH5p_PtlTlLaakc_Fmlb0jXxGvI3tAJ?usp=sharing)
---
## ๐ How to Use
### Installation
```bash
pip install unsloth transformers accelerate peft bitsandbytes
```
### Basic Inference
```python
from unsloth import FastLanguageModel
import torch
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="millat/gemma4b-indian-university-guide-16bit",
max_seq_length=1024,
dtype=None, # Auto-detect
load_in_4bit=True, # Use 4-bit quantization for efficiency
)
# Prepare for inference
FastLanguageModel.for_inference(model)
# Format your question
question = "What documents do I need to apply to Indian universities from Bangladesh?"
# Create prompt in Gemma3 format
prompt = f"<start_of_turn>user\n{question}<end_of_turn>\n<start_of_turn>model\n"
# Tokenize
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
# Generate response
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
top_k=50,
repetition_penalty=1.2,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
# Decode and print
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
```
### Advanced Usage with Streaming
```python
from transformers import TextStreamer
# Create streamer for real-time output
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
# Generate with streaming
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
streamer=streamer, # Enable streaming
)
```
### Batch Inference
```python
questions = [
"Can I get a scholarship at Sharda University with a GPA of 3.5?",
"What is the admission process for Bangladeshi students?",
"Am I eligible for lateral entry with a Polytechnic diploma?"
]
for question in questions:
prompt = f"<start_of_turn>user\n{question}<end_of_turn>\n<start_of_turn>model\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(f"Q: {question}")
print(f"A: {response}\n")
```
### API Integration Example (Flask)
```python
from flask import Flask, request, jsonify
from unsloth import FastLanguageModel
app = Flask(__name__)
# Load model once at startup
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="millat/gemma4b-indian-university-guide-16bit",
max_seq_length=1024,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
@app.route('/ask', methods=['POST'])
def ask():
data = request.json
question = data.get('question', '')
prompt = f"<start_of_turn>user\n{question}<end_of_turn>\n<start_of_turn>model\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
return jsonify({'answer': response})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
```
---
## ๐ Performance Evaluation
### Comprehensive Testing Results
The model underwent extensive evaluation across 5 dimensions:
| Test Category | Metric | Score | Grade |
|--------------|--------|-------|-------|
| **Factual Accuracy** | Correctness | 87.5% | A+ โญโญโญ |
| **Topic Coverage** | Domain Coverage | 100% | A+ โญโญโญ |
| **Consistency** | Response Stability | 80% | A โญโญ |
| **Response Quality** | Coherence & Length | High (ฯ=8.5) | A+ โญโญโญ |
| **Overall Performance** | Weighted Average | 93.5% | A+ โญโญโญ |
**Status:** โ
**PRODUCTION READY**
### Example Outputs
#### Example 1: Scholarship Query
**Input:**
```
Can I get a scholarship at Sharda University with a GPA of 3.5?
```
**Output:**
```
Yes, you are eligible for a 50% scholarship on tuition fees at Sharda University!
With a GPA of 3.5 out of 5.0 (equivalent to 70% or CGPA 7.0/10 in India), you
qualify for the 50% scholarship tier. This scholarship is available for eligible
engineering programs like B.Tech (which is equivalent to B.Sc. Engineering in
Bangladesh). To maintain the scholarship from the second year onwards, you must:
1) Pass all exams without any backlogs
2) Maintain at least 75% attendance
The scholarship covers 50% of your tuition fees throughout your program duration.
```
#### Example 2: Lateral Entry
**Input:**
```
Am I eligible for lateral entry with a Polytechnic diploma?
```
**Output:**
```
Yes, you are eligible for lateral entry into the second year of B.Tech/B.E.
programs in India with your Polytechnic Diploma from Bangladesh. Your 4-year
diploma after SSC is recognized for direct admission to the second year. Make
sure the Indian university's B.Tech program is AICTE-approved to ensure your
degree is recognized in Bangladesh. You'll need to provide your diploma
certificate, transcripts, and equivalence certificate from the Bangladesh
Technical Education Board (BTEB) for the admission process.
```
#### Example 3: Document Requirements
**Input:**
```
What documents do I need to apply to Indian universities from Bangladesh?
```
**Output:**
```
For applying to Indian universities from Bangladesh, you'll need:
1. Academic Documents:
- HSC Certificate and Mark Sheet
- SSC Certificate and Mark Sheet
- Academic transcripts for all years
2. Identification:
- Valid passport
- Recent passport-size photographs
3. Equivalence Certificate:
- From Bangladesh Ministry of Education or UGC
- Shows your qualifications are equivalent to Indian standards
4. Additional Documents:
- Transfer Certificate (TC) from your last institution
- Character Certificate
- Medical fitness certificate
- Gap certificate (if applicable)
All documents should be attested by the Bangladesh Ministry of Foreign Affairs
and the Indian High Commission in Dhaka for visa purposes.
```
---
## โ๏ธ Model Architecture
### Base Model: Gemma-3-4B-IT
- **Architecture:** Decoder-only Transformer
- **Attention:** Multi-head attention with rotary positional embeddings
- **Activation:** GeGLU
- **Normalization:** RMSNorm
- **Vocabulary Size:** 256,000 tokens
- **Hidden Size:** 2,560
- **Intermediate Size:** 15,360
- **Number of Layers:** 26
- **Attention Heads:** 16
- **Key-Value Heads:** 4 (Grouped-Query Attention)
### LoRA Adaptations
Fine-tuning was performed using QLoRA with the following adapter configuration:
```python
LoRA Config:
- Target Modules: [q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]
- Rank (r): 16
- Alpha: 16
- Dropout: 0.0
- Task Type: Causal Language Modeling
- Trainable Parameters: 83,886,080 (2.09% of total)
- Total Parameters: 4,013,133,568
```
---
## ๐ก Prompt Format
The model is trained using the **Gemma3 Chat Template**:
```
<start_of_turn>user
{Your question here}<end_of_turn>
<start_of_turn>model
{Model's response}<end_of_turn>
```
**Important:** Always use this format for optimal performance. The tokenizer's `apply_chat_template()` method handles this automatically.
---
## ๐ง Technical Specifications
### Memory Requirements
| Precision | Memory Usage | Inference Speed |
|-----------|--------------|-----------------|
| 16-bit (BF16) | ~8 GB VRAM | Baseline |
| 8-bit | ~4 GB VRAM | 1.2x faster |
| 4-bit (NF4) | ~2.5 GB VRAM | 2x faster |
**Recommended:** Use 4-bit quantization for deployment (load_in_4bit=True)
### Generation Parameters
For optimal results, use these parameters:
```python
generation_config = {
"max_new_tokens": 200-256, # Adjust based on expected answer length
"temperature": 0.7, # 0.3 for factual, 0.7 for conversational
"top_p": 0.9, # Nucleus sampling
"top_k": 50, # Top-k sampling
"repetition_penalty": 1.2, # Prevent repetition
"no_repeat_ngram_size": 3, # Block repeated 3-grams
"do_sample": True, # Enable sampling
"early_stopping": True, # Stop at EOS token
}
```
---
## โ ๏ธ Limitations
### Known Limitations
1. **Temporal Knowledge Cutoff** - Information is based on data collected at a specific point in time (October 2025) and may become outdated as university policies change.
2. **Scope Limitation** - The model is specialized for Bangladeshi students applying to Indian universities. It may not generalize well to:
- Other countries' education systems
- General-purpose conversational tasks
- Non-educational domains
3. **Factual Accuracy** - While the model achieves 87.5% factual accuracy, always verify critical information (fees, deadlines, requirements) with official university sources.
4. **University Coverage** - The dataset focuses on major Indian universities accepting Bangladeshi students. Smaller or newer institutions may have limited coverage.
5. **Language** - The model operates in English only. It does not support Bengali/Bangla language queries.
6. **Hallucination Risk** - Like all LLMs, the model may occasionally generate plausible-sounding but incorrect information. Use with appropriate supervision.
### Ethical Considerations
- **Advisory Role Only** - This model should supplement, not replace, professional educational counseling.
- **Verification Required** - Students should verify all information with official university websites before making decisions.
- **Cultural Sensitivity** - The model is designed with cultural awareness but may not capture all nuances of individual circumstances.
- **Bias Awareness** - The model reflects the biases present in the training data and base model.
---
## ๐ Citation
If you use this model in your research or applications, please cite:
```bibtex
@misc{millat2025gemma4b_indian_university_guide,
author = {MD Millat Hosen and Md Moudud Ahmed Misil and Dr. Rohit Kumar Sachan},
title = {Gemma-3-4B Indian University Guide for Bangladeshi Students},
year = {2025},
publisher = {HuggingFace},
journal = {HuggingFace Model Hub},
howpublished = {\url{https://huggingface.co/millat/gemma4b-indian-university-guide-16bit}},
}
```
**Dataset Citation:**
```bibtex
@misc{md_millat_hosen_2025,
author = {MD Millat Hosen and Md Moudud Ahmed Misil and Dr. Rohit Kumar Sachan},
title = {indian_university_guidance_for_bangladeshi_students},
year = {2025},
url = {https://huggingface.co/datasets/millat/indian_university_guidance_for_bangladeshi_students},
doi = {10.57967/hf/6295},
publisher = {Hugging Face}
}
```
---
## ๐ค Contributing
We welcome contributions to improve this model! Areas for contribution:
- ๐ **Dataset Expansion** - Add more universities, update policies, expand coverage
- ๐งช **Evaluation** - Conduct additional testing and provide feedback
- ๐ **Bug Reports** - Report issues or incorrect responses
- ๐ **Documentation** - Improve usage guides and examples
- ๐ **Deployment** - Share deployment experiences and best practices
---
## ๐ Contact & Support
- **Model Author:** [MD Millat Hosen](https://huggingface.co/millat)
- **Issues:** Report on HuggingFace Model Hub
- **Updates:** Follow for model updates and improvements
---
## ๐ Acknowledgments
- **Google DeepMind** - For the excellent Gemma-3-4B base model
- **Unsloth AI** - For 2x faster training optimizations
- **HuggingFace** - For the Transformers library and model hosting
- **TRL Team** - For Supervised Fine-Tuning utilities
- **Research Supervisor** - Dr. Rohit Kumar Sachan
- **Team Member** - Md Moudud Ahmed Misil
---
## ๐ License
This model is released under the **Apache 2.0 License**, inherited from the base Gemma-3-4B model.
- โ
Commercial use allowed
- โ
Modification allowed
- โ
Distribution allowed
- โ
Private use allowed
- โ ๏ธ Must include license and copyright notice
- โ ๏ธ Must state changes made
---
## ๐ Related Resources
- ๐ **Dataset:** [indian_university_guidance_for_bangladeshi_students](https://huggingface.co/datasets/millat/indian_university_guidance_for_bangladeshi_students)
- ๐ค **Base Model:** [unsloth/gemma-3-4b-it](https://huggingface.co/unsloth/gemma-3-4b-it)
- ๐ **Training Notebook:** [Google Colab](https://colab.research.google.com/drive/1rmH5p_PtlTlLaakc_Fmlb0jXxGvI3tAJ?usp=sharing)
- ๐ง **Unsloth Library:** [GitHub](https://github.com/unslothai/unsloth)
- ๐ **Documentation:** [Unsloth Docs](https://docs.unsloth.ai/)
---
<div align="center">
**๐ Empowering Bangladeshi Students to Achieve Their Dreams in India ๐ง๐ฉ ๐ค ๐ฎ๐ณ**
*Built with โค๏ธ using Unsloth + HuggingFace*
[](https://huggingface.co/millat/gemma4b-indian-university-guide-16bit)
[](https://huggingface.co/datasets/millat/indian_university_guidance_for_bangladeshi_students)
[](https://colab.research.google.com/drive/1rmH5p_PtlTlLaakc_Fmlb0jXxGvI3tAJ?usp=sharing)
</div> |