Directed Beam Search: Plug-and-Play Lexically Constrained Language Generation

  • 2020-12-31 03:05:44
  • Damian Pascual, Beni Egressy, Florian Bolli, Roger Wattenhofer
  • 2


Large pre-trained language models are capable of generating realistic text.However, controlling these models so that the generated text satisfies lexicalconstraints, i.e., contains specific words, is a challenging problem. Giventhat state-of-the-art language models are too large to be trained from scratchin a manageable time, it is desirable to control these models withoutre-training them. Methods capable of doing this are called plug-and-play.Recent plug-and-play methods have been successful in constraining smallbidirectional language models as well as forward models in tasks with arestricted search space, e.g., machine translation. However, controlling largetransformer-based models to meet lexical constraints without re-training themremains a challenge. In this work, we propose Directed Beam Search (DBS), aplug-and-play method for lexically constrained language generation. Our methodcan be applied to any language model, is easy to implement and can be used forgeneral language generation. In our experiments we use DBS to control GPT-2. Wedemonstrate its performance on keyword-to-phrase generation and we obtaincomparable results as a state-of-the-art non-plug-and-play model for lexicallyconstrained story generation.


Quick Read (beta)

loading the full paper ...