Effective Pretraining Objectives for Transformer-based Autoencoders

Luca Di Liello, Matteo Gabburo, Alessandro MoschittiEMNLP 2022

Introduction

Pre-training state-of-the-art Transformer models like BERT or RoBERTa is computationally intensive, often requiring massive GPU clusters. A significant portion of this "hidden tax" stems from the Masked Language Modeling (MLM) objective. MLM requires the model to predict a specific token from a vocabulary of over 30,000 possibilities, necessitating a massive classification head. For smaller models, this head can account for 30-64% of the total memory footprint during training.

While models like ELECTRA introduced a more efficient "discriminator" approach, they require an additional "generator" model, adding overhead. This paper explores highly efficient pre-training objectives that replace massive output layers with tiny binary classification heads and smarter token substitution strategies, achieving up to a 45% training speedup without sacrificing accuracy.

Proposed Pre-training Objectives

The authors propose three primary alternatives to standard MLM, visualized in Figure 1.

Comparison of MLM, RTS, and SLM pre-training objectives.
  1. Random Token Substitution (RTS): Instead of using a generator, RTS replaces 15% of tokens with random ones from the vocabulary. The model performs Token Detection (TD)—a binary classification task to determine if a token is original or substituted. This reduces the output head size from ~30,000 to just 2.
  2. Cluster-based Random Token Substitution (C-RTS): To prevent the task from becoming too easy, C-RTS groups tokens into clusters (using word2vec and K-Means). It selects replacements from "confusing" clusters that the model struggles to distinguish, providing a harder learning signal.
  3. Swapped Language Modeling (SLM): A variant of MLM where tokens are replaced with random tokens instead of a special [MASK] token. The model still predicts the original token using a large head, but this eliminates the discrepancy between pre-training (where [MASK] is seen) and fine-tuning (where it is not).

Experimental Setup

The models were pre-trained on English Wikipedia and BookCorpus (approx. 3.3 billion words). Evaluation was conducted across two major benchmarks:

  • GLUE Benchmark: Nine diverse Natural Language Understanding tasks, including sentiment analysis and entailment.
  • Answer Sentence Selection (AS2): Tasks critical for search and QA, including ASNQ, WikiQA, and TREC-QA.

Key Insights

The Softmax Bottleneck

For smaller architectures, the final linear layer and softmax calculation are disproportionately expensive. Moving to a binary head (as in RTS/C-RTS) provides a massive efficiency boost that standard layer-count metrics often overlook.

The [MASK] Token is Optional

Results from SLM suggest that the [MASK] token may actually hinder performance by creating a mismatch between training and inference. Simply swapping tokens proved more effective across almost every task.

Task Difficulty and Learning Signal

C-RTS outperforms RTS over longer training runs. As random swaps become trivial for the model to detect, the clustering approach maintains a sustained learning signal by picking more plausible "fakes."

Results and Efficiency

The proposed objectives demonstrate significant gains in both training speed and downstream accuracy.

Complexity and training time comparison between MLM and the proposed objectives for small models.

As shown in Figure 6, RTS and C-RTS reduce the LM head complexity from $O(bs \times L \times |V|)$ to $O(bs \times L)$. This translates to a reduction in training time from 31 hours (1d 7h) to just 17 hours for "small" models—a 45% speedup. For "base" models, the speedup is approximately 20%.

In terms of accuracy:

  • SLM consistently outperformed standard MLM on nearly every task within the same computational budget.
  • RTS and C-RTS matched or exceeded MLM performance on GLUE and AS2 benchmarks despite the lower cost. Notably, on WikiQA, RTS outperformed MLM by nearly 5 MAP points when training small models from scratch.

Limitations and Future Work

The current study focused on English and "small" to "base" model architectures. Future research is needed to determine if these benefits scale to "large" models or apply to languages with more complex morphologies. Additionally, combining these objectives with other efficiency techniques like parameter sharing (as in ALBERT) could further advance "green" AI initiatives.

Summary updated

BibTeX
@inproceedings{liello2022effective,
  author = {Luca Di Liello and Matteo Gabburo and Alessandro Moschitti},
  title = {{Effective Pretraining Objectives for Transformer-based Autoencoders}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.405},
}
Figure