Abstract
The Transformer backbone, characterized by a stack of identical multi-head self-attention (MHSA) layers, has become the de facto standard for language modeling. However, this hand-crafted design often suffers from token uniformity, parameter redundancy, and a lack of local inductive bias. We present AutoBERT-Zero, the first framework to automatically evolve a language model backbone from scratch using a two-level Neural Architecture Search (NAS). By searching across both intra-layer mathematical primitives and inter-layer macro-structures, AutoBERT-Zero discovers a hybrid architecture of convolutions and novel attention mechanisms. Our evolved model, AutoBERT-Zero-base, outperforms BERT-large on GLUE benchmarks while using significantly fewer parameters and demonstrates superior data efficiency compared to RoBERTa.
Introduction
Since the inception of BERT, the "Transformer backbone" has remained largely unchanged: a rigid stack of identical layers, each containing a hand-crafted multi-head self-attention (MHSA) module. While successful, this "one-size-fits-all" design has notable flaws. First, deep Transformer layers often lead to "token uniformity," where different tokens converge into nearly identical representations, losing semantic nuance. Second, standard Query-Key-Value (QKV) structures contain redundant parameters. Finally, global self-attention often struggles to efficiently capture local dependencies compared to convolutions.
AutoBERT-Zero addresses these issues by asking whether a more powerful and efficient backbone exists beyond human-designed QKV structures. As shown in Figure 1, the resulting architecture moves away from the homogeneous stack of MHSA layers toward a heterogeneous, hybrid design.
Methodology
AutoBERT-Zero utilizes a two-level Neural Architecture Search (NAS) to design the model backbone from the ground up.
Two-Level Search Space
The search is conducted at two granularities:
- Intra-layer Search (Mathematical Primitives): Instead of a fixed QKV structure, the search space uses primitive operations such as
matmul,add,neg,softmax, andlogsigmoidto construct a computation graph for attention from scratch. - Inter-layer Search (Macro-Structure): The algorithm determines whether each layer should be a novel attention module or a lightweight convolution block, while also optimizing convolution kernel sizes (ranging from 3 to 65).
Operation-Priority NAS (OP-NAS)
To navigate a search space exceeding $10^{20}$ combinations, the authors developed Operation-Priority NAS. This evolution-based algorithm is guided by an "Upper Confidence Bound" (UCB) strategy to balance exploration of new operations with the exploitation of successful ones. To mitigate the prohibitive cost of pre-training every candidate, a "super-net" approach with Bi-branch Weight-Sharing (BIWS) was implemented, reducing evaluation costs by approximately 80%.
Key Insights and Results
The search process yielded several critical insights into efficient backbone design:
- Hybrid Architectures: The optimal model is a hybrid, utilizing convolutions in some layers and novel attention in others. Convolution kernel sizes typically follow a "wide-to-narrow" pattern, effectively filtering information.
- Dynamic Attention: The discovered attention structures are more parameter-efficient than standard MHSA. For instance, sharing weights between $V$ and $Q/K$ is effective in shallow layers, while deeper layers require separate weights for complex semantics.
- Mitigating Uniformity: By mixing convolutions and custom attention, AutoBERT-Zero maintains a higher "rank" in deep layers, effectively avoiding the token-uniformity problem seen in standard BERT.
Performance Benchmarks
AutoBERT-Zero demonstrates significant gains across standard benchmarks:
- GLUE: AutoBERT-Zero-base (104M parameters) achieved an average score of 83.5, outperforming BERT-large (340M parameters, 82.1 score). It also surpassed RoBERTa-base by 2.4 points despite being trained on 10x less data (16GB vs 160GB).
- SQuAD: On SQuAD v2.0, the model achieved a 75.0 F1 score, a substantial improvement over the BERT-base baseline (72.8).
- Scalability: When scaled to a "Large" configuration, the architecture reached an 87.9 GLUE score, confirming its robustness as model size increases.
Conclusion
AutoBERT-Zero proves that evolving architectures from mathematical primitives can yield backbones superior to human-designed standards. While the search required 24,000 GPU hours—a significant compute barrier—the efficiency of the resulting models is undeniable. Future research may extend these "from scratch" techniques to decoder-only (GPT-style) or encoder-decoder (T5-style) architectures.
Summary updated