CoolFace
Modelpublic

MLP-KTLim/llama-3.1-Asian-Bllossom-8B-Translator

sourceHugging Facellama3.1updated 2y agoView on Hugging Face
7likes32downloads
Model Card

Model Card for Model ID

This model is a multilingual translation model fine-tuned on LLaMA 3.1 Instruct base model. It enables mutual translation between the following Southeast Asian languages:

  • —Korean
  • —Vietnamese
  • —Indonesian
  • —Cambodian (Khmer)
  • —Thai

Acknowledgements

AICA <img src="https://aica-gj.kr/images/logo.png" width="20%" height="20%">

Model Details

The model is designed for translating short text segments between any pair of the supported languages.

Supported language pairs:

  • —Korean ↔ Vietnamese
  • —Korean ↔ Indonesian
  • —Korean ↔ Cambodian
  • —Korean ↔ Thai
  • —Vietnamese ↔ Indonesian
  • —Vietnamese ↔ Cambodian
  • —Vietnamese ↔ Thai
  • —Indonesian ↔ Cambodian
  • —Indonesian ↔ Thai
  • —Cambodian ↔ Thai

Model Description

This model is specifically optimized for Southeast Asian language translation needs, focusing on enabling communication between these specific language communities.

The extensive training data of 20M examples (1M for each translation direction) provides a robust foundation for handling common expressions and basic conversations across these languages.

Model Architecture

Base Model: meta-llama/Llama-3.1-8B-Instruct

Bias, Risks, and Limitations

  • —Performance is limited to short sentences and phrases
  • —May not handle complex or lengthy text effectively
  • —Translation quality may vary depending on language pair and content complexity

Evaluation results

Source LanguageTarget LanguageBLEU ScoreROUGE-1ROUGE-L
KoreanVietnamese56.7081.6476.66
KoreanCambodian71.6989.2688.20
KoreanIndonesian58.3280.3976.63
KoreanThai63.2678.8872.29
VietnameseKorean49.0175.5772.74
VietnameseCambodian78.2690.7490.32
VietnameseIndonesian65.9683.0881.46
VietnameseThai65.9381.0976.57
CambodianKorean49.1072.6769.75
CambodianVietnamese63.4281.5679.09
CambodianIndonesian61.4179.6777.75
CambodianThai70.9181.8577.66
IndonesianKorean53.6177.1474.29
IndonesianVietnamese68.2185.4183.10
IndonesianCambodian78.8490.8190.35
IndonesianThai67.1281.5477.19
ThaiKorean45.5972.4869.46
ThaiVietnamese61.5581.0178.24
ThaiCambodian78.5291.4791.16
ThaiIndonesian58.9978.5676.40

Example

py
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "MLP-KTLim/llama-3.1-Asian-Bllossom-8B-Translator",
    torch_dtype="auto",
    device_map="auto",
)

tokenizer = AutoTokenizer.from_pretrained(
    "MLP-KTLim/llama-3.1-Asian-Bllossom-8B-Translator",
)

input_text = "안녕하세요? 아시아 언어 번역 모델 입니다."

def get_input_ids(source_lang, target_lang, message):
    assert source_lang in ["Korean", "Vietnamese", "Indonesian", "Thai", "Cambodian"]
    assert target_lang in ["Korean", "Vietnamese", "Indonesian", "Thai", "Cambodian"]
    
    input_ids = tokenizer.apply_chat_template(
        conversation=[
            {"role": "system", "content": f"You are a useful translation AI. Please translate the sentence given in {source_lang} into {target_lang}."},
            {"role": "user", "content": message},
        ],
        tokenize=True,
        return_tensors="pt",
        add_generation_prompt=True,
    )
    return input_ids

input_ids = get_input_ids(
    source_lang="Korean",
    target_lang="Vietnamese",
    message=input_text,
)

output = model.generate(
    input_ids.to(model.device),
    max_new_tokens=128,
)

print(tokenizer.decode(output[0][len(input_ids[0]):], skip_special_tokens=True))

Contributor

  • —원인호 (wih1226@seoultech.ac.kr)
  • —김민준 (mjkmain@seoultech.ac.kr)