Abstract
Traditional Transformer architectures like BERT and ELECTRA rely on a rigid, interleaved pattern of self-attention and feed-forward layers. LV-BERT challenges this "stereotyped" design by introducing layer variety through dynamic convolutions and Neural Architecture Search (NAS). By utilizing a weight-sharing supernet and an evolutionary algorithm guided by Masked Language Modeling (MLM) accuracy, LV-BERT identifies non-intuitive yet highly effective layer sequences. Experimental results on GLUE and SQuAD benchmarks demonstrate that LV-BERT achieves state-of-the-art performance while maintaining computational efficiency.
Introduction
Since the introduction of BERT, the architectural backbone of pre-trained language models has remained largely unchanged: a repetitive stack of Self-Attention (SA) layers followed by Feed-Forward (FF) layers. While this "interleaved" pattern is successful, its optimality is rarely questioned. Current research suggests two primary inefficiencies in this rigid structure. First, many self-attention heads learn local dependencies that could be more efficiently captured by simple convolutions. Second, the manual design of layer patterns is limited by human intuition, whereas the search space for a 24-layer model exceeds 280 billion possible combinations.
Methodology: Layer Variety and NAS
LV-BERT addresses these limitations by expanding the architectural search space across two dimensions: Layer Type Set and Layer Order.
Expanded Layer Set
In addition to standard SA and FF layers, the authors introduce Dynamic Convolution (DC). Convolutions are inherently biased toward local context, allowing the model to offload local feature extraction to DC layers and reserve the computationally expensive attention mechanism for global dependencies.
Supernet Training and Evolutionary Search
To navigate the massive search space without training every candidate from scratch, LV-BERT employs a weight-sharing NAS approach. A single "supernet" is trained where each layer contains all three types (SA, FF, DC). During pre-training, paths are randomly sampled, allowing all potential sub-models to inherit weights.
Following supernet training, an evolutionary algorithm identifies the optimal architecture. The fitness function uses Masked Language Modeling (MLM) accuracy on a validation set as a proxy for downstream performance, significantly reducing the search cost. The final architecture is searched at a "small" scale and then scaled up to "medium" and "base" sizes.
Experimental Setup
The models were pre-trained on OpenWebText, a high-quality corpus similar to the original BERT training data. Evaluation was conducted on the GLUE (General Language Understanding Evaluation) benchmark and the SQuAD 1.1/2.0 question-answering datasets to measure general language understanding and reasoning capabilities.
Results and Discussion
The search process revealed that the optimal architecture (LV-BERT-small) deviates significantly from traditional interleaved patterns. It tends to place dynamic convolutions in earlier layers for local feature extraction and clusters self-attention in later layers for global information fusion.
As shown in the results, LV-BERT consistently outperforms strong baselines:
- GLUE Performance: LV-BERT-small achieved a score of 78.8 on the GLUE test set, surpassing the strong ELECTRA-small baseline by 1.8 points.
- SQuAD 2.0: On the development set, LV-BERT-small reached an F1 score of 73.7, a significant improvement over ELECTRA-small’s 69.4.
- Efficiency: LV-BERT-small maintains a parameter count comparable to its competitors (~13M), demonstrating that its gains are derived from superior structural design rather than increased model capacity.
Conclusion
LV-BERT demonstrates that breaking the "interleaved" myth of Transformer layers can lead to substantial performance gains. By leveraging layer variety and efficient NAS, the model achieves state-of-the-art results with high efficiency. Future work may involve conducting architecture searches directly at larger scales and optimizing hardware kernels for varied layer types to further improve training speeds.
Summary updated