Introduction
Pre-trained Language Models (PLMs) such as BERT have revolutionized Natural Language Processing but come with significant computational costs. Early Exiting (EE) has emerged as a prominent solution to accelerate inference by allowing "easy" samples to exit at intermediate layers while reserving deeper layers for "hard" samples. However, existing signal-based EE methods often suffer from a consistency gap: they train all internal classifiers on all samples, whereas during inference, shallow classifiers only encounter samples that haven't yet exited. Conversely, router-based methods that address this gap are often inflexible, requiring a fixed speed-up ratio determined at training time.
Methodology
COSEE (Consistency-Oriented Signal-based Early Exiting) addresses these challenges through a novel training paradigm that bridges the gap between training and inference while maintaining deployment flexibility.
Sample Weighting Mechanism (SWM)
The core of COSEE is the Sample Weighting Mechanism. During training, COSEE simulates the inference process by randomly sampling multiple thresholds to determine where samples would likely exit. It then applies a "soft" weighting to the loss functions: classifiers at layers where a sample is likely to exit receive higher weights. This ensures that each internal classifier specializes in the specific subset of data it will actually process during inference.
Online Signal Calibration (OSC) and Normalization
To improve the reliability of exit decisions, COSEE incorporates Online Signal Calibration (OSC). This calibration loss explicitly increases the separation between exiting signals (e.g., entropy or energy scores) of easy and hard samples. Furthermore, the authors introduce a Normalized Energy Score. By aligning signal distributions across different layers, this normalization allows for a single, global threshold to be used across the entire model, simplifying the trade-off adjustment process.
Experimental Evaluation
The framework was evaluated using the GLUE benchmark, covering tasks such as sentiment analysis (SST-2), paraphrasing (MRPC, QQP), and natural language inference (MNLI, QNLI, RTE). BERT-base and ALBERT-base served as the primary backbone architectures.
Key Results and Insights
COSEE achieves state-of-the-art accuracy-efficiency trade-offs, consistently outperforming baselines like DeeBERT, PABEE, and ConsistentEE.
- Overcoming "Overthinking": Interestingly, COSEE occasionally outperforms the full-depth backbone model on tasks like RTE and QQP. This suggests that early exiting can act as a regularizer, preventing deeper layers from focusing on noise or irrelevant details.
- Efficiency and Flexibility: The method adds negligible parameter overhead (less than 0.03%). Crucially, because it remains signal-based, users can dynamically adjust the speed-up ratio post-deployment by tuning a single threshold parameter to meet server load requirements.
- Training Convergence: Due to the specialized focus of classifiers provided by SWM, the model demonstrates faster convergence during the training phase compared to standard multi-exit approaches.
Conclusion and Future Work
COSEE provides a robust and flexible framework for accelerating PLMs without sacrificing accuracy. While currently focused on encoder-only classification tasks, future research could extend this consistency-oriented weighting to generative models. Additionally, simplifying the manual threshold tuning process remains an area for further optimization.
Summary updated