ConsistentEE: A Consistent and Hardness-Guided Early Exiting Method for Accelerating Language Models Inference

Ziqian Zeng, Yihuai Hong, Hongliang Dai, Huiping Zhuang, Cen Chen
12/19/2023
cs.CLcs.AIcs.LG

No official code found. Best implementation: ZeroNLP/ConsistentEE (6 stars, last commit 2024-06-20).

Abstract

Early Exiting is one of the most popular methods to achieve efficient inference. Current early exiting methods adopt the (weighted) sum of the cross entropy loss of all internal classifiers during training, imposing all these classifiers to predict all instances correctly. However, during inference, as long as one internal classifier predicts an instance correctly, it can accelerate without losing accuracy. Thus, there is a notable gap between training and inference. We propose ConsistentEE, an early exiting method that is consistent in training and inference. ConsistentEE formulates the early exiting process as a reinforcement learning problem. A policy network is added to decide whether an instance should exit or continue. The training objective of ConsistentEE only require each instance to be predicted correctly by one internal classifier. Additionally, we introduce the concept Memorize Layer to measure the hardness of an instance. We incorporate memorized layer into reward function design, which allows "easy" instances to focus more on acceleration while "hard" instances to focus more on accuracy. Experimental results show that our method outperforms other baselines on various natural language understanding and generation tasks.

View on arXivView PDF

Code Implementations(1)

[AAAI 2024 Main Track] Repository for the paper titled "ConsistentEE: A Consistent and Hardness-Guided Early Exiting Method for Accelerating Language Models Inference"

61Shell, PythonDec 20, 20232 years ago

Cite this paper

@article{zeng2023consistentee,
  title  = {ConsistentEE: A Consistent and Hardness-Guided Early Exiting Method for Accelerating Language Models Inference},
  author = {Ziqian Zeng and Yihuai Hong and Hongliang Dai and Huiping Zhuang and Cen Chen},
  year   = {2023},
  eprint = {2312.11882},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2312.11882v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2312.11882.svg)](https://codeofpaper.com/paper/2312.11882)

Discussion