arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.17052cs.CL
收藏

SelfCP:通过冻结的大语言模型自身压缩超限提示

SelfCP: Compressing Over-Limit Prompt via the Frozen Large Language Model Itself

Institute of Artificial Intelligence, Soochow University(苏州大学人工智能研究院)

Jun Gao, Ziqiang Cao, Wenjie Li

AI总结:

本文提出SelfCP,利用冻结的大语言模型自身将超限提示压缩为稠密向量,并通过轻量连接器投影为稠密token,在英中基准上以12倍压缩降低内存成本、提升推理吞吐量并改善响应质量。

摘要:

在使用基于Transformer的大语言模型(LLMs)时,长提示会导致巨大的硬件成本。不幸的是,许多任务(如摘要生成)不可避免地引入长文档,而上下文学习的广泛应用也容易使提示长度急剧膨胀。本文提出了一种自压缩器(SelfCP),它利用目标LLM自身将超限提示压缩为稠密向量,同时保持允许范围内的提示不被修改。随后,稠密向量通过一个可学习的连接器被投影为稠密token,使同一个LLM能够轻松理解。该连接器在语言建模目标下进行监督微调,训练文本选自公开可访问数据集中的相对较长的文本,并引入一个指令数据集以使SelfCP能够响应各种提示,而目标LLM在训练过程中保持冻结。我们在2种不同的骨干模型上构建了轻量级SelfCP,其可学习参数仅17M,来源于连接器和可学习嵌入。在英文和中文基准上的评估表明,SelfCP能够有效地用稠密token替代12倍超限提示,从而降低内存成本并提升推理吞吐量,同时提高响应质量。这一出色性能为LLM处理长提示提供了一种高效解决方案,而无需从头训练LLM。

英文摘要:

Long prompt leads to huge hardware costs when using transformer-based Large Language Models (LLMs). Unfortunately, many tasks, such as summarization, inevitably introduce long documents, and the wide application of in-context learning easily makes the prompt length explode. This paper proposes a Self-Compressor (SelfCP), which employs the target LLM itself to compress over-limit prompts into dense vectors while keeping the allowed prompts unmodified. Dense vectors are then projected into dense tokens via a learnable connector to make the same LLM unburden to understand. The connector is supervised-tuned under the language modeling objective of the LLM on relatively long texts selected from publicly accessed datasets, involving an instruction dataset to make SelfCP respond to various prompts, while the target LLM keeps frozen during training. We build the lightweight SelfCP upon 2 different backbones with merely 17M learnable parameters originating from the connector and a learnable embedding. Evaluation on both English and Chinese benchmarks demonstrate that SelfCP effectively substitutes 12$\times$ over-limit prompts with dense tokens to reduce memory costs and booster inference throughputs, yet improving response quality. The outstanding performance brings an efficient solution for LLMs to tackle long prompts without training LLMs from scratch.

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

↑