ViDia2Std mBART-large-50

This model normalizes Vietnamese regional and dialectal expressions into Standard Vietnamese while preserving the original meaning.

It accompanies the Dialectal Robustness of LLMs under Meaning-Preserving Vietnamese Variation project. The project studies whether language-model decisions remain stable when Vietnamese task content is rewritten in regional dialects. This normalizer supports experiments that compare direct dialect input with input normalized before downstream inference.

The model was fine-tuned from facebook/mbart-large-50 using Vietnamese dialect/standard sentence pairs from Biu3010/ViDia2Std.

Intended use

  • Normalize Vietnamese dialect text before downstream NLP or LLM inference.
  • Study the effect of dialect-to-standard normalization on model robustness.
  • Provide a reproducible baseline for Vietnamese text normalization research.

This model is a research artifact. Its output should be reviewed before use in high-stakes or production workflows, especially for dialects or expressions that are underrepresented in the training data.

Inference with Transformers

Install the required packages:

pip install torch transformers sentencepiece

Run inference:

import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

MODEL_ID = "coutMinh/mbart-large-50"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
tokenizer.src_lang = "vi_VN"
tokenizer.tgt_lang = "vi_VN"

model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_ID)
model.to(device).eval()


@torch.inference_mode()
def normalize(text: str) -> str:
    inputs = tokenizer(
        text,
        return_tensors="pt",
        truncation=True,
        max_length=128,
    )
    inputs.pop("token_type_ids", None)
    inputs = {key: value.to(device) for key, value in inputs.items()}

    generation_args = {
        "max_new_tokens": 64,
        "do_sample": False,
        "num_beams": 1,
        "pad_token_id": tokenizer.pad_token_id,
        "eos_token_id": tokenizer.eos_token_id,
    }
    if "vi_VN" in tokenizer.lang_code_to_id:
        generation_args["forced_bos_token_id"] = (
            tokenizer.lang_code_to_id["vi_VN"]
        )

    output = model.generate(**inputs, **generation_args)
    return tokenizer.decode(output[0], skip_special_tokens=True)


print(normalize("mi đi mô rứa mi, tau không biết"))

Expected output:

mày đi đâu vậy mày, tao không biết

Space API

The accompanying Gradio demo exposes a /normalize API endpoint when its runtime is enabled:

pip install gradio_client
from gradio_client import Client

client = Client("coutMinh/mbart-large-50-demo")
result = client.predict(
    text="mi đi mô rứa mi, tau không biết",
    api_name="/normalize",
)
print(result)

The model is not currently hosted by a Hugging Face Inference Provider. Therefore, use the local Transformers example above or enable the linked Space runtime before calling the Space API.

Test results

Metric Score
ROUGE-L 0.9382
BLEU 0.8152
METEOR 0.8923
WER 0.1192
CER 0.0752

These scores were measured on the held-out ViDia2Std test split used in the project notebook.

Downloads last month
46
Safetensors
Model size
0.6B params
Tensor type
F32
·
Inference Examples
Examples

mày đi đâu vậy mày, tao không biết

This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for coutMinh/mbart-large-50

Finetuned
(354)
this model

Space using coutMinh/mbart-large-50 1