Token and Head Adaptive Transformers for Efficient Natural Language Processing

Chonghan Lee, Md Fahim Faysal Khan, Rita Brugarolas Brufau, Ke Ding, Vijaykrishnan Narayanan


Abstract
While pre-trained language models like BERT have achieved impressive results on various natural language processing tasks, deploying them on resource-restricted devices is challenging due to their intensive computational cost and memory footprint. Previous approaches mainly focused on training smaller versions of a BERT model with competitive accuracy under limited computational resources. In this paper, we extend Length Adaptive Transformer and propose to design Token and Head Adaptive Transformer, which can compress and accelerate various BERT-based models via simple fine-tuning. We train a transformer with a progressive token and head pruning scheme, eliminating a large number of redundant tokens and attention heads in the later layers. Then, we conduct a multi-objective evolutionary search with the overall number of floating point operations (FLOPs) as its efficiency constraint to find joint token and head pruning strategies that maximize accuracy and efficiency under various computational budgets. Empirical studies show that a large portion of tokens and attention heads could be pruned while achieving superior performance compared to the baseline BERT-based models and Length Adaptive Transformers in various downstream NLP tasks. MobileBERT trained with our joint token and head pruning scheme achieves a GLUE score of 83.0, which is 1.4 higher than Length Adaptive Transformer and 2.9 higher than the original model.
Anthology ID:
2022.coling-1.404
Volume:
Proceedings of the 29th International Conference on Computational Linguistics
Month:
October
Year:
2022
Address:
Gyeongju, Republic of Korea
Venue:
COLING
SIG:
Publisher:
International Committee on Computational Linguistics
Note:
Pages:
4575–4584
Language:
URL:
https://aclanthology.org/2022.coling-1.404
DOI:
Bibkey:
Cite (ACL):
Chonghan Lee, Md Fahim Faysal Khan, Rita Brugarolas Brufau, Ke Ding, and Vijaykrishnan Narayanan. 2022. Token and Head Adaptive Transformers for Efficient Natural Language Processing. In Proceedings of the 29th International Conference on Computational Linguistics, pages 4575–4584, Gyeongju, Republic of Korea. International Committee on Computational Linguistics.
Cite (Informal):
Token and Head Adaptive Transformers for Efficient Natural Language Processing (Lee et al., COLING 2022)
Copy Citation:
PDF:
https://aclanthology.org/2022.coling-1.404.pdf
Data
GLUEQNLISQuAD