MaxPoolBERT: Enhancing BERT Classification via Layer- and Token-Wise Aggregation
Maike Behrendt, Stefan Sylvius Wagner, Stefan Harmeling
TL;DR
MaxPoolBERT introduces lightweight refinements to BERT by enriching the CLS token through depth- and width-wise aggregation across layers and tokens. It studies three variants—Max_CLS, MHA, and Max_Seq+MHA—and a combined MaxSeq+MHA approach, which yields the strongest and most consistent improvements on GLUE, particularly in low-resource scenarios, without requiring pretraining. The results show an average gain of about $1.25$ points over BERT base, with notable robustness on small datasets and some transferability to RoBERTa. The approach is simple to apply during fine-tuning and adds minimal overhead, suggesting practical benefits for sentence-level classification tasks where data is limited.
Abstract
The [CLS] token in BERT is commonly used as a fixed-length representation for classification tasks, yet prior work has shown that both other tokens and intermediate layers encode valuable contextual information. In this work, we study lightweight extensions to BERT that refine the [CLS] representation by aggregating information across layers and tokens. Specifically, we explore three modifications: (i) max-pooling the [CLS] token across multiple layers, (ii) enabling the [CLS] token to attend over the entire final layer using an additional multi-head attention (MHA) layer, and (iii) combining max-pooling across the full sequence with MHA. Our approach, called MaxPoolBERT, enhances BERT's classification accuracy (especially on low-resource tasks) without requiring new pre-training or significantly increasing model size. Experiments on the GLUE benchmark show that MaxPoolBERT consistently achieves a better performance than the standard BERT base model on low resource tasks of the GLUE benchmark.
