Abstract
In recent years, pre-trained language models have achieved remarkable success across various natural language understanding (NLU) tasks. However, the massive parameter counts of these models often hinder their deployment in resource-constrained environments. While lightweight versions like ALBERT and DistilBERT exist for English, Spanish-specific equivalents have remained scarce. This paper introduces ALBETO and DistilBETO, a suite of efficient models pre-trained exclusively on Spanish corpora. Our evaluation using the GLUES benchmark demonstrates that these models achieve competitive performance compared to the standard Spanish BERT (BETO). Notably, our largest ALBETO variant outperforms BETO on several complex tasks, including document classification and question answering, while our smallest models offer extreme compression for mobile applications.
Introduction
The evolution of Large Language Models (LLMs) has revolutionized Natural Language Processing (NLP), yet their deployment often hits a "wall" due to hardware limitations. Models like BERT are frequently too slow for real-time web services and too memory-intensive for smartphones. To address this, researchers have developed compression techniques such as parameter sharing and knowledge distillation.
For the Spanish-speaking world, developers have historically faced a difficult choice: utilize heavy monolingual models like BETO or rely on multilingual models that may lack the linguistic nuance of a dedicated Spanish model. ALBETO and DistilBETO fill this gap, providing high-performance, efficient alternatives optimized for the Spanish language.
Methodology
We adapted two distinct architectural strategies to create these lightweight Spanish models:
ALBETO (Spanish ALBERT)
ALBETO utilizes the ALBERT architecture, which focuses on reducing parameter count through two main techniques:
- Cross-layer Parameter Sharing: Instead of each layer possessing unique weights, the model "recycles" weights across its layers, significantly reducing the total number of parameters without necessarily sacrificing depth.
- Factorized Embedding Parameterization: By separating the size of the vocabulary embeddings from the size of the hidden layers, the model can scale its internal representations more efficiently.
We released five versions of ALBETO: tiny (5M parameters), base (12M), large (18M), xlarge (60M), and xxlarge (223M).
DistilBETO (Spanish DistilBERT)
DistilBETO is built using Knowledge Distillation. In this framework, a smaller "student" model is trained to replicate the behavior and output distributions of a larger "teacher" model—in this case, the original BETO. The resulting model contains 67M parameters, making it 40% smaller and approximately 60% faster than its teacher while retaining the vast majority of its predictive power.
Experimental Setup
Pre-training
All models were trained on a massive 3-billion-word Spanish corpus, including the entirety of the Spanish Wikipedia and the Spanish portions of the OPUS Project. Training was conducted using the LAMB optimizer, which is optimized for large-batch training, on Google TPU v3-8 hardware.
Evaluation: The GLUES Benchmark
To rigorously test the models, we utilized the GLUES (Spanish version of GLUE) benchmark, covering a diverse range of NLU tasks:
- MLDoc: Document classification.
- Universal Dependencies (v1.4): Part-of-Speech (POS) tagging.
- CoNLL-2002: Named Entity Recognition (NER).
- PAWS-X: Paraphrase identification.
- XNLI: Natural Language Inference.
- Question Answering: Evaluated via MLQA, SQAC, and XQuAD datasets.
Results and Discussion
Our findings indicate that lightweight models can match or even exceed the performance of their larger counterparts in specific contexts.
The Efficiency-Performance Trade-off
ALBETO base, with only 12M parameters, achieved 97% of the performance of the 110M-parameter BETO. For extreme use cases, ALBETO tiny (5M parameters) retained 87% of BETO's performance while being 22 times smaller. This suggests that for many practical applications, standard BERT models may be over-provisioned for the task at hand.
State-of-the-Art Performance
The ALBETO xxlarge model set new benchmarks for Spanish NLP. Despite having more parameters (223M) than BETO, its use of weight-tying allows it to remain computationally efficient during specific training phases while delivering superior results on complex tasks. It outperformed BETO on MLDoc, PAWS-X, XNLI, and all three Question Answering datasets. In the MLQA dataset specifically, ALBETO xxlarge surpassed BETO cased by 2.5 points in F1 score.
The Sequence Tagging Gap
Interestingly, the original BETO (cased) remains the leader in Named Entity Recognition (NER) and Part-of-Speech (POS) tagging. This is likely because entity identification relies heavily on capitalization cues. As the current lightweight models are primarily uncased, they struggle to leverage these orthographic features as effectively as the cased BETO model.
Conclusion and Future Work
ALBETO and DistilBETO provide the Spanish NLP community with powerful, efficient tools for a variety of applications, from mobile deployment to high-throughput web services. While a performance gap remains in sequence tagging tasks, the success of ALBETO xxlarge in reading comprehension and inference is a significant step forward.
Future research will focus on closing the gap in NER and POS tagging through specialized distillation techniques (such as those used in TinyBERT) and conducting more rigorous benchmarks of actual inference latency across diverse hardware environments, including CPUs and mobile processors.
Summary updated