PhoBERT-VFQT-Cls

Vietnamese financial question-type classifier fine-tuned from vinai/phobert-base-v2.

Model Details

Model Description

  • Model type: Encoder-only Transformer (PhoBERT / RoBERTa) for sequence classification (RobertaForSequenceClassification)
  • Task: Financial question type classification (4 labels)
  • Language: Vietnamese
  • Finetuned from: vinai/phobert-base-v2
  • Pipeline tag: text-classification
  • Developed by: tiam4tt

The training notebook uses AutoTokenizer, AutoModelForSequenceClassification, and a custom WeightedTrainer(Trainer) that applies class-weighted cross entropy.

Labels

The label mapping used during training (saved in config.json) is:

id label
0 COMPARISON
1 FACTOID
2 SUMMARY
3 VERIFICATION

Model Sources

Uses

Direct Use

  • Route Vietnamese financial questions to the right downstream module (factoid retrieval vs. summarization vs. verification vs. comparison).
  • Dataset labeling / analysis for question-type distribution.

Out-of-Scope Use

  • Non-Vietnamese text or non-question inputs.
  • High-stakes domains (medical/legal) without additional validation.

Bias, Risks, and Limitations

  • Domain shift: trained on a specific finance/news-style dataset; performance may drop on other writing styles or topics.
  • Single-label constraint: real questions can be multi-intent; the model outputs exactly one label.
  • Downstream risk: misclassification can route requests into the wrong pipeline.

Usage (Run Example)

Install deps:

pip install -U "transformers" "torch" "sentencepiece"

Run a single prediction:

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

MODEL_ID = "tiam4tt/PhoBERT-VFQT-Cls"  # or a local path to this folder

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
model.eval()

text = "Tăng trưởng GDP quý này so với quý trước như thế nào?"

inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
    logits = model(**inputs).logits

pred_id = int(torch.argmax(logits, dim=-1).item())
id2label = model.config.id2label
pred_label = id2label.get(pred_id, id2label.get(str(pred_id), f"LABEL_{pred_id}"))

print(pred_label)

# Expects: "COMPARISON"

Evaluation Results

  • Accuracy: 0.9486
  • Macro F1: 0.9508
  • Weighted F1: 0.9485

Per-class report (test set)

label precision recall f1
COMPARISON 0.9576 0.9480 0.9528
FACTOID 0.9153 0.9080 0.9116
SUMMARY 0.9506 0.9620 0.9563
VERIFICATION 0.9784 0.9864 0.9824

Technical Specifications

Compute Infrastructure

  • GPU: Tesla T4
  • CUDA: 12.8
  • PyTorch: 2.10.0+cu128
  • Transformers: 5.0.0 (recorded in config.json)

Model Card Contact

Downloads last month
163
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tiam4tt/PhoBERT-VFQT-Cls

Finetuned
(332)
this model