ViCLSR: A Supervised Contrastive Learning Framework with Natural Language Inference for Natural Language Understanding Tasks
Organizations: University of Information Technology, Ho Chi Minh City, Vietnam. · Vietnam National University, Ho Chi Minh City, Vietnam.
Abstract
High-quality text representations are crucial for natural language understanding (NLU), but low-resource languages like Vietnamese face challenges due to limited annotated data. While pre-trained models like PhoBERT and CafeBERT perform well, their effectiveness is constrained by data scarcity. Contrastive learning (CL) has recently emerged as a promising approach for improving sentence representations, enabling models to effectively distinguish between semantically similar and dissimilar sentences. We propose ViCLSR (Vietnamese Contrastive Learning for Sentence Representations), a novel supervised contrastive learning framework specifically designed to optimize sentence embeddings for Vietnamese, leveraging existing natural language inference (NLI) datasets. Additionally, we propose a process to adapt existing Vietnamese datasets for supervised learning, ensuring compatibility with CL methods. Our experiments demonstrate that ViCLSR significantly outperforms the powerful monolingual pre-trained model PhoBERT on five benchmark NLU datasets such as ViNLI (+6.97% F1), ViWikiFC (+4.97% F1), ViFactCheck (+9.02% F1), UIT-ViCTSD (+5.36% F1), and ViMMRC2.0 (+4.33% Accuracy). ViCLSR shows that supervised contrastive learning can effectively address resource limitations in Vietnamese NLU tasks and improve sentence representation learning for low-resource languages. Furthermore, we conduct an in-depth analysis of the experimental results to uncover the factors contributing to the superior performance of contrastive learning models. ViCLSR is released for research purposes in advancing natural language processing tasks.
Figures & tables
| Dataset | premise (x) | Hypothesis | (x, x+, x-) | |
| Entailment (x+) | Contradiction (x-) | |||
| ViNLI | 6,094 | 6,094 | 6,094 | 6,094 |
| XNLI | 2,500 | 2,500 | 2,500 | 2,500 |
| Total | 8,594 | 8,594 | 8,594 | 8,594 |
| Dataset | Train | Dev | test | Task | Source | Domain | Metrics | Classes |
| ViNLI | 24,376 | 3,009 | 2,991 | NLI | Online news | Open domain | Acc/F1 | 3 |
| ViWikiFC | 16,738 | 2,090 | 2,091 | Fact checking | Wikipedia | Open domain | Acc/F1 | 3 |
| ViFactCheck | 5,062 | 723 | 1,447 | Fact checking | Online news | Open domain | F1 | 3 |
| UIT-ViCTSD | 7,000 | 1,000 | 2,000 | Constructive speech detection | Social media | Open domain | Acc/F1 | 2 |
| ViMMRC2.0 | 3,600 | 564 | 1,109 | Multiple-choice MRC | Student textbooks | Literature | Acc | - |
| Model | #Params | #Layers | #Heads | #Hidden | #Vocab | Language | Data Source | CL Strategy |
| PhoBERT Base | 135M | 12 | 12 | 768 | 64K | Monolingual | Wikipedia, News | No |
| PhoBERT Large | 370M | 24 | 16 | 1024 | 64K | Monolingual | Wikipedia, News | No |
| mBERT | 179M | 12 | 12 | 768 | 119K | Multilingual | Wikipedia | No |
| XLM-R Base | 270M | 12 | 8 | 768 | 250K | Multilingual | CommonCrawl | No |
| XLM-R Large | 550M | 24 | 16 | 1024 | 250K | Multilingual | CommonCrawl | No |
| CafeBERT | 550M | 24 | 16 | 1024 | 250K | Multilingual | Wikipedia, News | No |
| Models | NLI | Fact Checking | Constructive Speech Detection | MRC | ||||
| ViNLI | ViWikiFC | ViFactCheck | UIT-ViCTSD | ViMMRC2.0 | ||||
| Acc | F1 | Acc | F1 | F1 | Acc | F1 | Acc | |
| PhoBERT Base | 72.87 | 72.79 | 80.67 | 80.70 | 77.76 | 79.40 | 78.59 | 53.92 |
| PhoBERT Large | 75.93 | 75.87 | 81.63 | 81.62 | 79.76 | 80.70 | 76.86 | 54.73 |
| mBERT | 64.84 | 64.83 | 75.93 | 76.01 | 69.94 | 78.90 | 76.70 | 53.38 |
| XLM-R Base | 71.59 | 71.51 | 78.53 | 78.56 | 81.10 | 80.40 | 78.10 | 29.39 |
| 0.001 | 0.01 | 0.05 | 0.1 | 0.5 | 1 | |
| ViNLI | 82.66 | 82.48 | 83.28 | 82.04 | 82.75 | 81.46 |
| ViWikiFC | 87.70 | 86.65 | 88.56 | 86.79 | 86.75 | 87.03 |
| ViFactCheck | 88.38 | 88.11 | 87.97 | 87.00 | 87.23 | 85.20 |
| UIT-ViCTSD | 81.59 | 82.30 | 82.75 | 82.35 | 80.55 | 82.70 |
| ViMMRC2.0 | 55.67 | 55.62 | 56.38 | 55.85 | 55.11 | 55.02 |
| w/o | 0.001 | 0.01 | 0.05 | 0.1 | 0.5 | 1 | |
| ViNLI | 83.28 | 82.08 | 83.10 | 82.04 | 82.57 | 82.35 | 82.44 |
| ViWikiFC | 88.56 | 86.41 | 86.99 | 88.18 | 86.89 | 87.99 | 87.13 |
| ViFactCheck | 87.97 | 87.11 | 87.28 | 88.11 | 86.86 | 87.55 | 86.58 |
| UIT-ViCTSD | 82.75 | 81.69 | 82.30 | 82.49 | 82.23 | 82.15 | 80.40 |
| ViMMRC2.0 | 56.38 | 54.28 | 55.27 | 55.73 | 54.78 | 54.78 | 54.28 |
| Pooling Type | [CLS] | Mean | First-Last | Top-2 |
| ViNLI | 83.28 | 82.93 | 82.66 | 82.50 |
| ViWikiFC | 88.56 | 87.37 | 87.51 | 87.56 |
| ViFactCheck | 87.97 | 87.00 | 87.14 | 87.00 |
| UIT-ViCTSD | 82.75 | 82.64 | 82.24 | 82.02 |
| ViMMRC2.0 | 56.38 | 55.49 | 55.16 | 55.92 |
| Pooling Type | Models | Top 1 | Top 3 | Top 5 | Top 10 |
| [CLS] Pooling | ViCLSR | 82.62 | 90.96 | 93.50 | 96.04 |
| XLM-R Large | 16.52 | 19.06 | 19.35 | 21.18 | |
| PhoBERT Large | 24.43 | 28.38 | 29.51 | 31.92 | |
| mBERT | 48.72 | 59.32 | 63.55 | 67.65 | |
| CafeBERT | 42.37 | 50.00 | 54.94 | 59.60 | |
| DiffCSE | 40.68 | 49.01 | 52.54 | 56.50 |
| ViCLSR | XLM-R Large | PhoBERT Large |
|---|---|---|
| Query 1 : ” Tô Định là kẻ vô cùng xấu xa và tàn độc. ” (Tô Định was an extremely wicked and cruel man.) Gold evidence : ” Năm 39, thái thú quận Giao Chỉ là Tô Định tàn ác, giết chồng của Trưng Trắc là Thi Sách. ” (In the year 39, Tô Định, the cruel governor of Giao Chỉ district, killed Thi Sách, the husband of Trưng Trắc.) | ||
| #1. Năm 39, thái thú quận Giao Chỉ là Tô Định tàn ác, giết chồng của Trưng Trắc là Thi Sách. (In the year 39, Tô Định, the cruel governor of Giao Chỉ district, killed Thi Sách, the husband of Trưng Trắc.) | #1. Nhà Thương thường phái quân đội đi chiến đấu chống lại những bộ tộc lân cận. (The Shang dynasty often sent its armies to fight against neighboring tribes.) | #1. Điều này hiển nhiên rất khó khiến người ta tin tưởng. (This is obviously very hard for people to believe.) |
| #2. Năm Cam, Khánh Trắng là một số ví dụ về băng nhóm tội phạm có tổ chức. (Năm Cam and Khánh Trắng are examples of organized criminal gangs.) | #2. Các trang phục của người dân tộc thiểu số cũng có thể sử dụng. (The traditional costumes of ethnic minorities can also be used.) | #2. Theo cư dân địa phương, bà rất linh thiêng. (According to local residents, she is considered very sacred.) |
| #3. Năm 931, Dương Đình Nghệ là tướng cũ của Khúc Hạo đem quân đánh phủ thành Đại La. (In 931, Dương Đình Nghệ, a former general of Khúc Hạo, led his army to attack the Đại La citadel.) | #3. Chính quyền này kiểm soát chặt chẽ mọi mặt của đời sống. (This government tightly controls all aspects of life.) | #3. Chính quyền này kiểm soát chặt chẽ mọi mặt của đời sống. (This government tightly controls all aspects of life.) |
| Query 2 : ” Singapore sở hữu 12 khu vực công nghiệp. ” (Singapore has 12 industrial zones.) Gold_evidence : ” Singapore có 12 khu vực công nghiệp lớn, trong đó lớn nhất là Khu công nghiệp Jurong. ” (Singapore has 12 major industrial zones, the largest of which is the Jurong Industrial Estate.) | ||
| #1. Singapore có 12 khu vực công nghiệp lớn, trong đó lớn nhất là Khu công nghiệp Jurong. (Singapore has 12 major industrial zones, the largest of which is the Jurong Industrial Estate.) | #1. Tại đó, người dân bầu cho mọi việc. (At that place, the people vote on everything.) | #1. Kinh tế của Palawan chủ yếu phụ thuộc vào nông nghiệp. (Palawan’s economy mainly depends on agriculture.) |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Sentence Embeddings
Sentence embeddings map sentences to vectors for semantic similarity, retrieval, clustering, and downstream language tasks.
See all 35 papers