arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2501.12959cs.CL
收藏

面向长上下文Transformer推理的基于评估器头的有效提示压缩

Efficient Prompt Compression with Evaluator Heads for Long-Context Transformer Inference

Tsinghua University(清华大学);Huawei Technologies Co., Ltd.(华为技术有限公司)

Weizhi Fei, Xueyan Niu, Guoqing Xie, Yingqing Liu, Bo Bai, Wei Han

AI总结:

本文提出无需训练的提示压缩方法EHPC,利用Transformer中能识别关键token的评估器头在预填充阶段快速筛选重要信息,在提示压缩和长上下文推理加速基准上达到最先进水平,有效降低API调用成本。

摘要:

尽管涉及长上下文输入的应用对于有效利用大语言模型(LLMs)至关重要,但它们也带来了计算成本增加和性能下降的问题。为应对这一挑战,我们提出了一种高效、无需训练的提示压缩方法,该方法在压缩后的提示中保留关键信息。我们在基于Transformer的大语言模型中识别出特定的注意力头,将其命名为评估器头(evaluator heads),这些头能够选择长输入中对推理最为重要的token。基于这一发现,我们开发了EHPC,一种基于评估器头的提示压缩方法(Evaluator Head-based Prompt Compression),使大语言模型能够在预填充阶段仅利用带有评估器头的前几层快速“浏览”输入提示,随后仅将重要token传递给模型进行推理。EHPC在两个主流基准——提示压缩和长上下文推理加速——上取得了最先进的结果。因此,它有效降低了与商业API调用相关的复杂性和成本。我们进一步证明,与基于键值缓存的加速方法相比,EHPC取得了具有竞争力的结果,从而凸显了其在提升大语言模型长上下文任务效率方面的潜力。

英文摘要:

Although applications involving long-context inputs are crucial for the effective utilization of large language models (LLMs), they also result in increased computational costs and reduced performance. To address this challenge, we propose an efficient, training-free prompt compression method that retains key information within compressed prompts. We identify specific attention heads in transformer-based LLMs, which we designate as evaluator heads, that are capable of selecting tokens in long inputs that are most significant for inference. Building on this discovery, we develop EHPC, an Evaluator Head-based Prompt Compression method, which enables LLMs to rapidly "skim through" input prompts by leveraging only the first few layers with evaluator heads during the pre-filling stage, subsequently passing only the important tokens to the model for inference. EHPC achieves state-of-the-art results across two mainstream benchmarks: prompt compression and long-context inference acceleration. Consequently, it effectively reduces the complexity and costs associated with commercial API calls. We further demonstrate that EHPC attains competitive results compared to key-value cache-based acceleration methods, thereby highlighting its potential to enhance the efficiency of LLMs for long-context tasks.

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

↑