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

黑盒LLM的长度控制生成

Length Controlled Generation for Black-box LLMs

Harbin Institute of Technology(哈尔滨工业大学);National University of Singapore(新加坡国立大学);Peng Cheng Laboratory(鹏城实验室)

Yuxuan Gu, Wenjie Wang, Xiaocheng Feng, Weihong Zhong, Kun Zhu, Lei Huang, Tat-Seng Chua, Bing Qin

AI总结:

本文提出一种结合Metropolis-Hastings算法与重要性采样加速的迭代采样框架,无需修改黑盒LLM参数即可高效实现文本长度控制,在Llama3.1上达到近100%成功率且计算开销极低。

摘要:

大型语言模型(LLMs)已展现出令人印象深刻的指令遵循能力,但在准确管理生成文本长度方面仍存在困难,而这是许多实际应用中的基本要求。现有的长度控制方法需要对LLM的参数进行微调,这在实际使用中效率低下且并非最优。在本文中,我们提出了一种用于文本长度控制的新型迭代采样框架,将Metropolis-Hastings算法与重要性采样加速策略相结合。该框架高效且可靠地调节LLM生成长度受限的文本,而无需修改底层参数,从而保留了LLM的原始能力。实验结果表明,我们的框架在Llama3.1上的长度控制抽象摘要和长度受限指令遵循等任务中实现了几乎100%的长度控制成功率,且仅带来极少的额外计算开销。这也突显了我们的方法在更广泛的应用中实现精确长度控制的巨大潜力,同时不损害LLM的多功能性。

英文摘要:

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.

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

↑