[Paper Review] BERT Loses Patience: Fast and Robust Inference with Early Exit
Patience-based Early Exit (PABEE) attaches an internal classifier to each layer of a PLM and exits when predictions stabilize for t consecutive steps, improving both speed and accuracy (e.g., ALBERT-base with ~1.57x speed-up and higher GLUE scores).
In this paper, we propose Patience-based Early Exit, a straightforward yet effective inference method that can be used as a plug-and-play technique to simultaneously improve the efficiency and robustness of a pretrained language model (PLM). To achieve this, our approach couples an internal-classifier with each layer of a PLM and dynamically stops inference when the intermediate predictions of the internal classifiers remain unchanged for a pre-defined number of steps. Our approach improves inference efficiency as it allows the model to make a prediction with fewer layers. Meanwhile, experimental results with an ALBERT model show that our method can improve the accuracy and robustness of the model by preventing it from overthinking and exploiting multiple classifiers for prediction, yielding a better accuracy-speed trade-off compared to existing early exit methods.
Motivation & Objective
- Motivate reducing inference cost and latency in large pretrained language models by addressing overthinking during inference.
- Propose a dynamic early-exit mechanism that uses cross-layer agreement among internal classifiers to decide when to stop computing.
- Demonstrate that the method can improve accuracy while also speeding up inference on GLUE benchmarks.
- Show that PABEE enhances adversarial robustness compared to prior prediction-score based exits.
Proposed method
- Attach an internal classifier after every layer of a pretrained language model.
- Compute per-layer predictions and count consecutive steps with unchanged top-prediction until a patience threshold t is reached.
- Exit early at the layer where the consecutive-stable condition cnt = t holds; otherwise use the final layer classifier.
- Train internal classifiers jointly with the base model using a weighted loss that combines all layer-specific losses.
- Provide a theoretical condition under which PABEE can improve accuracy relative to standard inference.
- Implement and evaluate on ALBERT-base/ BERT-base with GLUE benchmarks and adversarial robustness tests.
Experimental results
Research questions
- RQ1Can a patience-based, cross-layer exit criterion improve accuracy and efficiency of PLMs compared to single-layer exit criteria?
- RQ2Does PABEE maintain or improve robustness to adversarial text attacks while reducing inference latency?
- RQ3How does the patience parameter t affect speed-accuracy trade-offs across GLUE tasks?
- RQ4Is PABEE effective across different backbone models (ALBERT/BERT) and depths?
Key findings
- PABEE achieves notable speedups (e.g., 1.57x with ALBERT-base) while improving or maintaining accuracy on GLUE tasks.
- PABEE outperforms prediction-probability based exits (BranchyNet, Shallow-Deep) in speed-accuracy trade-offs across multiple tasks.
- The method yields improved adversarial robustness compared to baselines, increasing the number of queries attackers must make.
- Increased model depth with PABEE (e.g., ALBERT-large, 24 layers) continues to provide accuracy gains with substantial speed-ups.
- Training overhead is modest, adding fewer than 0.4% more parameters and not slowing training noticeably.
- PABEE’s effect on accuracy vs. speed exhibits an inverted-U curve with respect to patience, indicating an optimal range for t.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.