让大模型精准控长,靠动态反馈实时调整输出长度。
Can LLMs Track Their Output Length? A Dynamic Feedback Mechanism for Precise Length Regulation
- 生成时引入长度反馈机制,动态调节输出长度。
- 在摘要和传记任务中,长度控制精度显著提升。
- 无需训练即可用,适合需精确长度的文本生成场景。
精确控制生成文本长度是实际应用中的常见需求。尽管大语言模型在遵循指令方面取得显著进展,但仍难以准确满足长度约束。本文发现,大模型常无法正确衡量自身输出长度,导致结果偏离目标。为此,我们提出一种在生成过程中融入动态长度反馈的新方法,实现自适应调整以匹配目标长度。在摘要和传记任务上的实验表明,该无训练方法显著提升了达到目标词符、单词或句子数量的精度,且不损害生成质量。此外,通过进一步的监督微调,该方法可有效推广至更广泛的文本生成任务。
原文摘要 · Abstract (English)
Precisely controlling the length of generated text is a common requirement in real-world applications. However, despite significant advancements in following human instructions, Large Language Models (LLMs) still struggle with this task. In this work, we demonstrate that LLMs often fail to accurately measure their response lengths, leading to poor adherence to length constraints. To address this issue, we propose a novel length regulation approach that incorporates dynamic length feedback during generation, enabling adaptive adjustments to meet target lengths. Experiments on summarization and biography tasks show our training-free approach significantly improves precision in achieving target token, word, or sentence counts without compromising quality. Additionally, we demonstrate that further supervised fine-tuning allows our method to generalize effectively to broader text-generation tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。