Large Language Model Inference Acceleration Based on Hybrid Model Branch Prediction
Open Access
- 5 April 2024
- journal article
- research article
- Published by MDPI AG in Electronics
- Vol. 13 (7) , 1376
Abstract
As the size of deep learning models continues to expand, the elongation of inference time has gradually evolved into a significant challenge to efficiency and practicality for autoregressive models. This work introduces a hybrid model acceleration strategy based on branch prediction, which accelerates autoregressive model inference without requiring retraining and ensures output consistency with the original model. Specifically, the algorithm employs two models with different parameter sizes aimed at the same task. The smaller model generates a series of potential tokens that are then parallelly validated by the larger model to determine their acceptability. By orchestrating the workflow of the large and small models through a branch-prediction strategy, the algorithm conceals the validation time of the larger model when predictions are successful, thereby accelerating inference. We propose a binomial distribution-based prediction function that blends theoretical principles with empirical evidence, specifically designed for the nuanced requirements of accelerating inference within a hybrid model framework. The entire algorithm was designed and implemented on the llama model for text generation and translation tasks. The experimental results indicate significant improvements. The proposed algorithm achieves a 1.2× to 3.4× increase in inference speed compared to the original model, consistently outperforming the speculative sampling inference acceleration algorithm.Keywords
Funding Information
- National Natural Science Foundation of China (12373113, 2020SKA0120202)
- National SKA Program of China (12373113, 2020SKA0120202)
This publication has 9 references indexed in Scilit:
- Degradation-Trend-Aware Deep Neural Network With Attention Mechanism for Bearing Remaining Useful Life PredictionIEEE Transactions on Artificial Intelligence, 2023
- Scaling Vision Transformers2022
- A Survey on Efficient Convolutional Neural Networks and Hardware AccelerationElectronics, 2022
- A survey of transformersAI Open, 2022
- Dynamic Neural Networks: A SurveyIEEE Transactions on Pattern Analysis and Machine Intelligence, 2021
- Consistent Accelerated Inference via Confident Adaptive Transformers2021
- Blockwise Self-Attention for Long Document Understanding2020
- The Right Tool for the Job: Matching Model and Instance Complexities2020
- Improving Neural Machine Translation Models with Monolingual Data2016