压缩大模型提示词与数据,降低推理成本60%。
CompactPrompt: A Unified Pipeline for Prompt Data Compression in LLM Workflows
- 通过自信息评分和依赖分组剪除低效提示词。
- 对文本模式和数值列分别用缩写和量化压缩,减少60%令牌消耗。
- 可视化压缩决策,适合关注推理效率的开发者使用。
大型语言模型在代理工作流中处理长提示和丰富数据流时,会产生高昂的运行成本。我们提出CompactPrompt,一个端到端的统一压缩管道,结合硬提示压缩与轻量级文件级数据压缩。该方法首先利用自信息评分和基于依赖关系的短语分组,剔除提示中的低信息量标记;同时,对文档中的重复文本模式应用n-gram缩写,对数值列采用均匀量化,生成紧凑且语义忠实的表示。集成至标准大模型代理后,CompactPrompt在TAT-QA和FinQA等基准数据集上将总令牌用量和推理成本降低高达60%,同时保持输出质量(Claude-3.5-Sonnet和GPT-4.1-Mini的准确率下降不足5%)。该系统支持实时压缩决策可视化,并量化成本-性能权衡,为更轻量化的生成式AI流水线奠定基础。
原文摘要 · Abstract (English)
Large Language Models (LLMs) deliver powerful reasoning and generation capabilities but incur substantial run-time costs when operating in agentic workflows that chain together lengthy prompts and process rich data streams. We introduce CompactPrompt, an end-to-end pipeline that merges hard prompt compression with lightweight file-level data compression. CompactPrompt first prunes low-information tokens from prompts using self-information scoring and dependency-based phrase grouping. In parallel, it applies n-gram abbreviation to recurrent textual patterns in attached documents and uniform quantization to numerical columns, yielding compact yet semantically faithful representations. Integrated into standard LLM agents, CompactPrompt reduces total token usage and inference cost by up to 60% on benchmark dataset like TAT-QA and FinQA, while preserving output quality (Results in less than 5% accuracy drop for Claude-3.5-Sonnet, and GPT-4.1-Mini) CompactPrompt helps visualize real-time compression decisions and quantify cost-performance trade-offs, laying the groundwork for leaner generative AI pipelines.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。