Downloads · 30 days
6
3% of all-time downloads
lyle49/xlmr-vinli-finetune
xlmr-vinli-finetune is a text classification model from lyle49. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
This model is a fine-tuned version of the xlm-roberta-base model, specifically adapted for Natural Language Inference (NLI) tasks in Vietnamese. It classifies the relationship between a given premise and hypothesis in…
Downloads · 30 days
6
3% of all-time downloads
All-time downloads
181
Public
Parameters
278M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
This model is a fine-tuned version of the xlm-roberta-base model, specifically adapted for Natural Language Inference (NLI) tasks in Vietnamese. It classifies the relationship between a given premise and hypothesis into one of three categories: entailment, neutral, or contradiction.
The core of this model is XLM-RoBERTa, a multilingual masked language model pre-trained on text from 100 different languages. This powerful base is then fine-tuned on a Vietnamese NLI dataset. The fine-tuning process adapts the model to the specific nuances of Vietnamese language and the logical reasoning required for NLI.
The training was conducted for 4 epochs with a batch size of 16 for training and 32 for evaluation. It utilized the AdamW optimizer with a learning rate of 2e-5 and a linear scheduler with a 6% warmup. To accelerate the training, FP16 precision was used on a GPU P100.
The model was trained and evaluated on a custom Vietnamese NLI dataset with the following splits:
/kaggle/input/train-nli/train.json/kaggle/input/train-nli/vinli_dev.json/kaggle/input/train-nli/vinli_test.jsonEach entry in the dataset consists of a premise, a hypothesis, and a corresponding label indicating their relationship.
The model demonstrates solid performance on the Vietnamese NLI task, achieving the following results:
Validation:
Test:
| Label | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| contradiction | 0.7061 | 0.6716 | 0.6885 | 737 |
| neutral | 0.7240 | 0.7799 | 0.7509 | 777 |
| entailment | 0.7631 | 0.7387 | 0.7507 | 750 |
| Accuracy | 0.7310 | 2264 | ||
| Macro avg | 0.7311 | 0.7301 | 0.7300 | 2264 |
| Predicted C | Predicted N | Predicted E | |
|---|---|---|---|
| Gold C | 495 | 132 | 110 |
| Gold N | 109 | 606 | 62 |
| Gold E | 97 | 99 | 554 |
To use this model for your own Vietnamese NLI tasks, you can load it directly from the Hugging Face Hub using the transformers library.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "lyle49/xlmr-vinli-finetune"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
premise = "Một sào lúa non nuôi con nửa ngày"
hypothesis = "Lúa non chỉ nuôi được nửa ngày"
inputs = tokenizer(premise, hypothesis, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
logits = model(**inputs).logits
pred_id = logits.argmax(dim=-1).item()
id2label = model.config.id2label
print("Prediction:", id2label[pred_id])
xlm-roberta-large for potentially better performance, though this may require a smaller batch size to accommodate the larger model.If you use this model in your research, please use the following citation:
@misc{xlmr_vinli_finetune,
author = {Lê Lý},
title = {XLM-RoBERTa fine-tuned on Vietnamese NLI},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/lyle49/xlmr-vinli-finetune}}
}