arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.03685cs.CLcs.LGstat.ML
收藏

通过离散自回归偏置实现受控大语言模型解码

Controlled LLM Decoding via Discrete Auto-regressive Biasing

Purdue University(普渡大学)

Patrick Pynadath, Ruqi Zhang

AI总结:

本文提出离散自回归偏置受控解码算法,通过在离散文本域中利用梯度并引入联合分布与离散MCMC采样,解决了基于能量的解码在流畅性与约束满足之间的平衡问题,在情感控制、去毒化和关键词生成上以更低成本取得更优效果。

摘要:

受控文本生成允许在大语言模型输出上强制执行用户定义的约束,随着大语言模型在日常生活中的日益普及,这一领域变得越来越重要。一种常见的方法是使用基于能量的解码,它通过一个能量函数定义目标分布,该函数将多个约束组合成加权平均。然而,这些方法往往难以在流畅性与约束满足之间取得平衡,即使对能量函数的系数进行大量调优也是如此。在本文中,我们指出这种次优平衡源于在连续空间中进行采样,而非在文本标记的自然离散空间中进行采样。为了解决这一问题,我们提出了离散自回归偏置(Discrete Auto-regressive Biasing),这是一种受控解码算法,它在完全离散的文本域中运行的同时利用梯度。具体而言,我们通过在生成序列和辅助偏置序列上定义联合分布,引入了一种新的受控文本生成公式。为了从该联合分布中高效采样,我们提出了一种使用基于梯度的离散 MCMC 的 Gibbs 内 Langevin 采样算法。我们的方法显著提高了约束满足程度,同时保持了相当或更好的流畅性,并且计算成本更低。我们在情感控制、语言去毒化和关键词引导生成上展示了所提出的受控解码方法的优势。

英文摘要:

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.

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

↑