Manuscript Offprint

arXiv:2610.30067

GoiBERT: Compact Vietnamese Language Models via Two-Stage Knowledge Distillation

Quang Anh Kiet Tran, Nam Anh Tran, Manh Hung Trinh, Thanh Danh Le, Khang Nhat Hoang Vo, Huynh Dai Nhan Tran

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Vietnamese pre-trained encoders have improved rapidly, but the strongest ones are large, multilingual-vocabulary models or depend on external word segmentation, which makes them costly to deploy. We present GoiBERT, a family of two compact Vietnamese encoders with 26M and 49M parameters that operate directly on raw text. GoiBERT learns from two complementary teachers. A same-tokenizer Vietnamese encoder first teaches general-purpose representations. A much larger teacher then provides task-level guidance through soft labels that are generated without ever labeling its own training data. Across eight benchmarks covering text classification, aspect-based sentiment analysis, natural language inference, and named entity recognition, GoiBERT-large achieves the highest average score among non-teacher models. It does so with fewer than half the parameters of the strongest compact baseline and twice its throughput. GoiBERT-base retains 99% of that baseline's performance at a quarter of its size. Our analysis shows that compression is nearly lossless for sentiment and classification tasks but remains costly for inference and entity recognition, which points to clear directions for future work. Our code and models are available at: https://github.com/Nhantran65/GoiBERT.git

1 Introduction

Pre-trained Transformer encoders remain the workhorse of practical language understanding: they power text classification, sentiment analysis, information extraction, and retrieval in production systems where generative large language models are too slow or too costly to serve (Devlin et al., 2019; Liu et al., 2019b; Conneau et al., 2020; Warner et al., 2025). Vietnamese NLP has followed this trajectory closely, moving from multilingual

Figure

Figure 1: Average score over eight Vietnamese benchmarks versus model size. Both GoiBERT variants lie on the accuracy–efficiency frontier of non-teacher models: GoiBERT-large has the highest average with less than half of BamiBERT’s parameters, and GoiBERT-base stays close with about a quarter of them.

encoders to a growing family of monolingual models such as PhoBERT, ViDeBERTa, ViSoBERT, and the recent BamiBERT, as well as CafeBERT, a large XLM-R model further adapted to Vietnamese (Nguyen and Tuan Nguyen, 2020; Tran et al., 2023; Nguyen et al., 2023b, 2026; Do et al., 2024).

These models have steadily raised the bar on Vietnamese benchmarks, but each comes with a deployment cost. The strongest model, CafeBERT, has 559M parameters, and more than 45% of them sit in its multilingual embedding matrix. PhoBERT expects word-segmented input and therefore needs an external segmenter at inference time (Vu et al., 2018). ViSoBERT targets social-media text, and even the most compact strong monolingual baseline, BamiBERT, uses a 102M-parameter encoder. For the many Vietnamese applications that run on CPUs, small GPUs, or under tight latency budgets, the field still lacks a compact, segmentation-free encoder that holds up across diverse tasks.

Knowledge distillation (KD) is the standard tool for closing this gap in English, where compact

∗^{*} Equal contribution.

students such as DistilBERT, TinyBERT, MobileBERT, and MiniLM retain most of their teachers' accuracy at a fraction of their cost (Hinton et al., 2015; Sanh et al., 2019; Jiao et al., 2020; Sun et al., 2020; Wang et al., 2020). Transferring these recipes to Vietnamese, however, raises a design question that English work rarely faces: which teacher should the student learn from? The most accurate Vietnamese teacher (CafeBERT) uses a large multilingual vocabulary that does not match any compact Vietnamese tokenizer. This rules out the token-level hidden-state and attention matching that makes TinyBERT-style general distillation effective. A same-tokenizer teacher (BamiBERT) supports such matching but is itself weaker on several tasks. To our knowledge, no prior work has studied how to combine these complementary signals for Vietnamese, and Vietnamese compact encoders have not been evaluated systematically for both accuracy and deployment cost.

We present GoiBERT, a family of two compact Vietnamese encoders: GoiBERT-base (26.4M parameters) and GoiBERT-large (49.4M parameters). Our key idea is to assign each teacher to the stage where its strengths matter. In the first stage, BamiBERT, which shares GoiBERT's tokenizer, teaches general-purpose representations through layer-wise hidden-state and attention transfer on unlabeled text. In the second stage, CafeBERT supplies task-specific soft labels at the output level, where tokenizer mismatch is irrelevant. We produce these labels out of fold, so that no teacher ever labels an example it was trained on. As Figure 1 shows, the resulting students move the accuracy–efficiency frontier for Vietnamese. GoiBERT-large achieves the best average score among non-teacher models with fewer than half of BamiBERT's parameters and twice its GPU throughput. GoiBERT-base retains 99% of BamiBERT's average score with a quarter of its parameters and 3.5×3.5 \times its throughput.

Our contributions are threefold:

• Models. We release GoiBERT-base and GoiBERT-large, compact Vietnamese encoders that process raw text without word segmentation and offer two complementary accuracy–efficiency operating points.

• Method. We propose a two-teacher, two-stage distillation framework. It pairs representation transfer from a tokenizer-compatible teacher with out-of-fold, output-level supervision from a stronger cross-tokenizer teacher, and it combines this with teacher-derived embedding initialization and layer-wise learning-rate decay.

• Analysis. We evaluate on eight benchmarks (15 metrics, three seeds) and measure parameters, FLOPs, throughput, memory, and CPU latency. Ablations and per-task analysis show where compression is nearly free (sentiment, ABSA, topic, and spam classification) and where it still costs accuracy (NLI and NER).

References (19)