[Paper Review] PhayaThaiBERT: Enhancing a Pretrained Thai Language Model with Unassimilated Loanwords
This paper introduces PhayaThaiBERT, a fine-tuned and vocabulary-enhanced variant of WangchanBERTa that improves understanding of unassimilated loanwords—especially English terms—by expanding its tokenizer vocabulary via transfer from XLM-R and pretraining on a larger, 156.5GB dataset. The model achieves superior performance on downstream tasks, particularly in token classification with high loanword prevalence, demonstrating significant gains in accuracy where foreign word understanding is critical.
While WangchanBERTa has become the de facto standard in transformer-based Thai language modeling, it still has shortcomings in regard to the understanding of foreign words, most notably English words, which are often borrowed without orthographic assimilation into Thai in many contexts. We identify the lack of foreign vocabulary in WangchanBERTa's tokenizer as the main source of these shortcomings. We then expand WangchanBERTa's vocabulary via vocabulary transfer from XLM-R's pretrained tokenizer and pretrain a new model using the expanded tokenizer, starting from WangchanBERTa's checkpoint, on a new dataset that is larger than the one used to train WangchanBERTa. Our results show that our new pretrained model, PhayaThaiBERT, outperforms WangchanBERTa in many downstream tasks and datasets.
Motivation & Objective
- To address the limitation of WangchanBERTa in understanding orthographically unassimilated loanwords, especially English terms, in Thai text.
- To improve the model's performance on downstream NLP tasks involving code-switched or foreign-word-heavy Thai text.
- To expand WangchanBERTa’s vocabulary by transferring foreign word tokens from XLM-R’s tokenizer to better capture unassimilated loanwords.
- To pretrain the enhanced model on a larger, 156.5GB dataset than WangchanBERTa’s original training data to improve generalization.
- To evaluate whether enhanced foreign word understanding leads to measurable performance gains across diverse Thai NLP benchmarks.
Proposed method
- Expanded WangchanBERTa’s SentencePiece unigram tokenizer by transferring foreign word subword units from XLM-R’s pretrained tokenizer.
- Initialized the new model using WangchanBERTa’s checkpoint to preserve learned representations while adapting to the new vocabulary.
- Pretrained the model on a 156.5GB dataset, double the size of WangchanBERTa’s training data, using the same masked language modeling objective.
- Applied techniques such as space preservation and normalization of repeated characters to maintain compatibility with Thai-specific linguistic features.
- Fine-tuned the final PhayaThaiBERT model on multiple downstream NLP tasks, including sequence and token classification.
- Evaluated performance using standard metrics across diverse datasets, comparing against WangchanBERTa and XLM-R.
Experimental results
Research questions
- RQ1Does expanding the tokenizer vocabulary with foreign words improve a Thai language model’s ability to understand unassimilated loanwords?
- RQ2To what extent does pretraining on a larger dataset enhance performance on downstream Thai NLP tasks?
- RQ3Is there a measurable performance gain in tasks involving high proportions of unassimilated English loanwords, particularly in token classification?
- RQ4How does PhayaThaiBERT compare to WangchanBERTa and XLM-R in terms of zero-shot and fine-tuned performance across diverse datasets?
- RQ5Can vocabulary expansion and larger pretraining mitigate the limitations of existing Thai models in handling code-switched or foreign-influenced Thai text?
Key findings
- PhayaThaiBERT outperforms WangchanBERTa on multiple downstream tasks, with the most significant improvements observed in token classification datasets with high loanword prevalence.
- On the Thai_NNER dataset, which contains 38.54% unassimilated English words, PhayaThaiBERT achieved a +4.95% F1-score gain over WangchanBERTa.
- In the Yelp Review Full dataset—entirely in English—PhayaThaiBERT achieved a +9.86% F1-score gain, indicating strong performance on foreign-language content.
- The model showed a +6.72% F1-score improvement on the English-only Yelp dataset, confirming that enhanced foreign word handling directly improves performance in such contexts.
- For sequence classification tasks with moderate loanword presence (e.g., wisesight_sentiment at 27.59%), PhayaThaiBERT achieved a +1.8% F1-score gain, demonstrating consistent improvement.
- Despite improvements, PhayaThaiBERT did not surpass XLM-R on the generated_reviews_enth dataset, suggesting limitations in handling machine-translated content.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.