Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translation
Matt Post, David Vilar
TL;DR
This paper introduces Dynamic Beam Allocation (DBA), a lexically constrained decoding algorithm for neural machine translation that achieves constant complexity with respect to the number of constraints by dynamically distributing a fixed beam across constraint banks. DBA builds on Grid Beam Search by avoiding a proliferating beam and instead reallocates slots per time step, enabling efficient handling of large sets of target-side constraints and enabling practical GPU-based constrained decoding. Experimental results on English–German show DBA is faster than GBS for comparable BLEU gains and demonstrates robust constraint placement as the number of constraints grows, while offering valuable insights into the relationship between model scores and BLEU. The approach is implemented in Sockeye and supports complex analysis of beam size, pruning, and constraint interactions, with potential applicability to interactive and domain-adaptation scenarios requiring precise lexical control.
Abstract
The end-to-end nature of neural machine translation (NMT) removes many ways of manually guiding the translation process that were available in older paradigms. Recent work, however, has introduced a new capability: lexically constrained or guided decoding, a modification to beam search that forces the inclusion of pre-specified words and phrases in the output. However, while theoretically sound, existing approaches have computational complexities that are either linear (Hokamp and Liu, 2017) or exponential (Anderson et al., 2017) in the number of constraints. We present a algorithm for lexically constrained decoding with a complexity of O(1) in the number of constraints. We demonstrate the algorithms remarkable ability to properly place these constraints, and use it to explore the shaky relationship between model and BLEU scores. Our implementation is available as part of Sockeye.
