Introduction
Pre-trained language models (PLMs) like BERT have fundamentally changed natural language processing, yet their high computational cost and inference latency remain significant barriers to deployment in real-time industrial applications. Two primary issues hinder efficiency: "over-thinking," where deeper layers become redundant or even detrimental for simple inputs, and "rigid efficiency," where existing early-exit methods lack the flexibility to meet specific speed budgets.
PCEE-BERT addresses these challenges by introducing a "Patient and Confident" strategy. This approach allows simpler inputs to exit the model at intermediate layers by combining entropy-based confidence with a requirement for consecutive agreement (patience), achieving a superior balance of speed and accuracy compared to previous methods.
Methods: Patient and Confident Early Exiting
PCEE-BERT utilizes a multi-exit architecture where an internal classifier is attached to every Transformer layer. Unlike previous methods like PABEE, which rely solely on prediction agreement across layers, PCEE-BERT introduces a more robust dual-metric exit criterion:
- Confidence: The model calculates the entropy of the prediction at each layer. A layer is deemed "confident" if its entropy falls below a predefined threshold ($\tau$).
- Patience: To ensure reliability, the model only exits if a specific number of consecutive layers ($t$) are all classified as "confident."
This "off-the-shelf" method can be applied to various pre-trained backbones (e.g., ALBERT, TinyBERT) without retraining the main model. By adjusting $\tau$ and $t$, practitioners gain granular control over the inference speed, allowing them to hit specific performance targets on a continuous efficiency curve.
Key Results and Performance
The researchers evaluated PCEE-BERT on the GLUE benchmark and image classification tasks (CIFAR-10/100). The results demonstrate that PCEE-BERT consistently outperforms state-of-the-art methods like PABEE, DeeBERT, and BERxiT.
Key findings include:
- Superior Speed-Accuracy Trade-off: PCEE-BERT achieved significant speedups (up to 75%) with minimal accuracy loss. On the QNLI task, it maintains a higher score across the entire speed-up spectrum compared to baselines.
- Mitigating Over-thinking: In some instances, such as the RTE task, PCEE-BERT with a 25% speedup actually outperformed the full BERT-base model (0.697 vs. 0.691), confirming that intermediate layers can sometimes provide cleaner signals than the final layer.
- Continuous Tuning: Unlike PABEE, which has discrete "gaps" in achievable speedups, PCEE-BERT provides a smooth curve, enabling precise optimization for any hardware constraint.
Conclusion
PCEE-BERT offers a flexible and robust solution for accelerating Transformer inference. By synergizing patience and confidence, it provides a reliable mechanism for early exiting that works across different modalities and model sizes. While it requires task-specific hyperparameter tuning, its ability to provide a continuous speed-accuracy trade-off makes it a powerful tool for deploying large-scale models in latency-sensitive environments.
Summary updated