Brunei Malay -> Standard Malay Translator v3 (medical-enhanced)

Fine-tuned from Qwen3-0.6B on 29.8k Brunei-Malay <-> Standard-Malay sentence pairs. v3 adds ~1,660 medical/clinical dialect terms curated from a Brunei health-domain wordlist.

Evaluation (held-out test set, 1,623 examples)

tag BLEU chrF++ n
overall 60.57 79.53 1,623
sent_adversarial 77.75 85.76 348
sent_direct 54.21 76.39 1,093
sent_medical ✨ 51.27 89.14 166
word_direct 0.00 42.47 15

Improvements over v2: overall BLEU +2.7, adversarial BLEU +6.5, medical chrF++ 89.14 (new).

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = 'ningpy/brunei-malayu-translator'
tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map='auto', trust_remote_code=True).eval()

msgs = [
    {'role': 'system', 'content': 'Translate the following Brunei Malay text into Standard Malay.'},
    {'role': 'user', 'content': 'Ku ada basal bah, sudah dua hari.'},
]
text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tok(text, return_tensors='pt').to(model.device)
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
# -> 'Saya ada selesema, sudah dua hari.'

Training

  • Base: Qwen/Qwen3-0.6B (Instruct)
  • Method: LoRA rank 32, alpha 64, targets q/k/v/o/gate/up/down (20.2M trainable, 3.4%)
  • Data: 29,789 train (with sent_medical upsampled 3x), 1,308 val, 1,623 test
  • 6 epochs, lr 2e-4 cosine, effective batch 16, fp16, 1x V100 32GB, ~1h 55min
  • Final eval_loss: 0.2698

Data sources

  • General: brunei_dict (5,352-word bilingual dictionary)
  • Medical: bmb-dialect-medical-terms-500-v1.xlsx (500 curated medical/clinical terms with variants)
  • Synthesis: OpenAI gpt-4o-mini for sentence-level expansion
  • QA: PRPM (prpm.dbp.gov.my) cross-check, LLM-as-judge (gpt-4o)

Limitations

  • Test set drawn from same synthesis distribution as training; real-world BLEU may be lower
  • Rare Brunei words (appearing < 3 times in training) may be mistranslated
  • No SM -> BM reverse direction
Downloads last month
472
Safetensors
Model size
0.6B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ningpy/brunei-malayu-translator

Finetuned
Qwen/Qwen3-0.6B
Adapter
(562)
this model