CGMH: Constrained Sentence Generation by Metropolis-Hastings Sampling

Ning Miao, Hao Zhou, Lili Mou, Rui Yan, Lei Li
11/14/2018
cs.CLcs.AIcs.LG

Official code: NingMiao/CGMH (160 stars, Python, last commit 2019-03-03).

Abstract

In real-world applications of natural language generation, there are often constraints on the target sentences in addition to fluency and naturalness requirements. Existing language generation techniques are usually based on recurrent neural networks (RNNs).

Show full abstract

However, it is non-trivial to impose constraints on RNNs while maintaining generation quality, since RNNs generate sentences sequentially (or with beam search) from the first word to the last. In this paper, we propose CGMH, a novel approach using Metropolis-Hastings sampling for constrained sentence generation. CGMH allows complicated constraints such as the occurrence of multiple keywords in the target sentences, which cannot be handled in traditional RNN-based approaches. Moreover, CGMH works in the inference stage, and does not require parallel corpora for training. We evaluate our method on a variety of tasks, including keywords-to-sentence generation, unsupervised sentence paraphrasing, and unsupervised sentence error correction. CGMH achieves high performance compared with previous supervised methods for sentence generation. Our code is released at https://github.com/NingMiao/CGMH

View on arXivView PDF

Code Implementations(1)

NingMiao/CGMHOfficial100%

Codes for <CGMH: Constrained Sentence Generation by Metropolis-Hastings Sampling>

16024PythonNov 8, 20187 years ago
sentence-generator

Similar Papers

Cite this paper

@article{miao2018cgmh,
  title  = {CGMH: Constrained Sentence Generation by Metropolis-Hastings Sampling},
  author = {Ning Miao and Hao Zhou and Lili Mou and Rui Yan and Lei Li},
  year   = {2018},
  eprint = {1811.10996},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1811.10996}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1811.10996.svg)](https://codeofpaper.com/paper/1811.10996)

Discussion