Language Models and Cycle Consistency for Self-Reflective Machine Translation
Jianqiao Wangni · 2024
Read Language Models and Cycle Consistency for Self-Reflective Machine Translation by Jianqiao Wangni (2024) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2411-02791.txt.
Description
Abstract This paper introduces a novel framework that leverages large language models (LLMs) for machine translation (MT). We start with one conjecture: an ideal translation should contain complete and accurate information for a strong enough LLM to recover the original sentence.
Catalog record
| CREATOR | Jianqiao Wangni |
|---|---|
| YEAR | 2024 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 20 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2411-02791
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Language Models and Cycle Consistency for Self-Reflective Machine Translation Jianqiao Wangni Abstract This paper introduces a novel framework that leverages large language models (LLMs) for machine translation (MT). We start with one conjecture: an ideal translation should contain complete and accurate information for a strong enough LLM to recover the original sentence. We generate multiple translation candidates from a source language A A to a target language B B , and subsequently translate these candidates back to the original language A A . By evaluating the cycle consistency between the original and back-translated sentences using metrics such as token-level precision and accuracy, we implicitly estimate the translation quality in language B B , without knowing its ground-truth. This also helps to evaluate the LLM translation capability, only with monolingual corpora. For each source sentence, we identify the translation candidate with optimal cycle consistency with the original sentence as the final answer. Our experiments demonstrate that larger LLMs, or the same LLM with more forward passes during inference, exhibit increased cycle consistency, aligning with the LLM model size scaling law [ Kaplan et al. 2020 ] and test-time computation scaling law [ Snell et al. 2024 ]. This work provide methods for, 1) to implicitly evaluate translation quality of a sentence in the target language, 2), to evaluate capability of LLM for any-to-any-language translation, and 3), how to generate a better translation for a specific LLM. 1 Introduction Machine Translation (MT) has been a cornerstone of natural language processing, facilitating globalization by cross-linguistic communication and democratizing newest information access to all population. In recent years, transformer-based large language models (LLMs) have fundamentally changed the field of natural language processing. Introduced by [ Vaswani et al. 2017 ], the transformer architecture facilitates parallel processing of input word tokens, significantly improving computational efficiency and successfully scales to unseen model size. Strong language capabilities beyond human imagination emerges from LLM scaling, and create an image of Silicon intelligence for the first time. Transformer-based LLMs can be categorized into several paradigms: encoder-only architectures, like BERT [ Devlin 2018 ], which focus on meaningful embeddings of input sequences, and don’t fit translation task; the rest two architectures, the encoder-decoder architectures, like T5 [ Raffel et al. 2020 ], which separately process input and output sequences, were born for translation; and decoder-only architectures, like GPT [ Radford et al. 2019 ], which generate text in an autoregressive manner. Although GPT is not initially trained specifically for translation tasks like T5, it is exceptionally well-suited for a wide range of natural language processing (NLP) tasks via supervised fine-tuning on downstream tasks, including translation, and provides applications to users via prompting [ Brown et al. 2020 ]. On a related subject, MT evaluation poses significant challenges as there is no unit test for human languages, like Python or Java. Machine-based evaluation metrics, such as BLEU [ Papineni et al. 2002 ], METEOR [ Banerjee and Lavie 2005 ], and TER [ Snover et al. 2006 ], provide quantitative assessments based on N-gram overlaps and edit distances. While these metrics offer consistency and objectivity, they often fail to fully capture the semantic adequacy and fluency of translations [ Liu et al. 2022 ], although not being a problem for LLMs as they in most cases generate fluent sentences. Higher-level criteria beyond these metrics, such as overall quality and asceticity, nuanced subtleties, professional terminologies and informal idioms, require evaluation from native speaker of the target language, which is expensive and impractical during online inference. Additionally, evaluation on low-resource languages [ Luong et al. 2015 ] poses further difficulties due to the data scarcity. The starting point of our work is a simple conjecture: a good translation, and the LLM who translated it, should be able to jointly recover the original sentence completely and accurately. This is natural from information theory view of point. For instance, if an English sentence is translated into French and then back to English, a high degree of similarity between the original and final English sentences indicates a more accurate and reliable translation. To prove this, we propose translation cycle consistency as a meaningful metric to evaluate translation quality without parallel corpora in source language A and target language B . By translating a sentence from language A to language B and then back to A , we can quantitatively measure the alignment, similarity, or closeness, between the original and back-translated texts. This method not only economically scale MT assessments, it also streamlines the evaluation process, making it widely usable for offline or online evaluation. Cycle consistency brings chance for further improving MT through a self-reflective mechanism: to think ahead a few steps. If the evaluation of translation during inference is accurate enough, we can afford to generate multiple candidates and select the best one. Unlike LLM decoding techniques such as beam search, which select the most probable translation based on a search space over a few tokens, solely based the LLM itself, cycle consistency allows for a complete evaluation of all translated tokens, selecting the most coherent and accurate output, with a math formula-backed metric. This is analogous to AlphaGo, which simulates several future steps to determine the best possible action in the current move [ Silver et al. 2016 ]. In this paper, we formalize our idea, and empirically investigate the scaling effects, observing that larger models exhibit improved cycle consistency in translations [ Chen et al. 2021 ], which in turn proves that cycle consistency is a valid and novel metric for evaluation. 2 Methodology Pretrained LLMs like GPT are trained to perform machine translation via prompting. Let S_{A} be the original sentence in language A that we want to translate. The input can be represented as: S_{A}=\{w_{1},w_{2},\ldots,w_{l}\} where w represents the tokens, and l is the total number of tokens. To perform machine translation, we construct a prompt P with a prefix that guides the GPT model to produce a translation in language B . The prompt can be defined as: P=\text{``Translate the following sentence from language }A\text{ to language }B\text{: ''}+S_{A} The GPT model takes the prompt P as input and generates a sequence of tokens in language B , denoted as S_{B} : S_{B}=\{w^{\prime}_{1},w^{\prime}_{2},\ldots,w^{\prime}_{m}\}=\text{Translate}(S_{A};A\rightarrow B;\theta) where w^{\prime} represents the tokens of the translated sentence in language B , m is the total number of tokens generated, and \theta is all of the decoding hyper-parameters of LLM, including temperature, number of beams (beam-search), top-K candidates, and even the random seed. 2.1 Self-Reflective Translation The self-reflective framework involves thinking ahead, which includes a two-step translation process. The Forward Translation is to translate the original sentence S_{A} from language A to language B , generating multiple translation candidates \{S_{B}^{(i)}\}_{i=1}^{N} : \{S_{B}^{(i)}\}_{i=1}^{N}=\{\text{Translate}(S_{A};A\rightarrow B;\theta_{i})\}_{i=1}^{N}. The key point in this step is to create enough diversity in answers while not sacrificing accuracy. With many hyper-parameters such as sampling temperatures are unknown, there is also a good chance of iterating over these hyper-parameters within the forward budget. The Backward Translation is to translate each hypothesis S_{B}^{(i)} back to language A , resulting in back-translated sentences \{S_{A}^{(i)}\}_{i=1}^{N} : S_{A}^{(i)}=\text{Translate}(S_{B}^{(i)};B\rightarrow A;\theta),\hskip 10.00002pt\forall i\in\{1,\dots,N\} The consistency C^{(i)} between the original sentence S_{A} and each back-translated sentence S_{A}^{(i)} is then measured using