Confident Adaptive Language Modeling

Tal Schuster, Adam Fisch, Jai Gupta, Mostafa Dehghani, Dara Bahri, Vinh Q. Tran, Yi Tay, Donald Metzler

Introduction

Large Language Models (LLMs) have revolutionized natural language processing, yet they operate with a significant computational inefficiency: a "one size fits all" approach to token generation. Whether a model is predicting a highly predictable function word or a complex semantic concept, it typically processes the input through every single layer of its massive Transformer stack. This uniform allocation of compute leads to slow inference and high operational costs.

Confident Adaptive Language Modeling (CALM) introduces a framework for dynamic compute allocation via early-exit decoding. By allowing "easy" tokens to exit the model at intermediate layers, CALM achieves up to a 3x speedup in wall-clock time. Crucially, unlike previous heuristic-based early-exit methods, CALM provides rigorous statistical guarantees that the generated output remains consistent with the full model's predictions.

The CALM Framework

CALM transforms a standard Transformer into an adaptive system through three core innovations: confidence measures, state propagation, and statistical calibration.

Overview of the CALM architecture, illustrating early-exit logic and state propagation.

1. Confidence Measures

To determine when it is safe for a token to exit early, CALM evaluates the stability of the intermediate representations. The authors explored three primary metrics:

  • Softmax Response: Measuring the "gap" or confidence margin between the top two predicted tokens in the vocabulary.
  • Hidden-state Saturation: Calculating the cosine similarity between the current layer's output and the previous layer's output to detect when the representation has stabilized.
  • Early Exit Classifier: A lightweight, trained linear head that predicts whether the current intermediate output matches the final layer's eventual prediction.

2. State Propagation

A significant challenge in early exiting for autoregressive models is the "missing layer" problem. If a token exits at layer 4, subsequent tokens still need to attend to it, potentially at layer 8. CALM addresses this by simply copying the hidden state from the exit layer to all subsequent layers. Empirical results demonstrated that the Transformer architecture is remarkably robust to this "state copying" heuristic, provided the correct projections for attention keys and values are maintained.

3. Statistical Calibration and Decaying Thresholds

The "Confident" aspect of CALM is powered by the Learn then Test (LTT) framework. By treating threshold selection as a multiple hypothesis testing problem, the authors can mathematically guarantee that the model's output will be consistent with the full model (within a user-defined tolerance $\delta$) with a high probability (e.g., 95%).

Furthermore, the researchers discovered that models are more sensitive to errors at the beginning of a sequence. To mitigate error propagation, they implemented a decaying threshold function. This strategy applies a strict confidence requirement for initial tokens and gradually becomes more permissive as the sequence length increases.

Experimental Evaluation

The researchers evaluated CALM using the T5 architecture across three diverse text generation tasks:

  • CNN/DM: Long-form news summarization.
  • WMT15 (English-French): Medium-length machine translation.
  • SQuAD 1.1: Short-form, extractive question answering.

Key Findings and Results

CALM demonstrated that a massive amount of redundant compute exists in standard LLMs. An oracle experiment on the CNN/DM task suggested that a model could theoretically maintain performance using an average of just 1.5 layers per token, compared to the standard 8 layers.

Analysis of sensitivity to local errors, the decaying threshold mechanism, and performance-efficiency tradeoffs.
  • Efficiency Gains: On the CNN/DM task, CALM reduced the average number of decoder layers used from 8 to approximately 2.6 while maintaining strict consistency requirements. This translated to significant wall-clock speedups, reaching up to 3x on translation and summarization tasks.
  • Robustness: The model showed high resilience to state propagation. While errors at the start of a sequence are more damaging, the decaying threshold effectively managed this risk without requiring complex look-ahead logic.
  • Metric Performance: While trained classifiers are the most FLOP-efficient, the Softmax response remains the most reliable signal for identifying when a model has reached a stable, high-confidence prediction.

Conclusion

CALM provides a principled path forward for making LLM inference more efficient without sacrificing reliability. By combining dynamic early exiting with rigorous statistical calibration, it moves beyond simple heuristics to provide the first framework for adaptive decoding with provable quality guarantees. Future work may focus on reducing the computational overhead of Softmax calculations and exploring more sophisticated methods for reconstructing intermediate states in the propagation phase.

Summary updated

BibTeX
@inproceedings{schuster2022confident,
  author = {Tal Schuster and Adam Fisch and Jai Gupta and Mostafa Dehghani and Dara Bahri and Vinh Q. Tran and Yi Tay and Donald Metzler},
  title = {{Confident Adaptive Language Modeling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=uLYc4L3C81A},
}
Figure