用心理学原理压缩提示词,让大模型更快更省资源。
LanguaShrink: Reducing Token Overhead with Psycholinguistics
- 基于词性优先与数据蒸馏,无任务依赖地压缩提示。
- 最高实现26倍压缩率,保持语义一致。
- 适合追求推理速度与成本优化的开发者。
随着大语言模型在处理复杂任务上的能力提升,长提示词带来的计算开销和效率问题日益突出。为加速模型推理并降低成本,我们提出一种名为 LanguaShrink 的创新提示压缩框架。该框架受启发于大模型性能与输入提示中关键信息密度及位置的关系,结合心理语言学原理与 Ebbinghaus 记忆曲线,实现无任务依赖的提示压缩,有效缩短提示长度同时保留核心信息。借鉴 OpenChat 的训练方法,框架引入词性优先压缩与数据蒸馏技术,使用小型模型学习压缩目标,并采用 KL 正则化的强化学习策略进行训练。此外,采用基于分块的压缩算法,支持可调节压缩率。我们在 LongBench、ZeroScrolls、Arxiv Articles 及新构建的测试集上进行了评估。实验结果表明,LanguaShrink 在保持语义相似性的前提下,最高实现 26 倍压缩,相比现有方法,端到端延迟提升 1.43 倍。
原文摘要 · Abstract (English)
As large language models (LLMs) improve their capabilities in handling complex tasks, the issues of computational cost and efficiency due to long prompts are becoming increasingly prominent. To accelerate model inference and reduce costs, we propose an innovative prompt compression framework called LanguaShrink. Inspired by the observation that LLM performance depends on the density and position of key information in the input prompts, LanguaShrink leverages psycholinguistic principles and the Ebbinghaus memory curve to achieve task-agnostic prompt compression. This effectively reduces prompt length while preserving essential information. We referred to the training method of OpenChat.The framework introduces part-of-speech priority compression and data distillation techniques, using smaller models to learn compression targets and employing a KL-regularized reinforcement learning strategy for training.\cite{wang2023openchat} Additionally, we adopt a chunk-based compression algorithm to achieve adjustable compression rates. We evaluate our method on multiple datasets, including LongBench, ZeroScrolls, Arxiv Articles, and a newly constructed novel test set. Experimental results show that LanguaShrink maintains semantic similarity while achieving up to 26 times compression. Compared to existing prompt compression methods, LanguaShrink improves end-to-end latency by 1.43 times.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。