arXiv:2502.03685cs.CLcs.LG2025-02ICLR被引 6

通过离散梯度采样提升大模型生成可控性

Controlled LLM Decoding via Discrete Auto-regressive Biasing

  • 在离散词元空间中使用梯度引导采样,避免连续空间偏差
  • 在情感控制、去毒化等任务上约束满足率显著提升
  • 无需调参即可平衡流畅性与约束,适合实际应用

可控文本生成在大语言模型广泛应用的背景下日益重要。现有基于能量函数的解码方法常因在连续空间采样导致流畅性与约束满足难以兼顾,即使精细调节系数也难改善。本文指出问题根源在于非自然的连续空间采样,提出离散自回归偏置(Discrete Auto-regressive Biasing)算法,将生成序列与辅助偏置序列联合建模,采用基于梯度的离散马尔可夫链蒙特卡洛方法进行高效采样。该方法在情感控制、语言去毒化及关键词引导生成任务中均显著提升约束满足率,同时保持或优于原有流畅性,且计算成本更低。

原文摘要 · Abstract (English)

Controlled text generation allows for enforcing user-defined constraints on large language model outputs, an increasingly important field as LLMs become more prevalent in everyday life. One common approach uses energy-based decoding, which defines a target distribution through an energy function that combines multiple constraints into a weighted average. However, these methods often struggle to balance fluency with constraint satisfaction, even with extensive tuning of the energy function's coefficients. In this paper, we identify that this suboptimal balance arises from sampling in continuous space rather than the natural discrete space of text tokens. To address this, we propose Discrete Auto-regressive Biasing, a controlled decoding algorithm that leverages gradients while operating entirely in the discrete text domain. Specifically, we introduce a new formulation for controlled text generation by defining a joint distribution over the generated sequence and an auxiliary bias sequence. To efficiently sample from this joint distribution, we propose a Langevin-within-Gibbs sampling algorithm using gradient-based discrete MCMC. Our method significantly improves constraint satisfaction while maintaining comparable or better fluency, all with even lower computational costs. We demonstrate the advantages of our controlled decoding method on sentiment control, language detoxification, and keyword-guided generation.

可控生成文本采样大模型优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。