Skip to main content
QUICK REVIEW

[Paper Review] You Only Compress Once: Towards Effective and Elastic BERT Compression via Exploit-Explore Stochastic Nature Gradient

Shaokun Zhang, Xiawu Zheng|arXiv (Cornell University)|Jun 4, 2021
Topic ModelingComputer Science33 references11 citations
TL;DR

YOCO-BERT proposes a novel, one-time compression framework for BERT that enables elastic deployment across diverse hardware constraints without retraining. By leveraging a stochastic natural gradient optimization with exploit-explore balance in a $10^{13}$-architecture search space, it achieves state-of-the-art accuracy gains (2.1–4.5% average GLUE improvement) and reduces training cost to $\mathcal{O}(1)$ for $N$ devices via direct weight inheritance from a super-BERT model.

ABSTRACT

Despite superior performance on various natural language processing tasks, pre-trained models such as BERT are challenged by deploying on resource-constraint devices. Most existing model compression approaches require re-compression or fine-tuning across diverse constraints to accommodate various hardware deployments. This practically limits the further application of model compression. Moreover, the ineffective training and searching process of existing elastic compression paradigms[4,27] prevents the direct migration to BERT compression. Motivated by the necessity of efficient inference across various constraints on BERT, we propose a novel approach, YOCO-BERT, to achieve compress once and deploy everywhere. Specifically, we first construct a huge search space with 10^13 architectures, which covers nearly all configurations in BERT model. Then, we propose a novel stochastic nature gradient optimization method to guide the generation of optimal candidate architecture which could keep a balanced trade-off between explorations and exploitation. When a certain resource constraint is given, a lightweight distribution optimization approach is utilized to obtain the optimal network for target deployment without fine-tuning. Compared with state-of-the-art algorithms, YOCO-BERT provides more compact models, yet achieving 2.1%-4.5% average accuracy improvement on the GLUE benchmark. Besides, YOCO-BERT is also more effective, e.g.,the training complexity is O(1)for N different devices. Code is availablehttps://github.com/MAC-AutoML/YOCO-BERT.

Motivation & Objective

  • To address the scalability and re-compression overhead of existing BERT compression methods that require fine-tuning or re-compression for each new hardware constraint.
  • To overcome the limitations of pure exploitation (e.g., DynaBERT) or pure exploration (e.g., NAS-BERT) in neural architecture search for BERT.
  • To develop a unified compression pipeline that enables 'compress once, deploy everywhere' across diverse resource-constrained devices.
  • To minimize performance degradation during deployment by balancing architectural exploration and exploitation in a large, structured search space.

Proposed method

  • Construct a massive $10^{13}$-architecture search space covering nearly all BERT configurations, including width, depth, and head variations.
  • Introduce the Exploit-Explore Stochastic Natural Gradient (EE-SNG) optimization to jointly train weights and parameters of exploitation/exploration probability distributions.
  • Decouple the process into a 'super mode' training phase for the full model and a lightweight distribution-based adaptation phase for target devices.
  • Use a learnable controller to dynamically balance exploration and exploitation during training based on performance feedback.
  • Inherit model weights directly from the super-BERT model for target sub-architectures without fine-tuning, reducing deployment cost to $\mathcal{O}(1)$.
  • Formulate the NAS process as a continuous likelihood maximization problem using stochastic natural gradients, enabling differentiable and efficient search.
Figure 1: The proposed YOCO-BERT. We separate YOCO-BERT into two stages. Given expanded training space, we first propose a EE-SNG to optimize the probability distribution $P_{\theta}$ and super-BERT. In the second stage, searching algorithm is supervised by the optimized $P_{\theta}$ to obtain the o
Figure 1: The proposed YOCO-BERT. We separate YOCO-BERT into two stages. Given expanded training space, we first propose a EE-SNG to optimize the probability distribution $P_{\theta}$ and super-BERT. In the second stage, searching algorithm is supervised by the optimized $P_{\theta}$ to obtain the o

Experimental results

Research questions

  • RQ1Can a unified BERT compression framework achieve high performance across diverse hardware constraints without re-compression or fine-tuning?
  • RQ2How can exploit-explore balance in neural architecture search be effectively modeled and optimized for BERT compression?
  • RQ3Does a large, structured search space combined with differentiable optimization yield better sub-architectures than random or evolutionary search?
  • RQ4To what extent does direct weight inheritance from a super-BERT model outperform fine-tuned sub-networks in compressed BERT deployment?

Key findings

  • YOCO-BERT achieves 2.1% to 4.5% average accuracy improvement on the GLUE benchmark compared to state-of-the-art compression methods.
  • On the RTE task with 0.75x compression ratio, YOCO-BERT outperforms the explore-only baseline by 9.8 percentage points.
  • The proposed EE-SNG optimization converges faster and achieves higher accuracy than random search and evolutionary search, as shown in Figure 3.
  • Fine-tuning the sub-architectures after search provides no significant gain and sometimes harms performance, with accuracy drops of up to 5.4% on RTE.
  • The training complexity for supporting $N$ different devices is reduced to $\mathcal{O}(1)$, as only one super-model training is required.
  • The method successfully identifies high-performing sub-architectures directly from the optimized probability distribution, eliminating the need for costly retraining.
Figure 2: Comparison of parameters, FLOPs between YOCO-BERT and previous works under different datasets. We use accuracy as the metric for the three datasets. Since YOCO-BERT does not use external data, Dyanbert’s results are obtained without using data augmentation (DA).
Figure 2: Comparison of parameters, FLOPs between YOCO-BERT and previous works under different datasets. We use accuracy as the metric for the three datasets. Since YOCO-BERT does not use external data, Dyanbert’s results are obtained without using data augmentation (DA).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.