Gemma-3-4B-Tigrinya-QA

Gemma-3-4B-Tigrinya-QA is a two-stage fine-tuned adaptation of Google's Gemma-3-4B specifically optimized for question-answering in Tigrinya (แ‰ตแŒแˆญแŠ›).

This model demonstrates good capabilities in answering questions across various domains, including history, culture, and general knowledge, in Tigrinya.

Purpose: Tigrinya is a low-resource language with limited high-performance open models available. This release aims to reduce barriers to entry for research and application development in the Tigrinya language space.

Model Details

  • Model Type: Instruction-tuned Causal Language Model
  • Base Model: luel/gemma-3-4b-tigrinya (stage 1: 60M tokens)
  • Parameters: 4 billion
  • Architecture: Gemma 3 with Gemma3ForCausalLM
  • Training Precision: BF16 with TF32 acceleration
  • Max Sequence Length: 1024 tokens

Training Process

Stage 1: General Text Generation

Stage 2: Instruction Fine-tuning (This Model)

Dataset (Stage 2)

  • Size: 67.5k question-answer pairs
  • Language: Tigrinya (แ‰ตแŒแˆญแŠ›)
  • Domains: Geography, culture, history, politics, general knowledge
  • Format: Chat template with <start_of_turn>user and <start_of_turn>model markers
  • Split: 95% training / 5% validation

Training Details (Stage 2)

  • Training Framework: HuggingFace Transformers with SFTTrainer
  • Optimizer: AdamW with cosine learning rate schedule
  • Learning Rate: 2e-5 with 3% warmup
  • Weight Decay: 0.01
  • Batch Size: 6 per device, 2 gradient accumulation steps (effective batch size: 12)
  • Epochs: 3
  • Evaluation: Every 500 steps
  • Mixed Precision: BF16 with gradient checkpointing
  • Hardware: NVIDIA GH200 120GB

Usage

First, install the Transformers library (version 4.50 or higher):

pip install -U transformers

Then, you can use it for inference as follows:

from transformers import Gemma3ForCausalLM, AutoTokenizer
import torch

model_id = "luel/gemma-3-4b-tigrinya-qa"

tok = AutoTokenizer.from_pretrained(model_id)
model = Gemma3ForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16, 
    device_map="cuda"
)
question = "แ‰ตแŒแˆซแ‹ญ แŠฃแ‰ แ‹ญ แ‰ตแˆญแŠจแ‰ฅ?"
messages = [{"role": "user", "content": f"{question}"}]
prompt = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)

inputs = tok(prompt, return_tensors="pt").to(model.device)

# you can add and adjust max_length, temperature, repetition_penalty, top_p...
outputs = model.generate(**inputs, max_new_tokens=1024)

full_response = tok.decode(outputs[0], skip_special_tokens=False)
model_response = full_response.split("<start_of_turn>model\n")[-1].split("<end_of_turn>")[0].strip()

print(model_response)

Chat Template

<start_of_turn>user
{user_message}<end_of_turn>
<start_of_turn>model
{model_response}<end_of_turn>

Examples

Below is a short sample showcasing the model's response quality (generated with max_new_tokens=512, temperature=0.6, top_p=0.9).

Q (user): แˆƒแŒˆแˆซแ‰ต แ‰€แˆญแŠ’ แŠฃแแˆชแŠซ แ‹แŠพแŠ‘ แŠฃแ‹จแŠ–แ‰ต แŠฅแ‹ฎแˆ?
A (model): แŠขแ‰ตแ‹ฎแŒตแ‹ซแฃ แŒ…แ‰กแ‰ฒแฃ แŠคแˆญแ‰ตแˆซแŠ• แˆถแˆ›แˆแ‹ซแŠ•แข

Q (user): แ‹“แ‹ˆแ‰ต แŠฒแŠ“แ‰ต แ‹“แ‹ตแ‹‹ แŠ•แˆƒแŒˆแˆซแ‰ต แŠฃแแˆชแŠซ แŠฅแŠ•แ‰ณแ‹ญ แˆ˜แˆแŠฅแŠฝแ‰ฒ แŠฅแ‹ฉ แ‹˜แˆ˜แˆ“แˆ‹แˆแ?
A (model): แ‹“แ‹ˆแ‰ต แŠฒแŠ“แ‰ต แ‹“แ‹ตแ‹‹ แŠฃแ‰ฅ แˆแ‹•แˆŠ แ‰ฃแ‹•แ‹ณแ‹Š แˆ˜แŒแ‹›แŠฅแ‰ฒ แ‹แ‰ฐแˆแ€แˆ˜แŠ• แˆƒแŒˆแˆซแ‰ต แŠฃแแˆชแŠซ แАแƒแАแ‰ฐแŠ• แŠญแ‰ƒแˆˆแˆณ แŠจแˆแ‹แŠฝแŠฅแˆ‹ แ‹˜แˆญแŠฃแ‹จแˆ‰แŠ• แ‰ณแˆชแŠญ แแƒแˆ˜ แŠฅแ‹ฉแข

Q (user): แАแ‹š แˆแˆตแˆ‹ แŠฅแ‹š แˆแˆแŠฃแ‹ฎแข แˆแˆต แ‰†แˆแ‹“ แŠฃแ‹ญแ‰ตแˆแŠจแˆญ
A (model): แˆแˆต แŠจแˆแ‰ข แŠฃแ‹ญแ‰ตแ‰ณแˆ“แ‰ฃแŠฅแข

