CoolFace
Modelpublic

munkhbayar-batkhuu/Llama-3.2-3B-Instruct-Mongolian

sourceHugging Facellama3.2updated 8mo agoView on Hugging Face
0likes73downloads
Model Card

Llama-3.2-3B-Instruct-Mongolian

A LoRA fine-tuned version of meta-llama/Llama-3.2-3B-Instruct for Mongolian language instruction-following and chat.

Model Description

This model adapts Llama 3.2 3B Instruct to understand and generate fluent Mongolian text. It was fine-tuned using LoRA (Low-Rank Adaptation) on the saillab/alpaca-mongolian-cleaned dataset containing ~41,600 Mongolian instruction-following examples.

The base model struggles with Mongolian, producing garbled or incoherent text. After fine-tuning, the model generates fluent, coherent Mongolian responses across a wide range of topics.

Quick Start

python
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch

BASE_MODEL = "meta-llama/Llama-3.2-3B-Instruct"
ADAPTER = "munkhbayar-batkhuu/Llama-3.2-3B-Instruct-Mongolian"

tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
model = AutoModelForCausalLM.from_pretrained(
    BASE_MODEL, torch_dtype=torch.float16, device_map="auto"
)
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()

messages = [
    {"role": "system", "content": "You are a helpful assistant that responds in Mongolian."},
    {"role": "user", "content": "Монгол улсын нийслэл хаана байдаг вэ?"},
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to(model.device)

with torch.no_grad():
    output = model.generate(**inputs, max_new_tokens=256, temperature=0.7, top_p=0.9, do_sample=True)

response = tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(response)
# Output: Монгол улсын нийслэл нь Улаанбаатар хот юм.

Training Details

ParameterValue
Base Modelmeta-llama/Llama-3.2-3B-Instruct
MethodLoRA (PEFT)
Datasetsaillab/alpaca-mongolian-cleaned (~41,600 examples)
Train/Eval Split39,520 / 2,081 (95/5, seed=42)
LoRA Rank32
LoRA Alpha64
LoRA Dropout0.05
Target Modulesqproj, kproj, vproj, oproj, gateproj, upproj, down_proj
Trainable Parameters48.6M (1.49% of 3.26B)
Epochs3
Batch Size4 (x4 gradient accumulation = effective 16)
Learning Rate2e-4 (cosine schedule)
Warmup5% of steps
Precisionfloat16
Max Sequence Length512
Training Steps7,410
Training Time~130.3 hours
Final Train Loss0.671
Final Eval Loss0.628
Token Accuracy83%

Chat Template

Training used the Llama 3.2 chat template with system prompt: "You are a helpful assistant that responds in Mongolian."

Benchmark Results

MM-Eval (Mongolian Multi-task Evaluation)

MM-Eval (arXiv:2411.09492) is a hierarchical benchmark for evaluating LLMs on Mongolian language tasks across 1,840 items.

CategoryItemsBase ModelFine-tunedDelta
Syntax569 (MCQ)26.89%35.33%+8.44%
Semantics677 (MCQ)27.47%37.37%+9.90%
Knowledge344 (MCQ)32.85%67.44%+34.59%
Reasoning250 (numeric)3.20%0.80%-2.40%

Perplexity (on eval split, 2,081 samples)

ModelPerplexityAvg Loss
Base18.312.9075
Fine-tuned1.990.6881

BLEU / ROUGE-L (200 eval samples)

MetricBase ModelFine-tunedImprovement
BLEU-10.13730.3245+136%
BLEU-20.04270.1281+200%
ROUGE-L0.07600.1874+147%

Example Outputs

Prompt: "Монгол улсын нийслэл хаана байдаг вэ?" (Where is the capital of Mongolia?)

ModelResponse
BaseУлсын нийслэл хаан байдаг байна. Улсын нийслэл нь Улаанбаatar... (garbled)
Fine-tunedМонгол улсын нийслэл нь Улаанбаатар хот юм. (The capital of Mongolia is Ulaanbaatar.)

Prompt: "Хүүхдэд зориулж богино үлгэр бичнэ үү." (Write a short story for children.)

ModelResponse
BaseХүүхдэд зориулж богино үлгэр бичихээс бээрхээр эрхэмтгээр өрөмддэг... (incoherent)
Fine-tunedЭрт урьдын цагт өтгөн ногоон ойд Жак хэмээх бяцхан хөгшин байжээ... (Long ago in a thick green forest lived an old man named Jack...)

Prompt: "Монгол хоолны жор бичнэ үү." (Write a Mongolian food recipe.)

ModelResponse
BaseХолны жор хэлээр байна. Хэрээрт хэрээрт бүртгэлтэй... (incoherent)
Fine-tunedМиний сонгосон жор: Гоймонгийн амтат чинжүү. Орц: 12 ширхэг улаан чинжүү, 1/4 аяга цагаан элсэн чихэр... (Recipe with ingredients list)

Limitations

  • —Domain: Trained on general instruction-following data; may not perform well on specialized domains (medical, legal, technical)
  • —Math/Reasoning: Mathematical reasoning did not improve (slightly declined on MM-Eval reasoning)
  • —Hallucination: Like all LLMs, may generate plausible but factually incorrect information
  • —Sequence Length: Trained with max 512 tokens; may degrade on longer inputs
  • —Model Size: 3B parameters -- larger models would likely achieve better results

Framework Versions

  • —PEFT: 0.18.1
  • —TRL: 0.27.2
  • —Transformers: 5.1.0
  • —PyTorch: 2.10.0+cu128
  • —Datasets: 4.5.0

Citation

If you use this model, please cite:

bibtex
@misc{llama32-3b-mongolian-2026,
  title={Llama-3.2-3B-Instruct-Mongolian},
  author={Munkhbayar Batkhuu},
  year={2026},
  url={https://huggingface.co/munkhbayar-batkhuu/Llama-3.2-3B-Instruct-Mongolian}
}

Acknowledgments

  • —Meta AI for the Llama 3.2 base model
  • —SAIL Lab for the Mongolian Alpaca dataset
  • —MM-Eval authors for the Mongolian evaluation benchmark