arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2410.12513cs.CL
收藏

FiRST:面向输入自适应延迟降低的微调路由器选择Transformer

FiRST: Finetuning Router-Selective Transformers for Input-Adaptive Latency Reduction

Adobe Research(Adobe研究院);Indian Institute of Technology, Kharagpur(印度理工学院,哈里科普尔)

Akriti Jain, Saransh Sharma, Koyel Mukherjee, Soumyabrata Pal

AI总结:

FiRST提出利用层特定路由器根据输入序列自适应选择Transformer层子集,以降低自回归LLM推理延迟,同时兼容KV缓存并保持甚至提升模型质量。

摘要:

自回归大语言模型(LLMs)在视觉和语言处理等不同领域展现出卓越性能。然而,由于需要顺序经过多层Transformer层进行处理,自回归解码面临显著的计算/延迟挑战,尤其是在移动和边缘设备等资源受限环境中。现有文献中旨在通过跳过层来改善延迟的方法有两种不同的形式——1)提前退出,2)输入无关的启发式方法,即无论输入序列如何,token都在预定层退出。上述两种策略都有局限性——前者无法应用于处理现代框架中加速所必需的KV缓存,后者未能捕捉不同任务之间、或更一般地不同输入序列之间层重要性的变化。为了解决这两个局限性,我们提出了FiRST,一种通过使用特定层的路由器为每个输入序列自适应地选择Transformer层子集来降低推理延迟的算法——提示(在预填充阶段)决定了解码期间将跳过哪些层。FiRST保持与KV缓存的兼容性,在保证质量的同时实现更快的推理。FiRST与模型无关,可以轻松应用于任何预训练LLM。我们的方法表明输入自适应性至关重要——实际上,不同的任务特定中间层在根据任务演化隐藏表示方面发挥着关键作用。大量实验表明,FiRST显著降低了延迟,同时在质量指标上优于其他层选择策略。它在不跳过层的情况下保持了与基础模型相当的竞争性能,在某些情况下甚至有所提升。因此,FiRST是低资源环境中LLM部署的一种有前景且高效的解决方案。

英文摘要:

Auto-regressive Large Language Models (LLMs) demonstrate remarkable performance across different domains such as vision and language processing. However, due to sequential processing through a stack of transformer layers, autoregressive decoding faces significant computation/latency challenges, particularly in resource-constrained environments like mobile and edge devices. Existing approaches in literature that aim to improve latency via skipping layers have two distinct flavors - 1) Early exit, and 2) Input-agnostic heuristics where tokens exit at pre-determined layers irrespective of input sequence. Both the above strategies have limitations - the former cannot be applied to handle KV Caching necessary for speed-ups in modern framework and the latter does not capture the variation in layer importance across tasks or more generally, across input sequences. To address both limitations, we propose FiRST, an algorithm that reduces inference latency by using layer-specific routers to select a subset of transformer layers adaptively for each input sequence - the prompt (during the prefill stage) decides which layers will be skipped during decoding. FiRST preserves compatibility with KV caching enabling faster inference while being quality-aware. FiRST is model-agnostic and can be easily enabled on any pre-trained LLM. Our approach reveals that input adaptivity is critical - indeed, different task-specific middle layers play a crucial role in evolving hidden representations depending on tasks. Extensive experiments show that FiRST significantly reduces latency while outperforming other layer selection strategies in quality metics. It retains competitive performance to base model (without layer skipping) and in some cases, even improves upon it. FiRST is thus a promising and efficient solution for LLM deployment in low-resource environments.

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

↑