[论文解读] Compress, Then Prompt: Improving Accuracy-Efficiency Trade-off of LLM Inference with Transferable Prompt
本文提出了一种软提示学习方法,在不重新训练的情况下提升压缩大型语言模型(LLMs)的准确性,通过在压缩过程中学习可迁移的提示。该方法使8倍压缩的LLaMA-7B模型(采用4位量化和50%剪枝)在标准基准测试中达到与完整模型相当的性能,且在不同数据集、任务和压缩级别之间展现出强大的跨压缩迁移能力。
While the numerous parameters in Large Language Models (LLMs) contribute to their superior performance, this massive scale makes them inefficient and memory-hungry. Thus, they are hard to deploy on commodity hardware, such as one single GPU. Given the memory and power constraints of such devices, model compression methods are widely employed to reduce both the model size and inference latency, which essentially trades off model quality in return for improved efficiency. Thus, optimizing this accuracy-efficiency trade-off is crucial for the LLM deployment on commodity hardware. In this paper, we introduce a new perspective to optimize this trade-off by prompting compressed models. Specifically, we first observe that for certain questions, the generation quality of a compressed LLM can be significantly improved by adding carefully designed hard prompts, though this isn't the case for all questions. Based on this observation, we propose a soft prompt learning method where we expose the compressed model to the prompt learning process, aiming to enhance the performance of prompts. Our experimental analysis suggests our soft prompt strategy greatly improves the performance of the 8x compressed LLaMA-7B model (with a joint 4-bit quantization and 50% weight pruning compression), allowing them to match their uncompressed counterparts on popular benchmarks. Also, we demonstrate that these learned prompts can be transferred across various datasets, tasks, and compression levels. Hence with this transferability, we can stitch the soft prompt to a newly compressed model to improve the test-time accuracy in an ``in-situ'' way.
研究动机与目标
- 为解决在通用硬件上部署压缩LLM时推理效率与准确性之间的关键权衡问题。
- 探究可学习提示是否能超越人工设计的硬提示,进一步提升压缩LLM的生成质量。
- 探索所学提示在不同数据集、任务及压缩级别(如稀疏度、量化位宽)之间的迁移能力。
- 开发一种方法,通过在推理时拼接预先学习的提示,实现在推理时对新压缩模型的准确性进行即插即用式提升。
提出的方法
- 引入一种软提示学习框架,其中可学习的提示标记在压缩LLM的压缩过程中直接进行训练。
- 该方法将加法提示标记应用于输入序列,通过梯度下降优化以提升下游任务的生成质量。
- 提示学习在目标数据集(如C4)的训练集上进行,学习得到的提示在推理阶段应用于压缩模型。
- 该方法在提示学习前结合模型压缩技术——特别是4位权重量化和50%权重剪枝——以实现高效率。
- 通过将在一种压缩级别或类型(如4位量化)上学习的提示应用于其他压缩设置(如50%稀疏度或8位量化)来评估其迁移性。
- 该方法可通过在推理时附加预训练提示,实现‘即插即用’式的准确性提升,而无需重新训练。
实验结果
研究问题
- RQ1可学习提示是否能显著提升高度压缩LLM的生成质量,尤其是在模型被大幅压缩时?
- RQ2在压缩模型上学习的提示是否能有效迁移到具有不同压缩级别或类型的其他压缩模型上?
- RQ3所提出的提示学习方法在结合多种压缩技术(如稀疏化和量化)时是否仍能保持高性能?
- RQ4所学提示是否能在不重新训练的情况下,跨多样化数据集和任务提升性能?
- RQ5使用所学提示的压缩模型性能是否可与完整未压缩模型相媲美?
主要发现
- 在C4验证集上,采用所学提示的8倍压缩LLaMA-7B模型(50%稀疏度 + 4位量化)困惑度(PPL)为7.38,与完整模型的PPL 7.59相当。
- 在Wikitext-2上,加入提示后压缩模型的PPL从无提示时的9.67降至7.31,接近完整模型的6.34。
- 在PTB上,PPL从无提示时的17.39降至10.64(有提示),显著优于压缩基线。
- 在较高稀疏度(如62.5%)或较低位宽量化(如4位)下学习的提示,可成功迁移到稀疏度较低或位宽更高的模型上,从而提升性能。
- 在稀疏模型上学习的提示可迁移到量化模型上,反之亦然,证明了跨压缩类型的迁移能力,尤其在低压缩级别下表现更优。
- 该方法实现了即插即用式性能提升:新压缩模型仅通过附加预训练提示即可在推理时获得更优性能,无需重新训练。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。