Gradient-based sampling algorithms have demonstrated their effectiveness in text generation, especially in the context of controlled text generation. However, there exists a lack of theoretically grounded and principled approaches for this task. In this paper, we take an important step toward building a principled approach for sampling from language models with gradient-based methods. We use discrete distributions given by language models to define densities and develop an algorithm based on Hamiltonian Monte Carlo to sample from them. We name our gradient-based technique Structured Voronoi Sampling (SVS). In an experimental setup where the reference distribution is known, we show that the empirical distribution of SVS samples is closer to the reference distribution compared to alternative sampling schemes. Furthermore, in a controlled generation task, SVS is able to generate fluent and diverse samples while following the control targets significantly better than other methods.
翻译:基于梯度的采样算法在文本生成中已展现出其有效性,尤其是在可控文本生成场景中。然而,该任务目前仍缺乏具有理论支撑的系统性方法。本文向构建基于梯度方法的语言模型采样理论框架迈出了重要一步。我们利用语言模型给出的离散分布定义密度函数,并基于哈密顿蒙特卡洛方法设计了一种采样算法。我们将所提出的梯度技术命名为结构化的沃罗诺伊采样(Structured Voronoi Sampling, SVS)。在参考分布已知的实验设置中,我们证明了SVS样本的经验分布比替代采样方案更接近参考分布。此外,在可控生成任务中,SVS在生成流畅且多样化的样本的同时,其控制目标符合程度显著优于其他方法。