Q (user): แ‰ฅแ‹›แ‹•แ‰ฃ แ‰ตแŒแˆซแ‹ญ แ‰ฅแˆ“แ‚แˆฉ แŠ•แŒˆแˆจแŠ’
A (model): แ‰ตแŒแˆซแ‹ญ แŠฃแ‰ฅ แˆฐแˆœแŠ• แŠขแ‰ตแ‹ฎแŒตแ‹ซ แŠฅแ‰ตแˆญแŠจแ‰ฅ แŠญแˆแˆ แŠฅแ‹ซแข แˆญแŠฅแˆฐ แŠจแ‰ฐแˆ›แŠฃ แˆ˜แ‰แˆˆ แŠฎแ‹ญแŠ“ แŠซแˆแŠฆแ‰ต แ‹“แ‰ แ‹ญแ‰ฒ แŠจแ‰ฐแˆ›แ‰ณแ‰ต แ‹ตแˆ› แŠฃแŠญแˆฑแˆแก แˆฝแˆจแก แˆ›แ‹ญแŒจแ‹ แŠฅแ‹จแŠ•แข แ‰ตแŒแˆซแ‹ญ แ‹แ‰ฐแˆแˆ‹แˆˆแ‹ฉ แˆ…แ‹แ‰ขแฃ แ‰ณแˆชแŠฝ แ‹˜แˆˆแ‹ŽแˆแŠ• แˆƒแแ‰ณแˆ แ‰ฃแˆ…แˆŠ แ‹˜แˆˆแ‹ŽแŠ• แ‰ฅแ‹™แˆ•แАแ‰ต แ‹แАแ‰ฅแˆจแˆ‹ แŠฅแ‹ซแข แ‰ฅแ‹˜แ‹ฐแŠ•แ‰• แ‰ฐแˆแŒฅแˆฎแŠ• แˆตแА-แŒฅแ‰ แ‰ฃแ‹Š แˆแˆแŠญแ‰ณแ‰ตแŠ• แ‹แˆ˜แˆแŠ แ‰ต แ‰ฆแ‰ณ แŠฅแ‹ซแข

Q (user): แˆฐแŠ“แ‹ญ แˆแˆแˆ•แ‹ณแˆญ แŠฅแŠ•แ‰ณแ‹ญ แˆ›แˆˆแ‰ต แŠฅแ‹ฉ?
A (model): แˆฐแŠ“แ‹ญ แˆแˆแˆ•แ‹ณแˆญ แŠ•แ‹œแŒ‹แ‰ณแ‰ต แ‰ฅแ‹˜แ‹ญแˆแŒญแแˆแ‰•แฃ แ‰ฅแ‹˜แ‹ญแŠฃแ‹ตแˆแ‹ŽแŠ• แ‰ฅแ‹˜แ‹ญ แŠฃแˆแˆ‹แˆ‹แ‹ญแŠ• แ‰ฅแˆ›แ‹•แˆจ แŒแˆแŒ‹แˆŽแ‰ต แ‹แˆ…แ‰ฅ แˆ˜แŠ•แŒแˆตแ‰ณแ‹Š แŠฃแˆฐแˆซแˆญแˆ“ แ‹จแˆ˜แˆ‹แŠฝแ‰ตแข แˆฐแŠ“แ‹ญ แˆแˆแˆ•แ‹ณแˆญ แŠฉแˆ‰ แ‹œแŒ‹ แˆ›แ‹•แˆจ แˆ˜แˆฐแˆ‹แ‰ต แŠจแˆแ‹แ‹ˆแˆƒแ‰ฆ แ‹ญแŒˆแ‰ฅแˆญแข

Evaluation

Metric Split Value
Evaluation Loss validation 1.025
Perplexity validation 2.79
Token Accuracy validation 75%
Training Loss final 0.963

Validation corpus: 5% held-out split from 67.5k Q&A pairs

Limitations

  • Language Mixing: May occasionally mix (very rare) Amharic or English words in responses
  • Domain Scope: Optimized for general Q&A; may not handle highly specialized technical queries optimally
  • Factual Accuracy: Generated answers should be verified for factual correctness
  • Context Length: Limited to 1024 tokens for both input and output
  • Base Model Limitations: Inherits limitations from the base Gemma-3-4B architecture
  • No Multimodal: Text-only model; cannot process images, audio, or other media
  • Bias: May reflect societal biases present in training data

Citation

@misc{gemma-3-4b-tigrinya-qa,
  author = {Luel},
  title = {Gemma-3-4B-Tigrinya-QA: A Fine-tuned Question-Answering Model for Tigrinya},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/luel/gemma-3-4b-tigrinya-qa}}
}

Acknowledgements

This model builds upon Google's Gemma 3 4B foundation and the Tigrinya language adaptation. We acknowledge Google for making their foundation models available to the community, enabling the development of language-specific instruction-tuned models like this one.

Downloads last month
3
Safetensors
Model size
3.88B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for luel/gemma-3-4b-tigrinya-qa

Finetuned
(1)
this model

Collection including luel/gemma-3-4b-tigrinya-qa

Evaluation results