LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compression
作者: 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
分类: cs.CL, cs.LG
发布日期: 2024-03-19 (更新: 2024-08-12)
备注: Accepted at Findings of ACL 2024
💡 一句话要点
提出LLMLingua-2以解决任务无关的提示压缩问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)
关键词: 提示压缩 数据蒸馏 自然语言处理 Transformer 信息熵 模型优化 双向上下文 性能提升
📋 核心要点
- 现有的提示压缩方法主要依赖信息熵,存在无法全面捕获关键信息和与压缩目标不一致的问题。
- 本文提出了一种数据蒸馏程序,通过从大型语言模型中提取知识,实现高效的提示压缩,确保信息的完整性。
- 实验结果显示,所提方法在多个数据集上性能显著优于强基线,且压缩速度提升3x-6x,端到端延迟加速1.6x-2.9x。
📝 摘要(中文)
本文聚焦于任务无关的提示压缩,以提高模型的泛化能力和效率。现有方法通过根据信息熵去除冗余的语言单位进行压缩,但信息熵作为压缩度量存在不足。为了解决这些问题,本文提出了一种数据蒸馏程序,从大型语言模型中提取知识,以在不丢失关键信息的情况下进行提示压缩,并引入了一种抽取式文本压缩数据集。我们将提示压缩形式化为一个标记分类问题,确保压缩后的提示忠实于原始提示,并使用Transformer编码器捕获完整的双向上下文信息。实验结果表明,尽管模型体积较小,但在多个数据集上表现出显著的性能提升,并且在不同大型语言模型上展现出强大的泛化能力。
🔬 方法详解
问题定义:本文旨在解决任务无关的提示压缩问题,现有方法在信息熵的使用上存在局限,无法有效捕获所有必要信息,导致压缩效果不佳。
核心思路:通过引入数据蒸馏程序,从大型语言模型中提取知识,确保在压缩过程中不丢失关键信息,同时将提示压缩视为标记分类问题,以保证压缩结果的忠实性。
技术框架:整体架构包括数据蒸馏、抽取式文本压缩数据集的构建,以及基于Transformer编码器的提示压缩模型,能够捕获完整的双向上下文信息。
关键创新:最重要的创新在于将提示压缩形式化为标记分类问题,并使用Transformer架构来充分利用双向上下文信息,这与传统方法的单向信息熵计算有本质区别。
关键设计:在模型设计中,采用了小型模型如XLM-RoBERTa-large和mBERT,优化了压缩目标的学习过程,确保了压缩后的提示在信息完整性和处理速度上的优势。
🖼️ 关键图片
📊 实验亮点
实验结果表明,所提模型在多个数据集上表现出显著的性能提升,相较于强基线,压缩速度提高了3x-6x,端到端延迟加速了1.6x-2.9x,压缩比达到2x-5x,展示了良好的泛化能力。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理中的对话系统、信息检索和文本生成等。通过高效的提示压缩,能够显著提升模型的响应速度和处理能力,具有重要的实际价值和广泛的应用前景。
📄 摘要(原文)
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.