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

LLMLingua-2:面向高效且忠实的任务无关提示压缩的数据蒸馏方法

LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compression

Tsinghua University(清华大学);Microsoft Corporation(微软公司)

Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, Dongmei Zhang

AI总结:

针对现有提示压缩方法信息熵指标的缺陷,提出基于数据蒸馏的LLMLingua-2方法,将压缩建模为词元分类任务,用小模型实现了更优性能、更强泛化性与更高压缩效率。

摘要:

本文聚焦于任务无关的提示压缩,以提升泛化性与效率。考虑到自然语言中的冗余性,现有方法依据从因果语言模型(如LLaMa-7B)得到的信息熵,移除词元或词汇单元来压缩提示。挑战在于信息熵可能并非最优的压缩指标:(i)它仅利用单向上下文,可能无法捕获提示压缩所需的全部关键信息;(ii)它与提示压缩目标并不对齐。\n 为解决这些问题,我们提出一种数据蒸馏流程,从大语言模型(LLM)中提取知识以在不丢失关键信息的前提下压缩提示,同时构建了一个抽取式文本压缩数据集。我们将提示压缩建模为词元分类问题,以保证压缩后的提示对原提示的忠实性,并采用Transformer编码器作为基础架构,从完整的双向上下文中捕获提示压缩所需的全部关键信息。我们的方法通过使用XLM-RoBERTa-large和mBERT等更小的模型显式学习压缩目标,实现了更低的延迟。\n 我们在领域内和领域外数据集上评估了所提方法,包括MeetingBank、LongBench、ZeroScrolls、GSM8K和BBH。尽管模型规模较小,但我们的模型相较于强基线展现出显著的性能提升,且在不同大语言模型上均表现出稳健的泛化能力。此外,我们的模型比现有提示压缩方法快3倍至6倍,同时在2倍至5倍的压缩比下,将端到端延迟加速了1.6倍至2.9倍。我们的代码可在https://aka.ms/LLMLingua-2 获取。

英文摘要:

This paper focuses on task-agnostic prompt compression for better generalizability and efficiency. Considering the redundancy in natural language, existing approaches compress prompts by removing tokens or lexical units according to their information entropy obtained from a causal language model such as LLaMa-7B. The challenge is that information entropy may be a suboptimal compression metric: (i) it only leverages unidirectional context and may fail to capture all essential information needed for prompt compression; (ii) it is not aligned with the prompt compression objective. To address these issues, we propose a data distillation procedure to derive knowledge from an LLM to compress prompts without losing crucial information, and meantime, introduce an extractive text compression dataset. We formulate prompt compression as a token classification problem to guarantee the faithfulness of the compressed prompt to the original one, and use a Transformer encoder as the base architecture to capture all essential information for prompt compression from the full bidirectional context. Our approach leads to lower latency by explicitly learning the compression objective with smaller models such as XLM-RoBERTa-large and mBERT. We evaluate our method on both in-domain and out-of-domain datasets, including MeetingBank, LongBench, ZeroScrolls, GSM8K, and BBH. Despite its small size, our model shows significant performance gains over strong baselines and demonstrates robust generalization ability across different LLMs. Additionally, our model is 3x-6x faster than existing prompt compression methods, while accelerating the end-to-end latency by 1.6x-2.9x with compression ratios of 2x-5x. Our code is available at https://aka.ms/LLMLingua-2.

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

↑