Token Dropping for Efficient BERT Pretraining

Le Hou, Richard Yuanzhe Pang, Tianyi Zhou, Yuexin Wu, Xinying Song, Xiaodan Song, Denny Zhou

Introduction

Training large-scale Transformer models like BERT involves significant computational costs and environmental impact. A primary inefficiency in standard pretraining is the uniform allocation of computation across all tokens in a sequence. Regardless of whether a token is a common stopword or a rare, context-critical term, it undergoes the same number of operations throughout all layers. This paper introduces a "token dropping" strategy designed to identify and skip redundant tokens in intermediate layers, effectively focusing the computational budget on the most informative parts of the input sequence.

Methodology

The proposed approach optimizes pretraining through a four-step pipeline:

  1. Importance Identification: Rather than employing an external model, the system uses its own Masked Language Modeling (MLM) loss as a proxy for token importance. By maintaining a running average of loss per vocabulary item, the model identifies "hard" (high loss) tokens as important and "easy" (low loss) tokens as unimportant.
  2. Strategic Dropping: In a standard 12-layer BERT architecture, the initial and final layers process the entire sequence to establish and finalize representations. However, in the intermediate layers, approximately 50% of the tokens—those deemed "unimportant"—are dropped from the computation.
  3. The Re-merging Mechanism: To maintain a full-length output for loss calculation, dropped tokens are "picked up" before the final layer. Their representations from the last full-processing layer are bypassed around the middle layers and merged back with the processed "important" tokens.
  4. Sequence Packing: To ensure efficiency gains are substantive and not merely the result of dropping padding, the researchers utilized sequence packing to create dense inputs.
Architecture of the token dropping mechanism, showing how unimportant tokens bypass intermediate layers.

Experimental Setup

The models were pretrained on the standard BooksCorpus (~11,000 unpublished books) and English Wikipedia. Evaluation was conducted using the GLUE benchmark (focusing on the six largest datasets: MNLI, QNLI, QQP, SST, etc.) and the SQuAD (v1.1 and v2.0) question-answering datasets.

Key Results and Insights

The token dropping method achieved a 25% reduction in pretraining costs while maintaining or slightly exceeding baseline performance on downstream tasks.

Performance comparison of the proposed token dropping method against various baselines on GLUE and SQuAD benchmarks.

Key findings include:

  • Efficiency vs. Performance: The proposed method significantly outperformed a "compute-equivalent" baseline (a standard BERT trained for only 75% of the steps).
  • Model Flexibility: The success of this approach suggests that the middle layers of Transformers are highly flexible, capable of building robust global representations without processing every token at every step.
  • Generalization: Surprisingly, "Stage-2" pretraining (re-introducing all tokens before fine-tuning) was found to be unnecessary; the models generalized to full sequences during fine-tuning naturally.
  • Selection Strategy: Strict dropping based on the loss signal proved superior to strategies involving randomness or frequency-based dropping.

Limitations and Future Work

While effective, the study was limited to English-language corpora. The optimal dropping ratio (found to be 50% here) may vary for morphologically richer languages. Additionally, while a fixed ratio was used, future research could explore dynamic dropping rates that adapt to the training stage or specific sequence content. There is also significant potential for applying this technique to long-context Transformers where token redundancy is likely even higher.

Summary updated

BibTeX
@inproceedings{hou2022token,
  author = {Le Hou and Richard Yuanzhe Pang and Tianyi Zhou and Yuexin Wu and Xinying Song and Xiaodan Song and Denny Zhou},
  title = {{Token Dropping for Efficient BERT Pretraining}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=MtZv5bW-Puo},
}
Figure