SlowGuess/ACL_2020_OCR huggingface dataset:
Yong Cheng, Lu Jiang, Wolfgang Macherey and Jacob Eisenstein  
Google Research
{chengyong, lujiang, wmach, jeisenstein}@google.com
In this paper, we propose a new adversarial augmentation method for Neural Machine Translation (NMT). The main idea is to minimize the vicinal risk over virtual sentences sampled from two vicinity distributions, of which the crucial one is a novel vicinity distribution for adversarial sentences that describes a smooth interpolated embedding space centered around observed training sentence pairs. We then discuss our approach, AdvAug, to train NMT models using the embeddings of virtual sentences in sequence-to-sequence learning. Experiments on Chinese-English, English-French, and English-German translation benchmarks show that AdvAug achieves significant improvements over the Transformer (up to 4.9 BLEU points), and substantially outperforms other data augmentation techniques (e.g. back-translation) without using extra corpora.
Recent work in neural machine translation (Bahdanau et al., 2015; Gehring et al., 2017; Vaswani et al., 2017) has led to dramatic improvements in both research and commercial systems (Wu et al., 2016). However, a key weakness of contemporary systems is that performance can drop dramatically when they are exposed to input perturbations (Belinkov and Bisk, 2018; Cheng et al., 2019), even when these perturbations are not strong enough to alter the meaning of the input sentence. Consider a Chinese sentence, "zhejia feiji meiyou zhuangshang zhujia huo yiyuan, shizai shi qiji". If we change the word "huo (或)" to its synonym "ji (及)", the Transformer model will generate contradictory results of "It was indeed a miracle that the plane did not touch down at home or hospital." versus "It was a miracle that the plane landed at home and hospital." Such perturbations
can readily be found in many public benchmarks and real-world applications. This lack of stability not only lowers translation quality but also inhibits applications in more sensitive scenarios.
At the root of this problem are two interrelated issues: first, machine translation training sets are insufficiently diverse, and second, NMT architectures are powerful enough to overfit — and, in extreme cases, memorize — the observed training examples, without learning to generalize to unseen perturbed examples. One potential solution is data augmentation which introduces noise to make the NMT model training more robust. In general, two types of noise can be distinguished: (1) continuous noise which is modeled as a real-valued vector applied to word embeddings (Miyato et al., 2016, 2017; Cheng et al., 2018; Sato et al., 2019), and (2) discrete noise which adds, deletes, and/or replaces characters or words in the observed sentences (Belinkov and Bisk, 2018; Sperber et al., 2017; Ebrahimi et al., 2018; Michel et al., 2019; Cheng et al., 2019; Karpukhin et al., 2019). In both cases, the challenge is to ensure that the noisy examples are still semantically valid translation pairs. In the case of continuous noise, it only ensures that the noise vector lies within an  $L_{2}$ -norm ball but does not guarantee to maintain semantics. While constructing semantics-preserving continuous noise in a high-dimensional space proves to be non-trivial, state-of-the-art NMT models are currently based on adversarial examples of discrete noise. For instance, Cheng et al. (2019) generate adversarial sentences using discrete word replacements in both the source and target, guided by the NMT loss. This approach achieves significant improvements over the Transformer on several standard NMT benchmarks. Despite this promising result, we find that the generated adversarial sentences are unnatural, and, as we will show, suboptimal for learning robust NMT models.
In this paper, we propose AdvAug, a new adversarial augmentation technique for sequence-to-sequence learning. We introduce a novel vicinity distribution to describe the space of adversarial examples centered around each training example. Unlike prior work (Cheng et al., 2019), we first generate adversarial sentences in the discrete data space and then sample virtual adversarial sentences from the vicinity distribution according to their interpolated embeddings. Our intuition is that the introduced vicinity distribution may increase the sample diversity for adversarial sentences. Our idea is partially inspired by mixup (Zhang et al., 2018), a technique for data augmentation in computer vision, and we also use a similar vicinity distribution as in mixup to augment the authentic training data. Our AdvAug approach finally trains on the embeddings sampled from the above two vicinity distributions. As a result, we augment the training using virtual sentences in the feature space as opposed to in the data space. The novelty of our paper is the new vicinity distribution for adversarial examples and the augmentation algorithm for sequence-to-sequence learning.
Extensive experimental results on three translation benchmarks (NIST Chinese-English, IWSLT English-French, and WMT English-German) show that our approach achieves significant improvements of up to 4.9 BLEU points over the Transformer (Vaswani et al., 2017), outperforming the former state-of-the-art in adversarial learning (Cheng et al., 2019) by up to 3.3 BLEU points. When compared with widely-used data augmentation methods (Sennrich et al., 2016a; Edunov et al., 2018), we find that our approach yields better performance even without using extra corpora. We conduct ablation studies to gain further insights into which parts of our approach matter most. In summary, our contributions are as follows:
1. We propose to sample adversarial examples from a new vicinity distribution and utilize their embeddings, instead of their data points, to augment the model training.
2. We design an effective augmentation algorithm for learning sequence-to-sequence NMT models via mini-batches.
3. Our approach achieves significant improvements over the Transformer and prior state-of-the-art models on three translation benchmarks.
Neural Machine Translation. Generally, NMT (Bahdanau et al., 2015; Gehring et al., 2017; Vaswani et al., 2017) models the translation probability  $P(\mathbf{y}|\mathbf{x};\boldsymbol{\theta})$  based on the encoder-decoder paradigm where  $\mathbf{x}$  is a source-language sentence,  $\mathbf{y}$  is a target-language sentence, and  $\boldsymbol{\theta}$  is a set of model parameters. The decoder in the NMT model acts as a conditional language model that operates on a shifted copy of  $\mathbf{y}$ , i.e.,  $\langle sos\rangle, y_0, \dots, y_{|\mathbf{y}| - 1}$  where  $\langle sos\rangle$  is a start symbol of a sentence and representations of  $\mathbf{x}$  learned by the encoder. For clarity, we use  $e(\mathbf{x}) \in \mathbb{R}^{d\times |\mathbf{x}|}$  to denote the feature vectors (or word embeddings) of the sentence  $\mathbf{x}$  where  $d$  is dimension size.
Given a parallel training corpus  $S$ , the standard training objective for NMT is to minimize the empirical risk:
$$
\mathcal {L} _ {\text {c l e a n}} (\boldsymbol {\theta}) = \underset {P _ {\delta} (\mathbf {x}, \mathbf {y})} {\mathbb {E}} [ \ell (f (e (\mathbf {x}), e (\mathbf {y}); \boldsymbol {\theta}), \ddot {\mathbf {y}}) ], \tag {1}
$$
where  $f(e(\mathbf{x}), e(\mathbf{y}); \boldsymbol{\theta})$  is a sequence of model predictions  $f_{j}(e(\mathbf{x}), e(\mathbf{y}); \boldsymbol{\theta}) = P(y | \mathbf{y}_{<j}, \mathbf{x}; \boldsymbol{\theta})$  at position  $j$ , and  $\ddot{\mathbf{y}}$  is a sequence of one-hot label vectors for  $\mathbf{y}$  (with label smoothing in the Transformer).  $\ell$  is the cross entropy loss. The expectation of the loss function is summed over the empirical distribution  $P_{\delta}(\mathbf{x}, \mathbf{y})$  of the training corpus:
$$
P _ {\delta} (\mathbf {x}, \mathbf {y}) = \frac {1}{| S |} \sum_ {(\mathbf {x} ^ {\prime}, \mathbf {y} ^ {\prime}) \in \mathcal {S}} \delta (\mathbf {x} = \mathbf {x} ^ {\prime}, \mathbf {y} = \mathbf {y} ^ {\prime}), \quad (2)
$$
where  $\delta$  denotes the Dirac delta function.
Generating Adversarial Examples for NMT. To improve NMT's robustness to small perturbations in the input sentences, Cheng et al. (2019) incorporate adversarial examples into the NMT model training. These adversarial sentences  $\mathbf{x}^{\prime}$  are generated by applying small perturbations that are jointly learned together with the NMT model:
$$
\hat {\mathbf {x}} = \underset {\hat {\mathbf {x}}: \mathcal {R} (\hat {\mathbf {x}}, \mathbf {x}) \leq \epsilon} {\operatorname {a r g m a x}} \ell (f (e (\hat {\mathbf {x}}), e (\mathbf {y}); \boldsymbol {\theta}), \ddot {\mathbf {y}}), \tag {3}
$$
where  $\mathcal{R}(\hat{\mathbf{x}},\mathbf{x})$  captures the degree of semantic similarity and  $\epsilon$  is an upper bound on the semantic distance between the adversarial example and the original example. Ideally, the adversarial sentences convey only barely perceptible differences to the original input sentence yet result in dramatic distortions of the model output.
Cheng et al. (2019) propose the AdvGen algorithm, which greedily replaces words with their top  $k$  most probable alternatives, using the gradients of their word embeddings. Adversarial examples are designed to both attack and defend the NMT model. On the encoder side, an adversarial sentence  $\hat{\mathbf{x}}$  is constructed from the original input  $\mathbf{x}$  to attack the NMT model. To defend against adversarial perturbations in the source input  $\hat{\mathbf{x}}$ , they use the AdvGen algorithm to find an adversarial target input  $\hat{\mathbf{y}}$  from the decoder input  $\mathbf{y}$ . For notational convenience, let  $\pi$  denote this algorithm, the adversarial example  $\hat{\mathbf{s}}$  is stochastically induced by  $\pi$  as  $\hat{\mathbf{s}} \gets \pi(\mathbf{s}; \mathbf{x}, \mathbf{y}, \xi)$  where  $\xi$  is the set of parameters used in  $\pi$  including the NMT model parameters  $\theta$ . For a detailed definition of  $\xi$ , we refer to (Cheng et al., 2019). Hence, the set of adversarial examples originating from  $(\mathbf{x}, \mathbf{y}) \in S$ , namely  $A_{(\mathbf{x}, \mathbf{y})}$ , can be written as:
$$
\begin{array}{l} A _ {(\mathbf {x}, \mathbf {y})} = \left\{\left(\hat {\mathbf {x}}, \hat {\mathbf {y}}\right) \mid \hat {\mathbf {x}} \leftarrow \pi (\mathbf {x}; \mathbf {x}, \mathbf {y}, \xi_ {s r c}), \right. \\ \left. \hat {\mathbf {y}} \leftarrow \pi (\mathbf {y}; \hat {\mathbf {x}}, \mathbf {y}, \xi_ {t g t}) \right\}, \tag {4} \\ \end{array}
$$
where  $\xi_{src}$  and  $\xi_{tgt}$  are separate parameters for generating  $\hat{\mathbf{x}}$  and  $\hat{\mathbf{y}}$ , respectively. Finally, the robustness loss  $\mathcal{L}_{\text{robust}}$  is computed on  $A_{(\mathbf{x},\mathbf{y})}$  with the loss  $\ell(f(e(\hat{\mathbf{x}}), e(\hat{\mathbf{y}}); \boldsymbol{\theta}), \ddot{\mathbf{y}})$ , and is used together with  $\mathcal{L}_{\text{clean}}$  to train the NMT model.
Data Mixup. In image classification, the mixup data augmentation technique involves training on linear interpolations of randomly sampled pairs of examples (Zhang et al., 2018). Given a pair of images  $(\mathbf{x}',\mathbf{y}')$  and  $(\mathbf{x}''$ ,  $\mathbf{y}''$ ), where  $\mathbf{x}'$  denotes the RGB pixels of the input image and  $\mathbf{y}'$  is its one-hot label, mixup minimizes the sample loss from a vicinity distribution (Chapelle et al., 2001)  $P_{v}(\tilde{\mathbf{x}},\tilde{\mathbf{y}})$  defined in the RGB-pixel (label) space:
$$
\tilde {\mathbf {x}} = \lambda \mathbf {x} ^ {\prime} + (1 - \lambda) \mathbf {x} ^ {\prime \prime}, \tag {5}
$$
$$
\tilde {\mathbf {y}} = \lambda \mathbf {y} ^ {\prime} + (1 - \lambda) \mathbf {y} ^ {\prime \prime}. \tag {6}
$$
$\lambda$  is drawn from a Beta distribution  $\mathrm{Beta}(\alpha, \alpha)$  controlled by the hyperparameter  $\alpha$ . When  $\alpha \to 0$ ,  $(\tilde{\mathbf{x}}, \tilde{\mathbf{y}})$  is close to any one of the images  $(\mathbf{x}', \mathbf{y}')$  and  $(\mathbf{x}'', \mathbf{y}'')$ . Conversely,  $(\tilde{\mathbf{x}}, \tilde{\mathbf{y}})$  approaches the middle interpolation point between them when  $\alpha \to +\infty$ . The neural networks  $g$  parameterized by  $\psi$  can be trained over the mixed images  $(\tilde{\mathbf{x}}, \tilde{\mathbf{y}})$  with the loss function  $\mathcal{L}_{\text{mixup}}(\boldsymbol{\theta}) = \ell(g(\tilde{\mathbf{x}}; \boldsymbol{\psi}), \tilde{\mathbf{y}})$ . In practice, the image pair is randomly sampled from the same mini-batch.
Figure 1: Illustration of training examples sampled from vicinity distributions of  $P_{adv}$  and  $P_{aut}$ . Solid circles are observed sentences in the training corpus  $S$ . Solid triangles are adversarial sentences generated by replacing words in their corresponding observed sentences. Dashed points are virtual sentences obtained by interpolating the embeddings of the solid points. The dashed triangles define the data space of adversarial examples from  $P_{adv}$ . The circles (solid and dashed) constitute  $P_{aut}$ .
3 Approach: AdvAug
In our approach  $AdvAug$ , the goal is to reinforce the model over virtual data points surrounding the observed examples in the training set.
We approximate the density of  $P(\mathbf{x},\mathbf{y})$  in the vicinities of the generated adversarial examples and observed training examples. To be specific, we design two vicinity distributions (Chapelle et al., 2001) to estimate the joint distribution of  $P(\mathbf{x},\mathbf{y})$ :  $P_{adv}$  for the (dynamically generated) adversarial examples and  $P_{aut}$  for the (observed) authentic examples in  $S$ . Given the training set  $S$ , we have:
$$
P _ {a d v} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}}) = \frac {1}{| \mathcal {S} |} \sum_ {(\mathbf {x}, \mathbf {y}) \in \mathcal {S}} \mu_ {a d v} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}} \mid A _ {(\mathbf {x}, \mathbf {y})}), \tag {7}
$$
$$
P _ {a u t} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}}) = \frac {1}{| \mathcal {S} |} \sum_ {(\mathbf {x}, \mathbf {y}) \in \mathcal {S}} \mu_ {a u t} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}} | \mathbf {x}, \mathbf {y}), \tag {8}
$$
where  $A_{(\mathbf{x},\mathbf{y})}$  is the set of adversarial examples originated from  $(\mathbf{x},\mathbf{y})$  defined in Eq. (4). We will discuss  $\mu_{adv}$  and  $\mu_{aut}$  in detail which define the probability functions, but first we give some high-level descriptions:
-  $P_{adv}$  is a new vicinity distribution for virtual adversarial sentences of the same origin. It captures the intuition that the convex combination of adversarial sentences should have the same translation. It is the most important factor for improving the translation quality in our experiments.
-  $P_{\text{out}}$  is a distribution to improve the NMT's robustness by "mixing up" observed sentences of different origins. This distribution is similar to mixup, but it is defined over linear interpolations of the sequence of word embeddings of the source and target sentences. Although  $P_{\text{out}}$  by itself yields marginal improvements, we find it is complementary to  $P_{\text{adv}}$ .
We train the NMT model on two vicinity distributions  $P_{adv}$  and  $P_{aut}$ . Figure 1 illustrates examples sampled from them. As shown, a solid circle stands for an observed training example (i.e. a sentence-pair) in  $S$  and a solid triangle denotes an adversarial example in  $A_{(\mathbf{x},\mathbf{y})}$ . For  $P_{adv}$ , we construct virtual adversarial examples (dashed triangles) to amend the sample diversity by interpolating the word embeddings of solid triangles. Likewise, we interpolate the word embeddings of solid circles to model  $P_{aut}$  for the (observed) authentic examples. This results in the dashed circles in Figure 1.
Unlike prior works on vicinal risk minimization (Chapelle et al., 2001; Zhang et al., 2018), we do not directly observe the virtual sentences in  $P_{adv}$  or  $P_{aut}$ . This also distinguishes us from Cheng et al. (2019), who generate actual adversarial sentences in the discrete word space. In the remainder of this section, we will discuss the definition of  $P_{adv}$  and  $P_{aut}$  and how to optimize the translation loss over virtual sentences via mini-batch training.
3.1  $P_{adv}$  for Adversarial Data
To compute  $\mu_{adv}$ , we employ  $\pi$  similar as in (Cheng et al., 2019) to generate an adversarial example set  $A_{(\mathbf{x},\mathbf{y})}$  from each instance  $(\mathbf{x},\mathbf{y}) \in S$  (see Eq. (4)). Let  $(\mathbf{x}',\mathbf{y}')$  and  $(\mathbf{x}'',\mathbf{y}'')$  be two examples randomly sampled from  $A_{(\mathbf{x},\mathbf{y})}$ . We align the two sequences by padding tokens to the end of the shorter sentence. Note that this operation aims for a general case (particularly for  $P_{aut}$ ) although the lengths of  $\mathbf{y}'$  and  $\mathbf{y}''$  in  $A_{(\mathbf{x},\mathbf{y})}$  are same. To obtain  $e(\tilde{\mathbf{x}}) = [e(\tilde{x}_1),\dots,e(\tilde{x}_{|\tilde{\mathbf{x}}|}]$ , we apply the convex combination  $m_{\lambda}(\mathbf{x}',\mathbf{x}^{\prime \prime})$  over the aligned word embeddings, which is:
$$
e \left(\tilde {x} _ {i}\right) = \lambda e \left(x _ {i} ^ {\prime}\right) + (1 - \lambda) e \left(x _ {i} ^ {\prime \prime}\right), \forall i \in [ 1, | \tilde {\mathbf {x}} | ], \tag {9}
$$
where  $\lambda \sim \mathrm{Beta}(\alpha, \alpha)$ . We use  $m_{\lambda}(\cdot, \cdot)$  for the interpolation. Similarly,  $e(\tilde{\mathbf{y}})$  can also be obtained with  $m_{\lambda}(\mathbf{y}', \mathbf{y}'')$ .
All adversarial examples in  $A_{(\mathbf{x},\mathbf{y})}$  are supposed to be translated into the same target sentence, and the convex combination still lies in space of the
adversarial search ball defined in Eq. (3). As a result, all virtual sentence pairs  $(\tilde{\mathbf{x}},\tilde{\mathbf{y}})\in A_{(\mathbf{x},\mathbf{y})}$  of the same origin can be fed into NMT models as source and target inputs which share the same soft target label for  $(\mathbf{x},\mathbf{y})$
$\mu_{adv}$  in  $P_{adv}$  can be calculated from:
$$
\mu_ {a d v} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}} | A _ {(\mathbf {x}, \mathbf {y})}) = \frac {1}{| A _ {(\mathbf {x} , \mathbf {y})} | ^ {2}}
$$
$$
\begin{array}{l} \sum_ {(\mathbf {x} ^ {\prime}, \mathbf {y} ^ {\prime}) \in A _ {(\mathbf {x}, \mathbf {y})} (\mathbf {x} ^ {\prime \prime}, \mathbf {y} ^ {\prime \prime}) \in A _ {(\mathbf {x}, \mathbf {y})}} \mathbb {E} [ \delta (e (\tilde {\mathbf {x}}) = m _ {\lambda} (\mathbf {x} ^ {\prime}, \mathbf {x} ^ {\prime \prime}), \\ \left. e \left(\tilde {\mathbf {y}}\right) = m _ {\lambda} \left(\mathbf {y} ^ {\prime}, \mathbf {y} ^ {\prime \prime}\right) \right]. \tag {10} \\ \end{array}
$$
Hence, the translation loss on vicinal adversarial examples  $\mathcal{L}_{adv}(\theta)$  can be integrated over  $P_{adv}$  as:
$$
\mathcal {L} _ {a d v} (\boldsymbol {\theta}) = \underset {P _ {a d v} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}})} {\mathbb {E}} \left[ \ell \left(f \left(e \left(\tilde {\mathbf {x}}\right), e \left(\tilde {\mathbf {y}}\right); \boldsymbol {\theta}\right), \boldsymbol {\omega}\right) \right], \tag {11}
$$
where  $\omega$  is a sequence of output distributions (denoted as a sequence of label vectors, e.g.  $\ddot{\mathbf{y}}$ ) as the soft target for the sentence  $\mathbf{y}$ .
We employ two useful techniques in computing the loss  $\mathcal{L}_{adv}$  in Eq. (11). First, we minimize the KL-divergence between the model predictions at the word level:
$$
\sum_ {j = 1} ^ {| \mathbf {y} |} D _ {K L} \left(f _ {j} \left(e (\mathbf {x}), e (\mathbf {y}); \hat {\boldsymbol {\theta}}\right) \mid \mid f _ {j} \left(e (\tilde {\mathbf {x}}), e (\tilde {\mathbf {y}}); \boldsymbol {\theta}\right)\right), \tag {12}
$$
where  $\hat{\theta}$  means a fixed copy of the current parameter set and no gradients are back-propagated through it. Removing constant values from Eq. (12) yields an equivalent solution of:
$$
\begin{array}{l} \ell (f (e (\tilde {\mathbf {x}}), e (\tilde {\mathbf {y}}); \boldsymbol {\theta}), \omega) \\ = \ell \left(f \left(e (\tilde {\mathbf {x}}), e (\tilde {\mathbf {y}}); \boldsymbol {\theta}\right), f \left(e (\mathbf {x}), e (\mathbf {y}); \hat {\boldsymbol {\theta}}\right)\right). \tag {13} \\ \end{array}
$$
Eq. (13) indicates that  $f(e(\mathbf{x}), e(\mathbf{y}); \hat{\boldsymbol{\theta}})$  can be used as the soft target  $\omega$  in Eq. (11) for virtual adversarial example  $(\tilde{\mathbf{x}}, \tilde{\mathbf{y}})$ . KL-divergence enforces the model on virtual adversarial examples to indirectly learn from the soft target of the observed examples over large vocabularies. This justifies the use of  $\omega$  in Eq. (11) and turns out to be more effective than directly learning from the ground-truth label.
Besides, Eq. (11) needs to enumerate numerous pairs of adversarial examples in  $A_{(\mathbf{x},\mathbf{y})}$  while in practice we only sample a pair at a time inside each mini-batch for training efficiency. We hence employ curriculum learning to do the importance
sampling. To do so, we re-normalize the translation loss and employ a curriculum from (Jiang et al., 2018) to encourage the model to focus on the difficult training examples.
Formally, for a mini-batch of the training losses  $\mathbf{L} = \{\ell_i\}_{i=1}^m$ , we re-weigh the batch loss using:
$$
\mathbf {L} = \frac {1}{\sum_ {i = 1} ^ {m} I (\ell_ {i} > \eta)} \sum_ {i = 1} ^ {m} I (\ell_ {i} > \eta) \ell_ {i}, \tag {14}
$$
where  $I(\cdot)$  is an indicator function and  $\eta$  is set by a moving average tracking the  $p$ -th percentile of the example losses of every mini-batch. In our experiments, we set the  $p$ -th percentile to be  $100 \times (1 - r_t)$  for the training iteration  $t$ , and gradually anneal  $r_t$  using  $r_t = 0.5^{t / \beta}$ , where  $\beta$  is the hyperparameter.
3.2  $P_{\text{out}}$  for Authentic Data
We define the  $\mu_{aut}$  in the vicinity distribution  $P_{aut}$  for authentic examples as follows:
$$
\mu_ {a u t} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}} | \mathbf {x}, \mathbf {y}) = \frac {1}{| \mathcal {S} |} \sum_ {(\mathbf {x} ^ {\prime}, \mathbf {y} ^ {\prime}) \in \mathcal {S}} \mathbb {E} _ {\lambda} [
$$
$$
\begin{array}{l} \delta (e (\tilde {\mathbf {x}}) = m _ {\lambda} (\mathbf {x}, \mathbf {x} ^ {\prime}), e (\tilde {\mathbf {y}}) = m _ {\lambda} (\mathbf {y}, \mathbf {y} ^ {\prime}), \\ \tilde {\omega} = m _ {\lambda} \left(\omega , \omega^ {\prime}\right) ]. \tag {15} \\ \end{array}
$$
The translation loss on authentic data is integrated over all examples of the vicinity distribution  $P_{\text{out}}$ :
$$
\mathcal {L} _ {\text {a u t}} (\boldsymbol {\theta}) = \underset {P _ {\text {a u t}} (\tilde {\mathbf {x}}, \tilde {\mathbf {y}})} {\mathbb {E}} \left[ \ell \left(f \left(e \left(\tilde {\mathbf {x}}\right), e \left(\tilde {\mathbf {y}}\right); \boldsymbol {\theta}\right), \tilde {\boldsymbol {\omega}}\right) \right]. \tag {16}
$$
In our experiments, we select the value of  $\lambda$  in Eq. (15) twice for every  $(\mathbf{x},\mathbf{y})$ : (1) a constant 1.0 and (2) a sample from the Beta distribution. The former is equivalent to sampling from the empirical distribution  $P_{\delta}$  whereas the latter is similar to applying mixup in the embedding space of the sequence model. In other words,  $\mathcal{L}_{\mathrm{out}}(\pmb{\theta})$  equals the sum of two translation losses,  $\mathcal{L}_{\mathrm{clean}}(\pmb{\theta})$  computed on the original training examples when  $\lambda$  is 1.0 and  $\mathcal{L}_{\mathrm{mixup}}(\pmb{\theta})$  computed on virtual examples when  $\lambda$  is sampled from a Beta distribution. Accordingly, when  $\lambda$  is 1.0 we set  $\tilde{\omega}$  to be the interpolation of the sequences of one-hot label vectors for  $\mathbf{y}$  and  $\mathbf{y}'$ , i.e.  $\boldsymbol{\omega} = \ddot{\mathbf{y}}$  and  $\boldsymbol{\omega}' = \ddot{\mathbf{y}}'$ . Otherwise  $\tilde{\omega}$  is the interpolation of model output vectors of  $(\mathbf{x},\mathbf{y})$  and  $(\mathbf{x}',\mathbf{y}')$ , that is,  $\boldsymbol{\omega} = f(e(\mathbf{x}),e(\mathbf{y});\hat{\boldsymbol{\theta}})$  and  $\boldsymbol{\omega}' = f(e(\mathbf{x}',e(\mathbf{y}');\hat{\boldsymbol{\theta}})$ .