不修改模型参数,实现大模型文本长度精准控制。
Length Controlled Generation for Black-box LLMs
- 提出迭代采样框架,结合MH算法与重要性采样加速。
- 在Llama3.1上实现近100%长度控制成功率,计算开销极小。
- 适合需要精确长度输出的实用场景,如摘要生成、指令遵循。
大型语言模型(LLMs)虽具备出色的指令遵循能力,但在生成文本长度控制方面仍存在不足,而这正是众多实际应用的基本需求。现有方法需微调模型参数,效率低且不适用于实际部署。本文提出一种新型迭代采样框架,融合马尔可夫链蒙特卡洛(Metropolis-Hastings)算法与重要性采样加速策略,无需修改底层模型参数即可高效可靠地实现长度约束生成,完整保留原始模型能力。实验表明,该框架在Llama3.1上对摘要生成和指令遵循等任务的长度控制成功率接近100%,且额外计算开销极小。这展示了该方法在更广泛应用场景中实现精准长度控制的巨大潜力,同时不损害LLMs的通用性。
原文摘要 · Abstract (English)
Large language models (LLMs) have demonstrated impressive instruction following capabilities, while still struggling to accurately manage the length of the generated text, which is a fundamental requirement in many real-world applications. Existing length control methods involve fine-tuning the parameters of LLMs, which is inefficient and suboptimal for practical use. In this paper, we propose a novel iterative sampling framework for text length control, integrating the Metropolis-Hastings algorithm with an importance sampling acceleration strategy. This framework efficiently and reliably regulates LLMs to generate length-constrained text without modifying the underlying parameters, thereby preserving the original capabilities of LLMs. Experimental results demonstrate that our framework achieves almost 100\% success rates of length control on Llama3.1 for tasks such as length-controlled abstractive summarization and length-constrained instruction following, with minimal additional computational overhead. This also highlights the significant potential of our method for precise length control across a broader range of applications, without compromising the versatility of LLMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。