Negative Lexical Constraints in Neural Machine Translation (2023)

Abstract: This paper explores negative lexical constraining in English to Czech neural machine translation. Negative lexical constraining is used to prohibit certain words or expressions in the translation produced by the NMT model. We compared various methods based on modifying either the decoding process or the training data. The comparison was performed on two tasks: paraphrasing and feedback-based translation refinement. We also studied how the methods “evade” the constraints, meaning that the disallowed expression is still present in the output, but in a changed form, most interestingly the case where a different surface form (for example different inflection) is produced. We propose a way to mitigate the issue through training with stemmed negative constraints, so that the ability of the model to induce different forms of a word might be used to prohibit the usage of all possible forms of the constraint. This helps to some extent, but the problem still persists in many cases.

## introduction in general, lexically constrained neural machine translation (nmt) is a method that allows enforcing presence or absence of certain words or phrases in the translation output . positively constrained translation is more common and is used, for example, in named entities translation @xcite , terminology integration @xcite , or interactive machine translation @xcite . negative constraining serves different purposes. in this paper, we focus on two use-cases: (1) paraphrase generation and (2) refining translation based on feedback. paraphrasing aims to produce a new translation hypothesis that differs from the original translation without significant changes in meaning. on the other hand, translation refinement involves replacing specific tokens in the original translation. these tokens can be selected either manually by the user or automatically using techniques like word-level quality estimation @xcite . negative constraining is particularly well-suited for translation refinement, while it can be one of the solutions for paraphrase generation. after providing a summary of related work (section 2), we proceed to describe the two tasks in detail (section 3). next, we delve into the methods we employ to achieve negative constraining (section 4). the results are presented in section 5, followed by a manual analysis of the outputs in section 6. there are three dominant approaches to constrained nmt. the earliest ones were based on replacing the constrained expressions in the source sentence with placeholders, ensuring that the placeholders are copied into the translation produced by the model and, finally, replacing the placeholders in the target with the desired expression @xcite . the second class of methods is based on modifying the decoding mechanism in such way that only translations including (or not including) the specified words or phrases can be produced in the final output @xcite @xcite @xcite . the third class of methods revolves around altering the source input in the training data, allowing the nmt model to learn how to incorporate the constraints. this is typically done by either appending the constraints to the end of the source sentence as a suffix or intertwining them with the source sentence and distinguishing them from its tokens using factors @xcite @xcite @xcite . currently, most of the research in the field focuses on positive lexical constraints, often used for terminology integration. in contrast, there is a relatively less emphasis on negative constraining, despite its applications in areas like paraphrase generation @xcite . these works apply a method developed by @xcite and later improved by @xcite . this method modifies the beam search decoding algorithm so that the beam in each time step includes the best hypotheses that satisfy from zero to the full number of pre-defined constraints. when using only negative constraints, the algorithm effectively boils down to filtering out hypotheses that would introduce any word (or phrase) from the list of constraints. ## task description we carry out experiments with negative constraints in the two following tasks: paraphrase generation is often achieved through translation, where negative constraints come in handy for indicating the desired differences in the paraphrased output. to create a paraphrase of a source sentence, we go through multiple rounds of translation, each time disallowing some of the words generated in the previous pass. these restricted words or expressions should be replaced by synonymous expressions by the mt model, thereby creating a paraphrase of the original translation. as an example, consider the sentence "he dodged the ball." as the initial translation from a foreign language into english. when the word "dodge" is employed as the negative constraint, the system is expected to generate a paraphrase of the original translation (e.g. "he avoided the ball.") in the second pass. feedback-based translation refinement involves using external feedback to assess the model's output, for example, through user feedback in an interactive setting. after the initial translation is presented, the user can identify certain words as mistranslated. these words are then excluded from the subsequent output, prompting the model to generate a potentially improved translation. as obtaining human constraints can be costly, we translate the source without any constraints and analyze the tokens present in the mt output but not in the reference. in the next translation pass, we constrain the model to avoid using these "unconfirmed" tokens and evaluate the resulting translation. in practice, word-level quality estimation (qe) systems can partially replace user feedback by highlighting potentially problematic tokens. in our work, we use references as a proxy for an oracle qe. ## proposed methods we define a constraint as a sequence of consecutive subwords, which may represent either a single word or a multi-word expression. each input example can have a list of multiple constraints that need to be satisfied. to incorporate these constraints into the translation process, we implement the following methods. ## experiments in this section, we compare the performance of the methods on the tasks presented earlier. ## manual analysis our results show that the methods tend to overlook some negative constraints and still produce prohibited words. both the score penalty and beam filtering methods require pushing the thresholds quite far to satisfy all constraints. conversely, the learned method is more attentive to constraining but results in quick degradation of translation quality. to gain insights into the system behavior, we examined the outputs and present typical examples for each class in figure 3 . these examples are from the translation refinement task using the learned method, with constraints being tokens present in the baseline translation but not in the reference. the first example showcases a clear failure of the method, as the constraint is ignored without any apparent reason. the second example is challenging, as it requires knowledge of the czech transcription of the name assam based on its english transcription. the reference error example illustrates a situation, where the the meaning of the reference translation that we use to generate the negative constraints slightly deviates from the source sentence, resulting in a constraint difficult to satisfy. the reference translation replaces the term two-thirds (dvoutřetinovou) with a different term, needed (potřebnou), which leads to dvoutřetinovou being selected as a constraint. since it is difficult to translate two-thirds majority differently from the baseline translation, the model fails to do so. this issue could be addressed by using a validation dataset with more accurate reference translations. in the segmentation error example, the constraint is circumvented by employing a different subword segmentation of the output. sinve we use sentencepiece without prior tokenization, adding a quotation mark (") at the beginning of a token results in a different segmentation that is not accounted for by the constraints (as the constraints are provided to the model with pre-existing segmentation). the inflection example demostrates a scenario where the model managed to avoid generating a constraint in a specific form but did not avoid producing the constrained term itself. out of 8 constraints, 4 are fulfilled with a different inflected form in the constrained translation (in addition, one constraint is produced with a different spelling: diskusi/diskuzi). this behavior is undesirable because such circumvention can still lead to a potentially problematic translation. however, in certain cases, like paraphrasing, it may be deemed acceptable. the extent of this behavior is presented in at the surface level, the coverage is 0.09, indicating that 91% of the constraints are correctly satisfied. however, at the lemma level, the coverage increases to 0.34, which means that another 25% of the constraints appear in the translation in a different surface form, not detected by the previous method of computing coverage. we attempted to mitigate this behavior by training the model to use stemmed constraints (stem model in source base translation constraints constrained translation error michael jackson's former bodyguard has claimed the late singer cultivated some of his eccentricities with the deliberate intention of riling up the media. bývalý bodyguard michaela jacksona tvrdil, že zesnulý zpěvák pěstoval některé z jeho výstředností s úmyslem rozzuřit média. bodyguard, tvrdil, pěstoval, své, výstřednosti, s, úmyslem, rozzuřit, média bývalý osobní strážce michaela jacksona tvrdí, že zesnulý zpěvák pěstuje některé z jeho výstředností se záměrem rozzuřit sdělovací prostředky. not satisfied and modi's government has created an uproar by instituting a national registry of citizens and setting up detention camps in the border state of assam. a modiho vláda vyvolala pozdvižení zavedením národního registru občanů a zřízením zadržovacích táborů v pohraničním státě assam modiho, vyvolala, pozdvižení, zavedením, zadržovacích, assam a módího vláda způsobila rozruch vytvořením národního registru občanů a zřízením zajateckých táborů v pohraničním státě assam. challenging neither chamber of congress appears to have the two-thirds majority needed to override the president's opposition. zdá se, že ani jedna kongresová komora nemá dvoutřetinovou většinu potřebnou k překonání prezidentovy opozice. kongresová, komora, dvoutřetinovou, překonání zdá se, že ani jedna z kongresových komor nemá dvoutřetinovou většinu potřebnou k potlačení prezidentovy opozice. reference _last _year , _construction _of _q id di y a _" ent er tain ment _city " _was _launched _near _ri y ad h. _po bl í ž _ri já du _byla _v _loňském _roce _zahájen a _výstavba _útvar ového _města _q id di y a _útvar ového po bl í ž _ri já du _byla _v _loňském _roce _zahájen a _výstavba _" ú t var ového _města " _q id di y a segmentation a pittsburgh native whose real name was malcolm james myers mccormick, miller's lyrics included frank discussion of his depression and drug use. domorodec z pittsburghu, jehož pravé jméno bylo malcolm james myers mc-cormick, millerovy texty zahrnovaly upřímnou diskusi o jeho depresi a užívání drog. domorodec, pravé, millerovy, texty, zahrnovaly, upřímnou, diskusi, depresi domorodce z pittsburghu, jehož skutečné jméno bylo malcolm james myers mccormick, miller ův text obsahoval otevřenou diskuzi ohledně deprese a užívání drog. ## conclusion we conducted a thorough investigation into nmt decoding with negative lexical constraints, addressing two tasks: paraphrasing and interactive translation refinement. our comparison of various approaches revealed that it is indeed possible to restrict the nmt model from generating specific words in its output. however, none of the methods provided flawless results. by examining the errors made by the most effective approach, we identified instances where the model evades the constraints in morphologically rich languages by producing slightly different surface forms of the prohibited words. while we proposed a simple solution by training the model to use stemmed constraints, it adversely impacts the overall translation quality. despite these challenges, our research sheds light on the potential of using negative constraints in nmt decoding and highlights areas for further improvement.