arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.04255cs.NIcs.AI
收藏

LLMCad:快速且可扩展的设备端大语言模型推理

LLMCad: Fast and Scalable On-device Large Language Model Inference

Peking University(北京大学);Zhongguancun Laboratory(中关村实验室)

Daliang Xu, Wangsong Yin, Xin Jin, Ying Zhang, Shiyun Wei, Mengwei Xu, Xuanzhe Liu

AI总结:

本文提出专为移动设备设计的高效推理引擎LLMCad,通过大小模型协作结合token树并行验证、自适应回退和计算-IO流水线技术,在内存受限下实现高达9.3倍的生成加速。

摘要:

生成式任务(如文本生成和问答)在移动应用领域占据着至关重要的地位。由于对隐私问题十分敏感,人们越来越要求直接在移动设备上执行这些任务。目前,这些生成式任务的执行严重依赖大语言模型(LLMs)。然而,这些设备有限的内存容量对这些模型的可扩展性构成了巨大挑战。在我们的研究中,我们引入了LLMCad,这是一种专门为高效生成式自然语言处理(NLP)任务设计的创新型设备端推理引擎。LLMCad的核心思想在于模型协作:驻留在内存中的小型LLM负责生成最基础的token,而高精度LLM则介入验证这些token并纠正发现的任何错误。LLMCad融合了三项新技术:(1)LLMCad不再以顺序方式生成候选token,而是利用较小的LLM构建一棵token树,涵盖更广泛的合理token路径。随后,较大的LLM可以同时高效地验证所有这些路径。(2)它采用自适应回退策略,每当较小的LLM生成错误token时,便迅速启动验证过程。(3)为确保token生成的连续流,LLMCad通过实现计算-IO流水线,在验证过程中推测性地生成token。通过一系列广泛的实验,LLMCad展示了令人瞩目的token生成速度,速率最高比现有推理引擎快9.3倍。

英文摘要:

Generative tasks, such as text generation and question answering, hold a crucial position in the realm of mobile applications. Due to their sensitivity to privacy concerns, there is a growing demand for their execution directly on mobile devices. Currently, the execution of these generative tasks heavily depends on Large Language Models (LLMs). Nevertheless, the limited memory capacity of these devices presents a formidable challenge to the scalability of such models. In our research, we introduce LLMCad, an innovative on-device inference engine specifically designed for efficient generative Natural Language Processing (NLP) tasks. The core idea behind LLMCad revolves around model collaboration: a compact LLM, residing in memory, takes charge of generating the most straightforward tokens, while a high-precision LLM steps in to validate these tokens and rectify any identified errors. LLMCad incorporates three novel techniques: (1) Instead of generating candidate tokens in a sequential manner, LLMCad employs the smaller LLM to construct a token tree, encompassing a wider range of plausible token pathways. Subsequently, the larger LLM can efficiently validate all of these pathways simultaneously. (2) It employs a self-adjusting fallback strategy, swiftly initiating the verification process whenever the smaller LLM generates an erroneous token. (3) To ensure a continuous flow of token generation, LLMCad speculatively generates tokens during the verification process by implementing a compute-IO pipeline. Through an extensive series of experiments, LLMCad showcases an impressive token generation speed, achieving rates up to 9.3x faster than existing inference engines.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