PhoBERT HCMUTE FAQ Retrieval
A sentence embedding model for Vietnamese FAQ search. It is vinai/phobert-base-v2 fine-tuned with Sentence-Transformers to match student questions to the closest FAQ about HCMUTE (Ho Chi Minh City University of Technology and Education).
This is the retrieval part of our course project, a Vietnamese FAQ chatbot. Code, data and the full report are on GitHub: Ticasslo/vietnamese-faq-chatbot.
How to use
PhoBERT expects word-segmented input, so lowercase the text and segment it with PyVi before encoding. This is the same preprocessing used during training.
pip install sentence-transformers pyvi
from sentence_transformers import SentenceTransformer
from pyvi import ViTokenizer
model = SentenceTransformer("TicassloThang/phobert-hcmute-faq-retrieval")
def prep(text):
return ViTokenizer.tokenize(text.strip().lower())
faqs = [
"chủ tịch hội đồng trường hcmute hiện nay là ai?",
"email chính thức của hiệu trưởng lê hiếu giang là gì?",
]
query = "cho em xin email của thầy hiệu trưởng"
faq_emb = model.encode([prep(q) for q in faqs], normalize_embeddings=True)
query_emb = model.encode([prep(query)], normalize_embeddings=True)
scores = model.similarity(query_emb, faq_emb) # cosine similarity with each FAQ
print(scores)
In the chatbot, FAQ embeddings are stored in ChromaDB (cosine distance) and the top 5 results are returned. A question whose best score is below 0.6 is treated as out of scope. This threshold was set by hand, not tuned.
Training
- Data: about 1,148 question and answer pairs from the HCMUTE 2025 student handbook, expanded with LLM-generated paraphrases into 10,502 (paraphrase, original question) pairs.
- Split: 80/10/10 by FAQ group, so all paraphrases of one FAQ stay in the same split and the test questions come from FAQs the model never saw.
- Loss: MultipleNegativesRankingLoss (other questions in the batch act as negatives).
- Settings: 2 epochs, batch size 32, learning rate 1e-5, AdamW, mean pooling, 768-dim embeddings.
- Hardware: 1 NVIDIA T4 16GB on Lightning AI.
Results
Test set: 1,150 paraphrased questions from unseen FAQs, searched against all 1,148 FAQs.
| Metric | TF-IDF | PhoBERT (original) | This model |
|---|---|---|---|
| Precision@1 | 71.83% | 73.39% | 96.09% |
| Precision@3 | 83.13% | 84.52% | 98.78% |
| Precision@5 | 85.48% | 87.30% | 99.30% |
| Not in top 5 | 167 | 146 | 8 |
| Similarity margin (correct minus wrong) | - | 0.188 | 0.757 |
Of the 45 questions not ranked first, 37 still have the correct FAQ in the top 5.
Limitations
- Trained only on HCMUTE FAQs from the 2025 handbook. It will not work well for other domains without more fine-tuning. The university has since been renamed, and the data still uses the old name.
- Mistakes happen mostly with strong paraphrases that use very different words from the FAQ, and with specialized terms or abbreviations.
- Some of the generated paraphrases used for training are low quality.
Team
Course project for Natural Language Processing at HCM-UTE (2026), by Huỳnh Thanh Nhân, Trương Tấn Sang and Huỳnh Ngọc Thắng.
License
AGPL-3.0, the same license as the base model vinai/phobert-base-v2.
Citation
If you use this model, please cite PhoBERT:
@inproceedings{phobert,
title = {{PhoBERT: Pre-trained language models for Vietnamese}},
author = {Dat Quoc Nguyen and Anh Tuan Nguyen},
booktitle = {Findings of the Association for Computational Linguistics: EMNLP 2020},
year = {2020},
pages = {1037--1042}
}