Abstract
We extract an optimal subset of architectural parameters for the BERT architecture from Devlin et al. (2018) by applying recent breakthroughs in algorithms for neural architecture search. This optimal subset, which we refer to as "Bort", is demonstrably smaller, having an effective (that is, not counting the embedding layer) size of $5.5\%$ the original BERT-large architecture, and $16\%$ of the net size. Bort is also able to be pretrained in $288$ GPU hours, which is $1.2\%$ of the time required to pretrain the highest-performing BERT parametric architectural variant, RoBERTa-large (Liu et al., 2019), and about $33\%$ of that of the world-record, in GPU hours, required to train BERT-large on the same hardware. It is also $7.9$x faster on a CPU, as well as being better performing than other compressed variants of the architecture, and some of the non-compressed variants: it obtains performance improvements of between $0.3\%$ and $31\%$, absolute, with respect to BERT-large, on multiple public natural language understanding (NLU) benchmarks.
Introduction
The rapid evolution of Natural Language Processing (NLP) since the introduction of BERT in 2018 has led to increasingly massive models. While these models achieve state-of-the-art results, their size makes them computationally expensive to train and often too slow for real-time inference. Previous attempts to compress BERT, such as DistilBERT or TinyBERT, have largely relied on heuristic choices for architectural parameters like layer count and attention heads.
In "Optimal Subarchitecture Extraction For BERT," researchers from Amazon Alexa introduce Bort, a compressed BERT variant derived through a rigorous mathematical framework rather than trial and error. Bort represents a highly efficient subset of the BERT architecture, extracted using a provably optimal approximation algorithm.
Methodology: Architectural Search and the W-coefficient
The primary challenge in model compression is architectural search: determining the ideal configuration of depth ($D$), attention heads ($A$), hidden size ($H$), and intermediate layer size ($I$). The authors treat this as an optimization problem, seeking parameters that balance inference latency, parameter size, and error rate.
To solve this, they utilize a Fully Polynomial-Time Approximation Scheme (FPTAS). By proving that the BERT architecture satisfies the "strong $AB^nC$ property," they can use an FPTAS to find a near-optimal solution efficiently. Potential architectures are ranked using the $W$-coefficient, a metric that mathematically balances speed and size gains against potential increases in error.
Training and Distillation
Once the optimal Bort architecture (A1 in the search space) was identified, the authors employed Knowledge Distillation (KD). Rather than training from scratch, they used a pre-trained RoBERTa-large model as a "teacher" to guide Bort's learning. This process was further enhanced by Agora fine-tuning, a greedy algorithm involving data augmentation and task-specific distillation to help the smaller model match or exceed the teacher's performance.
Bort was pre-trained on a massive 270-million-sentence corpus and evaluated on the GLUE, SuperGLUE, and RACE benchmarks.
Results: Size, Speed, and Performance
Bort demonstrates that optimality does not require extreme minimality. While not the smallest possible model, it provides the best tradeoff across key metrics. It features a depth of only 4 layers, compared to BERT-large's 24, suggesting that many standard architectures are significantly over-provisioned in depth.
Key findings include:
- Efficiency: Bort is 16% the size of BERT-large (56.1M vs 340M parameters) and runs approximately 7.9x faster during CPU inference.
- Performance: Despite its size, Bort outperformed BERT-large on nearly every task, with absolute improvements of up to 31% on GLUE and 10% on RACE.
- Sustainability: Bort reached convergence in just 288 GPU hours—only 1.2% of the time required for RoBERTa-large—making it a significantly more environmentally and financially efficient model to develop.
Conclusion
Bort proves that rigorous architectural search can produce models that are both smaller and more capable than their predecessors. While the search process is hardware-dependent and fine-tuning requires careful hyperparameter management via the Agora algorithm, the results set a new standard for efficient NLU. Future work may involve applying these optimization techniques to create task-specific subarchitectures for specialized applications.
Summary updated