Burmese Coder 🏹🔥
burmese-coder-4b (Supervised Finetuned-BASE)
Model Name: Burmese Coder (Gemma-3 4B)
Author: Dr. Wai Yan Nyein Naing (waiyan.nn18@gmail.com)
Model Type: Autoregressive Language Model (Causal LM)
Base Model: Google gemma-3-4b
Languages: Burmese (my), English (en)
🚀 How to Use (Local Inference)
This model is exported in GGUF (Q8_0) format and is optimized for local execution via Ollama. Follow these three simple steps to set it up:
1. Download the GGUF Model & Modelfile:
# Download the GGUF weights
huggingface-cli download WYNN747/burmese-coder-4b-gguf gemma-3n-e4b-it.Q8_0.gguf --local-dir . --local-dir-use-symlinks False
# Download the Modelfile
curl -L https://huggingface.co/WYNN747/burmese-coder-4b-gguf/resolve/main/Modelfile -o Modelfile
2. Register the Model:
ollama create burmese_coder_4b -f Modelfile
3. Run and Test:
ollama run burmese_coder_4b
📖 Model Description
Burmese Coder is a state-of-the-art, fine-tuned large language model specifically optimized for professional technical software development and programming assistance in the Burmese language. Built on top of the powerful Gemma-3 4B architecture, this model bridges the gap for Myanmar developers by providing highly accurate, conversational, and culturally nuances technical explanations without language barriers.
The model underwent rigorous training phases, starting with Supervised Fine-Tuning (SFT) on an enriched MBPP (Mostly Basic Python Problems) dataset translated and expanded with step-by-step Burmese explanations. To ensure linguistic purity and eliminate multilingual hallucinations, the model was ultra-hardened using Direct Preference Optimization (DPO) with targeted On-Policy Rejections.
Best-Suited Uses
- Educational Exploration: Learning and experimenting with fine-tuned Small Language Models (SLMs) tailored for the Burmese language.
- Code Generation & Prompt Testing: Evaluating the model's ability to write scripts and algorithms based on Burmese instructions in a controlled environment.
- Academic Research: Serving as a baseline or case study for localized, non-English programming assistants.
- Local Prototyping: Optimized for edge deployment and local inference testing via Ollama / GGUF on consumer hardware (macOS/Windows/Linux).
Out-of-Scope & Limitations
- Not for Production or Commercial Use: The model is an experimental research prototype. Its outputs must not be relied upon for production environments or commercial software systems.
- Domain Restriction: The model's primary focus strictly remains on programming and software engineering. General-purpose conversations outside technical domains may not be robust or highly coherent.
🛠️ Training Details
Training Paradigm
- Supervised Fine-Tuning (SFT): Initial instruction fine-tuning to teach the model structured technical problem-solving and accurate Burmese translation.
- Preference Alignment (DPO): Phase 4 ultra-hardening using Direct Preference Optimization (Beta=0.5). This phase utilized custom-generated hallucination datasets to heavily penalize language drift and reinforce strict Burmese linguistic consistency.
Dataset
- MBPP Enriched: 974-sample Mostly Basic Python Problems, augmented with extremely detailed, step-by-step Burmese explanations.
- Hallucination Rejection DPO: A curated dataset constructed to identify and reject mixed-language outputs.
📊 Benchmarks
Burmese-Coder-4B was evaluated using a two-track framework: Functional Correctness (Pass@1) and Language-Aware Quality (LLM-as-a-Judge).
Functional & Linguistic Performance
| Model | Pass@1 (%) | Rubric (DeepSeek) | Rubric (Gemini) |
|---|---|---|---|
| Burmese-Coder-4B | 62.0 | 3.456 | 3.779 |
| Gemma-3 4B (Base) | 62.0 | 2.939 | 3.203 |
| Qwen 2.5 3B | 45.0 | 1.220 | 2.526 |
Visual Performance Comparison
Linguistic Stability (Mixed-Language Penalty)
Lower is better. Measures resistance to script mixing and token drift.
- Burmese-Coder-4B: 0.02 (Gemini) / 0.09 (DeepSeek)
- Gemma-3 4B: 0.69 (Gemini) / 0.72 (DeepSeek)
- Qwen 2.5 3B: 1.37 (Gemini) / 1.18 (DeepSeek)
Key Finding: Burmese-Coder-4B maintains the full functional power of the base model while drastically reducing mixed-language hallucinations and improving technical terminal accuracy in Burmese.
💬 Example Output
Here is a sample interaction showcasing the model's ability to seamlessly blend technical programming logic with professional Burmese explanations.
User Prompt:
"Python မှာ Function တစ်ခု Error တက်သွားရင် သတ်မှတ်ထားတဲ့ အကြိမ်အရေအတွက်အတိုင်း ပြန်ကြိုးစားပေးမယ့် (Retry) Decorator တစ်ခုကို delay အချိန်နဲ့တကွ ရေးပြပါ။"
Burmese Coder Response: (The model generates both the executable code and the step-by-step explanation)
import time
from functools import wraps
def retry_on_failure(max_retries=3, delay=2):
"""
Error တက်ခဲ့ပါက သတ်မှတ်ထားသော အကြိမ်အရေအတွက်အတိုင်း စောင့်ဆိုင်း၍ ပြန်ကြိုးစားမည့် Decorator
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
for attempt in range(1, max_retries + 1):
try:
return func(*args, **kwargs)
except Exception as e:
print(f"[Error] Attempt {attempt} failed: {e}")
if attempt == max_retries:
raise e # နောက်ဆုံးအကြိမ်တွင် Error ကို ပြန်လွှင့်မည်
time.sleep(delay)
return wrapper
return decorator
@retry_on_failure(max_retries=3, delay=2)
def unstable_api_call():
# API ခေါ်ဆိုမှုတွင် Error ဖြစ်ပေါ်မှုကို စမ်းသပ်ရန်အတွက် ဖန်တီးထားသော လုပ်ဆောင်ချက် အတု
raise ConnectionError("Server Timeout!")
ရှင်းလင်းချက် (Explanation):
ဒီ code က အရည်အသွေးမြင့်တဲ့ Custom Decorator တစ်ခုကို `functools` ထဲက `wraps` နဲ့ တွဲဖက်တည်ဆောက်ထားတာ ဖြစ်ပါတယ်။ `retry_on_failure` ဆိုတဲ့ အပြင်ဆုံး function က `max_retries` နဲ့ `delay` parameter တွေကို လက်ခံပြီး အတွင်းပိုင်း logic ကို ထိန်းချုပ်ပေးပါတယ်။
`wrapper` အထဲမှာတော့ `try-except block` ကို အသုံးပြုပြီး Error တက်/မတက် စစ်ဆေးပါတယ်။ Error တက်ခဲ့ရင် `time.sleep(delay)` နဲ့ သတ်မှတ်ထားတဲ့ အချိန်စောင့်ပြီး နောက်တစ်ကြိမ် ပြန်ကြိုးစားပါတယ်။ အကယ်လို့ နောက်ဆုံးအကြိမ်အထိ Error ထပ်တက်နေသေးရင်တော့ မူလ Error ကိုပဲ `raise e` ဆိုပြီး ပြန်လွှင့်ပေးလိုက်ပါတယ်။
Via llama.cpp or text-generation-webui
Simply download the .gguf file and load it using the standard llama.cpp pipeline. Choose the quantization level (e.g., Q4_K_M or Q8_0) that best fits your VRAM requirements.
📜 Citation
If you use Burmese Coder in your research or application, please cite the following paper:
@inproceedings{naing2026burmesecoder,
title = {Burmese-Coder-4B: Fine-Tuning a Small Language Model for Burmese Coding with Language-Aware Evaluation},
author = {Naing, Wai Yan Nyein},
year = {2026},
publisher = {GitHub Pages},
url = {https://waiyannyeinnaing.github.io/assets/pdf/burmese_coder_4b.pdf},
dataset = {https://huggingface.co/datasets/WYNN747/burmese-human-eval},
dataset_mbpp = {https://huggingface.co/datasets/WYNN747/burmese-mbpp}
}
Find the full research paper here: Burmese-Coder-4B Paper
⚖️ License
This model is released under the MIT License.
- Downloads last month
- 234
8-bit
