Elamur Research

Non-Autoregressive Neural Machine Translation

Paper · 2017 · Jiatao Gu, James Bradbury, Caiming Xiong et al.

Summary

A translation system that writes from left to right has to finish each word before it can decide what comes next. A faster attention mechanism can make each decision cheaper, but the next decision still has to wait. Non-Autoregressive Neural Machine Translation asks what happens if the system makes all those decisions at once. The computational advantage is immediate. The difficulty is getting independently chosen words to form a sentence that a translator might actually write. Both issues matter for machine translation.

The difficulty begins with the fact that a source sentence can have several good translations. An early word that fits one version may be incompatible with a later word taken from another. The authors give the decoder a shared plan by predicting a fertility for each source token, meaning the number of target tokens that will be attributed to it. These counts determine how many copies of each source input the decoder receives and how many output positions it must fill. The positions can then exchange information about their inputs and locations before making their word predictions together. The encoder retains the architecture of the Transformer.

Training gives the system additional help with choices that fertility leaves open. An autoregressive teacher translates the training sentences, giving the parallel student targets with more consistent wording. A word aligner supplies the counts by linking target tokens to source tokens. Once supervised training has converged, policy-gradient fine-tuning uses feedback from the teacher to improve the predicted counts. At inference, the cheapest procedure uses a single set of counts. A more expensive procedure samples several sets, generates their translations in parallel, and asks the teacher to score the completed sentences. The teacher can perform that scoring without generating each sentence from scratch.

The tests cover IWSLT 2016 English–German and both directions of the WMT English–German and English–Romanian tasks used in the paper. In the development comparison, single-sentence decoding takes about one-tenth the time of decoding with an equal-sized autoregressive system. On the translation-quality side, the paper reports a gap of as little as 2.0 points to the teacher. Sampling and rescoring reach 29.8 on the WMT 2016 English–Romanian test set, within 0.2 points of the previous overall best result cited by the authors. Most of the latency advantage survives for typical sentences when the hardware can process the sampled candidates concurrently. The paper measures translation quality with the BLEU score.

Deep dive: Non-Autoregressive Neural Machine Translation

Non-autoregressive machine translation predicts a sentence in parallel using source-word fertility, trading some translation quality for lower latency. · about 38 minutes to read

The problem and its context

Why the next word has to wait

An encoder–decoder translation system divides the task between reading the source and producing the target. The encoder turns the source sentence into a sequence of representations. The decoder uses those representations to assign probabilities to possible translations. The paper places this setup in a line of work that includes recurrent sequence-to-sequence systems and attention-based translation. In the conventional setup, the decoder uses both its view of the source and the target words already produced to decide which word comes next. The earlier encoder–decoder design is described in Sequence to Sequence Learning with Neural Networks.

This is called autoregressive generation because earlier outputs become inputs to later predictions. An early choice can commit the decoder to a particular wording, and subsequent predictions can accommodate that choice. This is valuable in translation, where several expressions may convey much the same meaning and the rest of the sentence has to fit whichever one is chosen. An autoregressive decoder can also decide to stop by predicting a special end symbol, using the same conditional mechanism that predicts ordinary words. The paper treats this factorization as effective for representing real translations and convenient for supervised training.

At training time the target sentence is already available. The learning procedure can present the correct preceding words at each position and ask the decoder to predict the next one. A network designed to process positions in parallel can calculate these predictions together because it receives the prefixes as data. At inference, the available data consist of the source and whatever the decoder has generated so far. A step that consumes the next prefix has to wait for that prefix to exist. The same network can therefore train with parallel computations across positions while still having a sequence of dependent generation steps.

This distinction explains why the architectural advances discussed in the paper leave a bottleneck. Recurrent layers process a sequence through a chain of states. Masked convolution offers another way to make each position depend on earlier positions while allowing simultaneous calculation when the target inputs are known. Masked self-attention makes it possible for a position to draw directly on distant parts of its available context. The paper describes this as shortening the route over which information travels inside the decoder. The dependency between successive word choices at inference remains in place. These parallel processing alternatives are represented by Convolutional Sequence to Sequence Learning and Attention Is All You Need.

The authors motivate the problem in terms of time spent waiting for a translation. They describe neural systems as stronger in translation quality than the traditional statistical systems they discuss, and slower at inference. Both families commonly build a target incrementally. In the neural case, the incremental procedure repeatedly calls a comparatively expensive network. Beam search, which keeps several promising partial translations alive, can improve the result by allowing some early alternatives to survive. It still proceeds by extending prefixes in order. The paper also cites diminishing returns as the beam grows and observes that competition among partial translations limits parallelism across them. Its discussion draws on Six Challenges for Neural Machine Translation.

Why simply removing the dependency fails

A straightforward parallel design would predict a target length from the source, allocate that many positions, and ask each position for its most probable word. Training such a system is easy to describe. Each word in a reference translation supplies a label for its position, and the length supplies another label. All predictions can be computed at once. This approach keeps the computational convenience of separate word-level training signals and extends parallelism to generation.

The difficulty concerns what the product of those word probabilities can express. When all positions condition on the source alone, two proposed words can independently receive high scores even when there is no good translation containing them together. To see this, consider the paper's English expression of thanks and its German alternatives. A version beginning with Danke can continue with schön. A version beginning with Vielen calls for Dank. The sentence can have the same length in either case, so knowing how many positions to fill leaves the choice unresolved. Once both opening words and both continuations receive probability in separate distributions, the probability rule also admits the crossed combinations.

This is the paper's multimodality problem. A mode here is a plausible region of the space of full translations, such as the set of answers organized around a particular expression. A decoder that builds a translation in order can let its decision about the opening affect the alternatives it considers later. A parallel decoder with source-only conditioning loses that route to coordination. Even if each position is well trained on its own labels, the whole sentence may combine pieces of different viable answers. The problem comes from the way the full-sentence distribution is built.

Length can settle some ambiguities. If two translations have different lengths, predicting a length distinguishes them at least at that level. It says little about where extra words are needed, which source expressions they belong to, or what should move in order to read naturally in the target language. The authors therefore look for a sentence-wide decision that carries information about those local choices. They borrow fertility from statistical translation, where it describes how many target units align to a source unit. In their system, the collection of fertility values becomes a common input to all the parallel word decisions.

The method, step by step

From a source sentence to a row of target positions

The Non-Autoregressive Transformer, or NAT, first reads the source with a Transformer encoder. The encoder gives each source position a representation informed by the rest of the sentence. A classifier uses these representations to estimate a fertility for each source token. A fertility can indicate that the token contributes no separately aligned target unit, that it contributes a single unit, or that its contribution takes several units. The decoder's input is assembled by going through the source in order and copying each source input as often as its fertility calls for. Every copy gives the decoder a position to fill.

The total number of copies gives the target length. The placement of the copies gives the decoder more information than the length would on its own. If several positions are allocated around one source expression, their inputs reflect that expression. A source token assigned no copies produces no decoder input of its own, but it remains part of the encoder's source representation. The decoder can still obtain information about it through attention to the encoder. In this way the count controls how positions are initialized without removing source context from the network.

The completed input array is available before the decoder predicts any of its words. The decoder processes it through attention and feed-forward layers. Its positions can share information about their representations, their relative roles in the array, and the encoded source. The final translation predictor supplies a vocabulary distribution at each position. With the count sequence fixed, taking the most probable token at each position yields the highest-probability output under that plan.

Translation from source tokens to parallel output

The steps in order.

Translation from source tokens to parallel outputStep 1: Encode the full source sentence1. Encode the full source sentenceStep 2: Predict a fertility distribution at each source position2. Predict a fertility distribution at each source positionStep 3: Choose or sample a complete set of counts3. Choose or sample a complete set of countsStep 4: Copy source inputs according to the counts4. Copy source inputs according to the countsStep 5: Apply decoder attention across the prepared positions5. Apply decoder attention across the prepared positionsStep 6: Choose target tokens simultaneously6. Choose target tokens simultaneouslyStep 7: Rescore complete candidates when sampling is used7. Rescore complete candidates when sampling is used

This procedure has two distinct uses of parallelism. Within a candidate, the decoder fills the prepared positions together. With noisy parallel decoding, it can also work on several separate candidates together. The second option still depends on the first. Each candidate must be cheap to produce if drawing several plans is to be a practical way to improve translation.

What changes in the probability of a sentence

The conventional decoder assigns the probability of a complete translation by multiplying the probabilities of successive choices, each made with a particular preceding sequence. Using the paper's distinction between source and target lengths, the factorization is:

p_AR(Y ∣ X; θ) = ∏ₜ₌₁ᵀ⁺¹ p(yₜ ∣ y₀:ₜ₋₁, x₁:ₜ′; θ)

Here X is the source sequence and Y is its proposed translation. The source tokens are x₁:ₜ′, where the upper endpoint represents T′, the source length. T is the target length and t is a target position. yₜ is the token at that position, and y₀:ₜ₋₁ is the target prefix through the preceding position. y₀ is a beginning marker, and the term at T+1 predicts the end marker. p_AR is the autoregressive sentence probability, p is a conditional token probability, and θ denotes the learned parameters. The vertical bar means that the quantities to its right are supplied as conditions. The product ∏ multiplies the factors across the indicated positions.

The corresponding maximum-likelihood objective is written as a log probability:

ℒ_ML = log p_AR(Y ∣ X; θ) = ∑ₜ₌₁ᵀ⁺¹ log p(yₜ ∣ y₀:ₜ₋₁, x₁:ₜ′; θ)

ℒ_ML denotes the maximum-likelihood objective, log is the logarithm, and ∑ adds the contributions over target positions including the end marker. X, its tokens x₁:ₜ′, and their length T′ specify the input. Y is the observed target of length T. t selects the token yₜ and its prefix y₀:ₜ₋₁. p_AR and p are the sentence and token probabilities, and θ contains the parameters being fitted. Taking logs turns the product into a sum, so supervised training can apply a separate token-level contribution at each position. The objective as displayed is maximized. Its negative has the sign of the cross-entropy loss used in minimization.

The paper's simplest parallel alternative sets aside a separate probability for the length:

p_NA(Y ∣ X; θ) = p_L(T ∣ x₁:ₜ′; θ) · ∏ₜ₌₁ᵀ p(yₜ ∣ x₁:ₜ′; θ)

p_NA denotes the non-autoregressive sentence probability, and p_L is a distribution over target length T for the source X. The source tokens x₁:ₜ′ end at the source length T′. Y is the candidate target, yₜ is its token at position t, and p is that position's token distribution. θ represents the parameters. The multiplication dot joins the length factor to the product ∏ of the target-token factors. In this formula t runs through the target tokens, since the length already determines the extent of the output. The distinct distributions for the positions can all be calculated from the source.

In the fertility version, the source gives rise to a distribution of plans, and each plan gives rise to its own product of target-token probabilities. The likelihood for the target adds together the contributions of plans that can generate a sentence of its length:

p_NA(Y ∣ X; θ) = ∑_{f₁:ₜ′ ∈ ℱ} [∏ₜ′₌₁ᵀ′ p_F(fₜ′ ∣ x₁:ₜ′; θ) · ∏ₜ₌₁ᵀ p(yₜ ∣ x₁{f₁}, …, xₜ′{fₜ′}; θ)]

X is the source, Y the target, and T′ and T their respective lengths. The expression f₁:ₜ′ denotes the sequence of source counts through position T′. The set ℱ contains the count sequences whose values add up to T, and ∈ means membership in that set. fₜ′ is the count at source index t′, and p_F is the fertility probability assigned at that index given the full source x₁:ₜ′ and parameters θ. The first ∏ multiplies these probabilities across source positions. In the second ∏, t indexes the target token yₜ. Its probability p conditions on the ordered decoder inputs, where each x{f} denotes f copies of source input x and the ellipsis stands for the intervening inputs. The multiplication dot combines a plan's probability with the target probability under that plan. The outer ∑ adds those joint contributions. The decoder still has attention to the encoded source, which the paper's compact notation leaves implicit in the token factors.

This last expression makes the distinction between two kinds of independence important. Fertilities are predicted independently across source positions after conditioning on the whole source. Target words are predicted independently across output positions after conditioning on the source and the fertility plan. Once the plan is summed out, the target distribution can express dependencies that were missing in the length-only version. A particular plan can increase the probability of several compatible target choices together. This shared influence is the reason a mixture over plans is more expressive than a single source-conditioned product.

How the decoder uses its inputs

The authors first describe a baseline that copies inputs at an roughly uniform rate. It assigns a source position to a decoder position by projecting from the target length onto the source length:

s(t) = Round(T′t/T)

s(t) denotes the source input index used at output position t. T′ is the source length, T is the supplied target length, and Round rounds the scaled position to an integer. The juxtaposition of T′ and t means multiplication, and the slash means division. Once the length is supplied, the same rule determines the placement of copies for any source of that length. With fertility, the allocation varies with the content of the source and with the particular plan selected for it. The decoder can receive several copies of one source input and pass over another.

The copied inputs are a way to start decoding when no preceding target words are available. A conventional Transformer decoder is given target embeddings shifted so that each position can predict its next word. The NAT instead begins with source-derived inputs laid out at target positions. Repeating a source input does not require the corresponding output tokens to repeat. Different copies occupy different positions and can acquire different context through the layers. The attention machinery also allows the output order to differ from the left-to-right order used when the decoder inputs were assembled.

The encoder stack itself keeps the original architecture. The fertility classifier is attached to the final encoder layer, so its input for a particular source token already reflects the rest of the sentence. The classifier uses a single layer and a softmax, which assigns a probability distribution across the fertility choices. The paper specifies a classifier setting of L=50. Each position has its own distribution, computed from its own contextual encoder output. A position can thus receive a different count distribution when its token occurs in a different sentence.

The decoder stack has three changes relevant to parallel generation. The copied inputs substitute for the shifted target sequence. The decoder's ordinary self-attention can look across the prepared positions in both directions, with each query prevented from attending to its own position in that sublayer. And each layer has a positional attention module in addition to the usual attention computations. The architecture also has residual connections and layer normalization in its sublayers. Since information can travel along a residual connection, the self-attention mask restricts the attention operation specifically. A position can retain its own representation while using the masked sublayer to gather information from its neighbors.

The paper expresses the underlying attention computation as follows:

Attention(Q, K, V) = softmax((QKᵀ)/√dₘₒdₑₗ) · V

Q contains queries, K contains keys, and V contains values. Queries specify what each position is looking for, keys supply the representations against which the queries are compared, and values are the information combined after those comparisons. Kᵀ is the transpose of the key matrix, so QKᵀ contains query–key scores. dₘₒdₑₗ is the hidden size used in the paper's expression, and √ takes its square root. The division scales the scores before softmax turns them into weights over the positions being considered. The dot with V applies those weights to the values. The paper uses multiple attention heads, applying the same general mechanism to learn different ways to combine position information.

In positional attention, the queries and keys come from the position encodings. The values come from the decoder states. The encoding uses a sine on even channels and a cosine on odd channels:

p(j, k) = sin(j/10000^(k/d))  for even k

p(j, k) is the position-encoding value at sequence index j and channel index k. d is the dimension of the encoding, sin is the sine function, and 10000 is the base of the channel-dependent scale. The caret raises the base to the power k/d, and the division by that scale determines the argument for the sine at position j.

p(j, k) = cos(j/10000^(k/d))  for odd k

Here p(j, k) is the value at position j and odd channel k, d again denotes the encoding dimension, and cos is the cosine function. The base 10000, the power indicated by the caret, and the division have the same roles as in the even-channel expression. In this part of the architecture p stands for a positional encoding, a different use of the letter from the probabilities in the translation equations.

Ordinary self-attention can use position information already present in its representations. Positional attention gives that information a separate and direct route into the choice of attention weights. It lets the decoder aggregate its states according to the locations of their positions, which can help it distinguish copies of the same source input. The authors suggest that the extra position signal may help with local reordering. Their reported experiments support the translation system as a whole and give a qualitative comparison for the self-attention mask. The proposed explanation about reordering is a hypothesis.

How alignments and the teacher supply training signals

A count sequence is latent because a training pair gives the source and target texts while leaving the fertility assignments implicit. Given the pair, several assignments could support the target. Given the source alone, the appropriate assignment depends partly on which translation will be produced. The exact likelihood would require summing over every compatible sequence during training. The authors use a fixed proposal to infer a count sequence for each pair, turning training into a prediction problem with explicit labels.

The proposal comes from a hard alignment. For the purposes of this method, a hard alignment makes discrete assignments between target tokens and source tokens, from which the authors can count how many target tokens are associated with each source position. The experiments use fast_align, the implementation of IBM Model 2 named in the paper, with its default settings. In principle the teacher's attention weights can also be used to derive counts. The experiment uses the external aligner, so the targets for the count classifier are fixed once that inference procedure is run.

There are two supervised tasks after this inference step. The decoder is given the count sequence inferred for the training pair and learns to produce its target tokens. The fertility classifier sees the source and learns to predict the inferred counts. The source encoder provides the representations used by both tasks. The objective below writes the proposal as a probability distribution even though the experimental procedure takes a single inferred plan:

ℒ_ML = log p_NA(Y ∣ X; θ) = log ∑_{F ∈ ℱ} [p_F(F ∣ X; θ) · p(Y ∣ X, F; θ)] ≥ 𝔼_{F ∼ q} [∑ₜ₌₁ᵀ log p(yₜ ∣ x₁{f₁}, …, xₜ′{fₜ′}; θ) + ∑ₜ′₌₁ᵀ′ log p_F(fₜ′ ∣ X; θ)] + ℋ(q)

ℒ_ML is the maximum-likelihood objective and log p_NA(Y ∣ X; θ) is the log likelihood of target Y given source X under parameters θ. F abbreviates the full fertility sequence, and ℱ is the set of such sequences compatible with target length T. ∈ indicates membership and ∑ sums over the plans or positions indicated by its subscript. p_F(F ∣ X; θ) is the prior probability of the full plan given the source, and p(Y ∣ X, F; θ) is the conditional translation probability under that plan. The dot multiplies them. ≥ gives the variational lower bound, and 𝔼 is an expectation over plans drawn from q, with ∼ indicating the draw. The fixed proposal q is conditioned on the training pair. The first sum scores target token yₜ at target position t using the decoder inputs. Each x{f} is the indicated number of copies of a source input, with the ellipsis covering the inputs between the displayed endpoints. The second sum scores fₜ′, the inferred fertility at source position t′, across the source length T′. The function ℋ(q) is the entropy of the proposal.

With a deterministic proposal, the expectation evaluates the two sums at the inferred plan. The proposal assigns all its mass there, so its entropy makes no contribution to optimization. The first sum teaches the decoder how to turn a plan into a translation. The second teaches the classifier how to recover the plan from the source. This explains how the training procedure avoids enumerating assignments and still exposes the decoder to a structured choice that it will have to rely on at inference.

Fertility is deliberately less detailed than a complete alignment. It says how much output a source token accounts for without specifying where all of that output has to end up. In particular, the decoder still has to handle word order. The paper argues that supplying counts and reordering decisions together would move too much of the translation task into the latent predictor. Counts occupy a middle ground. They can be inferred cheaply from an aligned pair, give useful context to the parallel decoder, and leave it substantial work in choosing the actual words and arranging them.

Counts also leave ambiguity that has little to do with order. The alternative German expressions of thanks can have the same fertility sequence because the English pronoun has no direct counterpart in either version. A decoder trained on human references may therefore encounter incompatible ways of filling the very same plan. To reduce this variation, the authors first train an autoregressive teacher on the original parallel corpus. A parallel corpus consists of source sentences paired with translations. Once the teacher has learned from those pairs, its parameters are frozen. It translates each training source greedily, committing to its most probable next token at each step. The original source and the resulting teacher translation form a new pair for the student.

This procedure transfers a preference over whole sequences. A teacher can settle on one wording and use that wording consistently, giving the student fewer incompatible targets to reconcile. Some teacher outputs will themselves be poorer translations than the human originals. The authors describe this as a data tradeoff in which easier-to-learn targets can help a system whose independent predictions make it especially sensitive to variation. They prepare the distilled data in advance so they can train the student on it repeatedly without rerunning the teacher to generate the same targets. This use of teacher-generated sentences follows Sequence-Level Knowledge Distillation.

The teacher also supplies the student's initial encoder weights. Both encoders operate on the same source inputs and use the same architecture. The initialization therefore starts the student with source representations already learned in translation training. The student still trains its own encoder as part of the NAT system and has new components for predicting fertilites and decoding the copied input array. The teacher's parameters stay fixed when it is used for training feedback and for decoding-time scoring.

How the system chooses a plan at inference

For a source and a given plan, the paper gives the optimal conditional translation its own notation:

Ŷ = G(x₁:ₜ′, f₁:ₜ′; θ)

Ŷ is the translation selected under the supplied plan. G denotes the procedure that maximizes the token distribution at each output position for the source sequence x₁:ₜ′ and count sequence f₁:ₜ′. T′ is the source length at which both sequences end, and θ is the student's parameter set. Conditional independence is what makes the individual maximizations sufficient. Substituting another token at one position cannot raise the product if the token already chosen there has the highest probability for that plan.

Finding the best output under the full sum over plans is a different problem. Several plans can give weight to the same output, and a plan's prior probability alone says little about the fluency of its best candidate. Enumerating all plans would lose the practical advantage that motivates the method. The authors therefore compare three heuristics. The first takes the most probable count at every source position:

Ŷ_argmax = G(x₁:ₜ′, f̂₁:ₜ′; θ), with f̂ₜ′ = argmax_f p_F(f ∣ x₁:ₜ′; θ)

Ŷ_argmax is the resulting translation, and G is the parallel token-selection procedure. x₁:ₜ′ is the source of length T′ and f̂₁:ₜ′ is the plan assembled from selected counts f̂ₜ′. The index t′ identifies the source position being considered, and the fertility distribution p_F is the one associated with that position, conditioned on the full source and parameters θ. argmax_f returns the candidate value f with the highest probability. Multiplication across the independent source-position factors makes the collection of these local modes a most probable plan. The translation then comes from that one plan.

The second heuristic takes the expectation of each count distribution and rounds it:

Ŷ_average = G(x₁:ₜ′, f̂₁:ₜ′; θ), with f̂ₜ′ = Round(∑_{f=1}ᴸ p_F(f ∣ x₁:ₜ′; θ) f)

Ŷ_average denotes the translation under the rounded-mean plan, with G again selecting the best tokens given source x₁:ₜ′, plan f̂₁:ₜ′, and parameters θ. T′ is the source length and t′ is the position whose estimated count is f̂ₜ′. p_F is its fertility distribution, f ranges over candidate counts, and L is the upper limit in the paper's expression. ∑ adds each fertility weighted by its probability, and Round gives the integer used by the copy procedure. The paper starts this sum at 1. A fertility of zero contributes zero to the weighted sum. Whereas the first method keeps the most probable single count, the average uses information from the rest of the distribution and may select a different count.

The third heuristic, noisy parallel decoding or NPD, uses the learned distribution to propose plans. It decodes a candidate under each sampled plan and lets the teacher choose the best completed translation:

Ŷ_NPD = G(X, argmax_{F ∈ S} p_AR(G(X, F; θ) ∣ X; θ_A); θ)

Ŷ_NPD is the selected translation and X is the source. F is a full fertility plan and S denotes the sampled plans from the student's fertility distribution p_F. ∈ limits the search to members of that collection. The inner G gives the completed candidate for a plan using student parameters θ. p_AR is the autoregressive teacher's conditional score for that completed sentence, and θ_A distinguishes the fixed teacher parameters from the student's. argmax identifies the sampled plan whose candidate has the highest teacher score. The outer G denotes returning its translation. The candidate produced earlier can be used directly.

Teacher scoring retains information about the relationship between successive words. The candidate already exists when it goes to the teacher, so all its prefixes are available, as they are when the teacher trains. The autoregressive architecture can calculate the scores in parallel over positions under those conditions. Each candidate is also independent of the others during generation and scoring. With enough computation available at once, these are successive stages across the whole set, and the authors argue that the latency can approach twice that of generating a single translation. The amount of work still increases with sample size. In a setting with limited parallel capacity, that work affects the time the user has to wait.

NPD is best understood as proposal and selection. The student proposes whole translations from different count allocations, and the teacher selects among those proposals. Its final ranking uses the teacher's probability, while its candidate pool is shaped by the student's fertility distribution. This leaves room for the teacher to prefer a well-formed sentence from a less probable plan. The quality of the chosen sentence still depends on the alternatives the student manages to produce.

How the authors fine-tune the system after supervised training

The alignment-based objective uses an external decision about which plan the decoder should follow. Once the student has converged under that objective, the authors introduce training feedback that also evaluates plans drawn from the student's own fertility predictor. The feedback is based on the teacher's view of the possible next words. This is a word-level form of distillation, distinct from the sequence-level procedure that supplied complete training targets. The additional training stage is fine-tuning.

ℒ_RKL(F; θ) = ∑ₜ₌₁ᵀ ∑_{yₜ} [log p_AR(yₜ ∣ ŷ₁:ₜ₋₁, X; θ_A) · p_NA(yₜ ∣ X, F; θ)]

ℒ_RKL is the fine-tuning score the authors associate with reverse Kullback–Leibler divergence. F is the fertility sequence for source X; θ and θ_A are the student and fixed teacher parameters. The outer ∑ runs over output positions t through target length T under the supplied plan. The inner ∑ ranges over possible tokens yₜ at that position. ŷ₁:ₜ₋₁ is the prefix of the student's best translation under the plan. p_AR is the teacher's next-token distribution with that prefix and source supplied. log takes its logarithm and the multiplication dot weights it by p_NA, the student's probability for the token at that position given the source and plan. The displayed expression is an expected teacher log score under the student's distribution. A full reverse KL would also contain a student entropy contribution, which is absent from the expression used here.

The direction of the weighting matters. A student that puts much of its probability on a word the teacher considers implausible receives a poor score at that position. Putting student probability on words that the teacher would use under the candidate's prefix can improve the objective. The authors describe this as favorable to sharper student distributions relative to standard cross-entropy. The whole score can also reflect a fertility decision because the plan determines the candidate, its prefixes, and the number of positions that receive feedback.

Fine-tuning combines this score in two ways with the supervised distillation objective:

ℒ_FT = λ [𝔼_{F ∼ p_F}(ℒ_RKL(F) − ℒ_RKL(F̄)) + 𝔼_{F ∼ q}(ℒ_RKL(F))] + (1 − λ)ℒ_KD

ℒ_FT is the combined fine-tuning objective. λ weights the bracketed terms, and 1 − λ weights ℒ_KD, the original distillation objective. 𝔼 indicates an expectation, ∼ marks the distribution a plan is drawn from, and F represents that plan. p_F is the student's fertility distribution and q is the external alignment-based proposal. ℒ_RKL is the word-level score above, with its parameter argument implicit. F̄ is the plan built from rounded average fertilities. The subtraction compares the sampled plan's score to the score for that plan. The paper calls this first expectation ℒ_RL and the second ℒ_BP. It sets λ to 0.25 for the experiments.

A discrete draw from the fertility distribution interrupts ordinary differentiation through the choice of count. The paper uses REINFORCE, a policy-gradient estimator, to pass feedback to the distribution that made the choice. If a sampled plan scores better than the rounded-average plan, the score difference supplies a positive signal for the sampled choice. The baseline gives a point of comparison for the teacher score on that source. In the second expectation, the external plan is fixed. The authors use ordinary back-propagation for that contribution. The original distillation objective continues to give supervised feedback as the additional terms train the system on the teacher's preferences.

Experiments and results

Data, comparison systems, and evaluation

The development experiments use IWSLT16 En–De, the smaller English–German corpus in the study. The authors use its development set for comparisons of training procedures and for the analysis of latency by sentence length. They additionally train and test in both directions of WMT14 En–De and WMT16 En–Ro. WMT English–German results use newstest2014, and WMT English–Romanian results use newstest2016. The direction matters for interpreting a result. The strongest WMT English–Romanian number highlighted by the paper refers to English as the source and Romanian as the target.

Before training, the authors tokenize the data and divide words into sub-word symbols using byte-pair encoding. This restricts the vocabulary available to each system. In the WMT experiments the source and target share the sub-word vocabulary, and the encoder and decoder share their embeddings. On IWSLT, English and German have separate vocabularies and separate embeddings. The unit a count predictor handles is therefore the token used by the system, which can be a sub-word piece. The paper's examples use whole words to convey the intuition behind the counts. The segmentation technique is described in Neural Machine Translation of Rare Words with Subword Units.

The main comparison is with the autoregressive Transformer that teaches the parallel system. For each pairing the authors match the sizes and hyper-parameters of the teacher and student, apart from the added positional attention and fertility prediction components. For WMT they use the base Transformer settings and omit label smoothing. For IWSLT the Transformer hidden size is 287, the setting labeled d_hidden is 507, the layer count setting is 5, the attention head setting is 2, and the warmup setting is 746. The smaller settings reduce training time on the development corpus and are used for all experiments on that dataset. The implementation is in PyTorch and the authors released it as open source.

The quality metric is tokenized, cased BLEU. BLEU compares the wording of system outputs to reference translations over the evaluation set. Tokenization determines the units in that comparison, and casing remains part of the evaluated text. The authors also use a teacher-translated version of the IWSLT development set for a separate diagnostic. A score against those references indicates how closely the student reproduces the teacher's wording. Scores against the ordinary references address the translation task as evaluated on that corpus. The two sets of references put different questions to the same are-you-close-to-the-reference calculation. The metric is introduced in Bleu: a Method for Automatic Evaluation of Machine Translation.

Across the datasets, the paper reports that the parallel system trails the autoregressive teacher by 2-5 BLEU points and that NPD makes up some or all of the deficit. The NAT entries without NPD use argmax decoding. Such an entry reflects what the parallel system can produce from a single, locally most probable plan. The NPD entries include evidence from several plans and a final choice by the teacher. The two forms of decoding therefore test different uses of the same learned count distribution.

The paper describes a cost of as little as 2.0 BLEU points relative to its autoregressive teacher in the evaluated translation tasks. It separately highlights 29.8 BLEU for NPD on WMT 2016 English–Romanian newstest2016. That result comes within 0.2 BLEU points of the previous overall best for that direction cited by the authors. The two comparisons have different reference systems. The teacher comparison describes what the parallel system gives up relative to its matched autoregressive counterpart. The comparison with earlier work places the English–Romanian result in the context of quality already achieved on that task.

In the IWSLT development experiment, the authors also vary the NPD sample size. The caption reports that NPD matches argmax and rounded-average decoding after two samples and exceeds the teacher at around 1000 samples. The finding concerns BLEU on that development set and a search run with a large candidate pool. A teacher can prefer a student candidate to the result it finds with its own generation procedure, since the candidate set offers a different search route. An improvement under that arrangement reflects the combination of the candidate generator and scorer.

The following comparison shows the reported size of two training changes on the IWSLT development set. Each value is a BLEU improvement relative to that change's own comparison condition. The bars express the paper's approximate gains across the conditions described in the ablation study.

Reported BLEU gains from training changes on the IWSLT development set

Replacing human training targets with teacher outputs shows the larger reported gain in these comparisons.

Reported BLEU gains from training changes on the IWSLT development setTeacher-generated targets instead of human targets (approximate) (this paper): 5Teacher-generated targets instead ofhuman targets (approximate) (this paper)5Joint fine-tuning after supervised training (approximate): 1.5Joint fine-tuning after supervisedtraining (approximate)1.5
The numbers
System or settingBLEU points gained
Teacher-generated targets instead of human targets (approximate) (this paper)5
Joint fine-tuning after supervised training (approximate)1.5

What the latency measurements establish

The timed comparison decodes single sentences without minibatching on one NVIDIA Tesla P100. In the main timing results, per-sentence latency is averaged across the evaluation set, while the development comparison reports performance more than 10 times as fast as greedy autoregressive decoding and 15 times as fast as beam search. The authors characterize the result for the equal-sized autoregressive comparison as a latency of about one-tenth. These results answer how long an individual translation waits for completion under the specified implementation.

The IWSLT appendix also examines the timing sentence by sentence. Latency rises with decoding length for the autoregressive system. For the parallel system it is almost constant across typical lengths, including when NPD uses sample size 10. This matches the architecture's separation between the number of target positions and the sequence of steps required to compute them. More positions create work, and the GPU can handle much of that work simultaneously over the range observed in the plot. The dependence on hardware capacity shows up when NPD uses sample size 100. At that setting the workload saturates the GPU and latency again rises linearly with length in the authors' analysis.

The paper suggests that distributing NPD across multiple GPUs could bring its latency to about 80ms across sample sizes, since the candidates can be generated and scored independently. That number is a projection for a more parallel deployment. The measured speedup and length analysis come from the single-device experiments. Together they show where the parallel design saves time and how its advantage changes when decoding asks for more translations at once.

What the ablations show

The decoder needs source information at its starting positions

The authors' first architectural check is whether positional embeddings can provide the decoder inputs on their own. On IWSLT, this setup fails to train successfully. Positions tell the network where it is making a decision, and the encoder remains a potential source of sentence information. The result shows that this particular decoder and training procedure need a more informative start. Copying inputs gives each decoder position a direct source-derived representation to work from before attention refines it.

The uniform-copying comparison probes whether it is enough to supply any reasonably distributed source information. When the authors use uniform copying in the ablation, they provide the true target lengths. The baseline can therefore allocate the right number of positions from the start. Fertility-based copying improves development BLEU by four points when training uses the original targets. When distillation supplies the targets, the corresponding improvement is two points. Both comparisons use argmax decoding in the ablation study. The advantage is evidence for the value of allocating copies by source content even when the baseline receives the correct length.

Giving the baseline reference lengths is important because fertility changes the way the decoder gets its length as well as the way source inputs populate its positions. The comparison supplies length information to the baseline so that simple access to an appropriate length cannot explain the fertility system's advantage. It leaves several changes tied together. Introducing fertility also introduces a supervised predictor and a decoder that is trained to rely on its counts. The experiment measures the resulting design change as a whole.

The paper also reports that masking each position's own entry in decoder self-attention improves performance relative to leaving attention fully unmasked. The comparison supports the specific mask in the authors' decoder. The discussion gives this result qualitatively. The positional attention module has a separate motivation. The paper proposes that stronger positional information may improve local reordering, while the reported analyses leave the size of that module's individual effect undetermined.

Teacher-generated targets and fertility help together

Replacing original training targets with the teacher's outputs generally adds around 5 BLEU points on the IWSLT development set. This is evidence that the form of the training corpus matters greatly to the parallel decoder. The underlying source sentences remain the same. The change is what the system is asked to imitate on the target side, along with the alignment-derived counts associated with those target sentences when fertility is used. A teacher that keeps its choices more consistent gives the student a more regular mapping to learn.

The ablation also compares students trained on targets generated by teacher beam search with students trained on targets generated greedily. Their performance is similar in this experiment. The reported benefit therefore occurs even when the teacher commits to each word as it generates its training translations. The experiment does not quantify how much ambiguity remains in either distilled corpus. It establishes that the additional search involved in making the beam-generated training targets produced little difference here.

Fertility still helps when distillation is already in use. The smaller gain for fertility under distillation is consistent with the two changes addressing some of the same difficulties. Conditioning on a count plan can narrow the set of compatible outputs. Training on a teacher's preferred wording can make the remaining choices more predictable. Each comparison changes the context in which the other part operates. Their effects are best read at the corresponding starting points in the ablation.

The development table also reports a BLEU variant against targets made by the teacher. That evaluation is particularly relevant to a student trained to reproduce the teacher's choices. It can register closer agreement with those choices even where the human reference happens to use a different construction. Including scores with ordinary development references gives the study a way to relate that agreement to the translation-quality metric emphasized in the paper.

The fine-tuning terms and the sampled outputs

Fine-tuning with the reinforcement-learning term alone fails to converge in the reported ablation. The same is true when using just the backpropagated word-level term based on external fertilities. The combined objective, which retains the original distillation loss and adds both teacher-feedback terms, improves IWSLT development BLEU by around 1.5 points. The reliable gain reported here belongs to the combined procedure after supervised convergence. Evidence about the individual terms comes from their attempts to train on their own.

This finding qualifies what can be inferred from the policy-gradient component. The learned count distribution can receive translation-level guidance from the teacher through sampled plans. Yet the transfer of that guidance works in the reported experiment alongside conventional supervised training and a fixed-plan contribution. The ablation does not resolve how much of the gain to assign separately to better fertility choices, changes in the token distributions, or their interaction. Both parts of the student can change under the joint objective.

The translation examples examine an error that a corpus-wide score alone would be hard to diagnose. On the IWSLT development set, the plain parallel system sometimes repeats words or phrases. The paper illustrates this especially in the more complex of the examples shown. With NPD at sample size 100, some repeated material disappears from the chosen versions. Since the system chooses among completed candidates, one interpretation is that the teacher gives a low score to some repetitions and can prefer a candidate in which they never appeared. The examples illustrate this selection mechanism and also show NPD translations that read more literally than the corresponding autoregressive output.

A Romanian–English example shows the other side of the method. The figure lays out eight sampled count sequences, the decoder inputs each one creates, and the translated candidates. The candidates differ in wording as the allocation changes, and the teacher scores them to make its final choice. The figure demonstrates a capacity for variation even though each individual conditional decode selects tokens by local maximization. The diversity enters before token prediction, through the fertility distribution.

Limitations

Limits the authors identify

The authors explicitly recognize that fertility accounts for only part of the variability in translation. A count sequence can identify how much each source token contributes and still be compatible with substantially different wordings. The decoder continues to rely on conditional independence once the plan has been chosen. The same ambiguity that motivates the paper can therefore survive within a single plan. Sequence-level distillation helps by making the training data more consistent, with the acknowledged cost of substituting weaker teacher targets for some stronger original ones.

Supervised fertility training also relies on an approximate external assignment. The aligner supplies a single count sequence for a pair that might admit several. A count that is natural under one assignment can look different under another. The authors introduce fine-tuning in part to give the fertility predictor feedback from the quality of its own sampled plans. The joint recipe improves the development result, while the separate reinforcement-learning attempt fails to converge. Supervised initialization and the continued use of fixed-plan feedback are consequently part of the conditions under which the paper demonstrates this improvement.

The authors also identify exact search as intractable. Argmax and average decoding commit to a single approximate plan, and NPD searches a sample by scoring the candidate translations it happens to generate. The teacher can choose only among the sentences in that sample. The computational cost rises with the sample size even when the available hardware initially keeps latency low. Once capacity is exceeded, as in the larger IWSLT latency experiment, the time needed for the extra work becomes visible.

What the evaluation leaves open

The training ablation emphasizes IWSLT, and the main translation results cover a limited set of language pairs and directions. The reported effects of distillation, copying, and joint fine-tuning are therefore most directly established for that development setting. The WMT experiments show that the overall system transfers to the larger tasks tested, with different translation-quality outcomes. They leave open how the contributions would change for other language pairs or for source and target texts whose alignments systematically behave differently.

Latency depends on deployment conditions. The experiments use single sentences on a particular GPU and implementation. The change in the latency curve at higher sample sizes already shows how readily the available capacity can affect the outcome. Throughput for batches of incoming requests, memory pressure under load, and latency on other hardware remain outside the measurement. The projected multi-GPU result concerns the parallelizability of the work. Establishing that deployment's actual latency would require measuring how the candidates are distributed and scored in that setting.

The quality evaluation uses BLEU and a small set of examples for inspecting errors. BLEU makes a consistent corpus-level comparison possible, and the examples show what repeated phrases or more literal wording can look like. The examples leave the frequency of either behavior unresolved. The paper also leaves open whether the observed changes in BLEU track improvements in adequacy or fluency as judged by readers. This matters when different translations can be valid and the system is explicitly trained to favor consistent teacher wording.

Finally, the quality and speed figures belong to particular decoding configurations. Single-plan decoding gives the most direct view of the NAT's ability to translate in parallel without a teacher score at inference. NPD's strongest results include an autoregressive teacher and additional candidates. The paper shows that using such a teacher as a scorer is compatible with substantial parallelism. It leaves the tradeoff dependent on the value of extra candidates, the quality of their source, and the capacity available to process them.

What came after

The work opened several related questions. One is how to coordinate a full target when all its positions can be processed together. Another is where to put a latent variable so that it carries information the decoder needs. A third is how much speed an architecture gains once the whole translation procedure, including any repeat passes or rescoring, is counted. The citing works below are related through their stated methods and subjects. Their titles identify directions of follow-up, while the details of their evaluations lie beyond the results of the original paper.

Deterministic Non-Autoregressive Neural Sequence Modeling by Iterative Refinement takes the problem of non-autoregressive generation into iterative refinement. The connection concerns the opportunity to revise an initial output. NAT's single-plan procedure obtains its entire sentence from one completed allocation of decoder inputs. Refinement makes successive versions of the sequence the organizing principle, so the relevant dependency is between versions of a sentence. The question of speed becomes how much work each revision needs and how many revisions are needed for a satisfactory result.

Mask-Predict puts parallel decoding in the setting of conditional masked language prediction. Masking identifies target positions to be filled, and visible positions can supply context to the predictions. This relates directly to the original coordination problem. NAT shares a source-derived count plan across its simultaneous decisions. Masked prediction gives the decoder a way to make target-side context available where words have already been supplied, while retaining parallel prediction for the positions that are open.

Parallel Iterative Edit Models for Local Sequence Transduction frames parallel prediction as editing a sequence in stages. Whole-sentence construction from copied source inputs is one way to organize parallel work. Local edits organize it around changes to positions in a sequence that already exists. The connection with refinement is the availability of a full intermediate state. The work's scope is local sequence transduction, which puts the question of parallel coordination in a setting organized around local changes.

FlowSeq tackles non-autoregressive conditional sequence generation using a generative flow. Its connection to NAT is the use of a generative mechanism to support parallel outputs conditioned on an input sequence. The original paper works with a discrete and interpretable plan whose entries count copies of source inputs. The flow-based formulation shifts attention to how the underlying distribution is constructed. It addresses the same broad design problem of giving jointly generated positions a common source of variation.

Non-Autoregressive Machine Translation with Latent Alignments keeps the relationship between sequence positions central to translation. In the original NAT, a hard alignment initially supplies the training counts, and those counts preserve how much output each source position accounts for. The later work names alignments themselves as the latent structure. That is a closely related choice about what the translation system should infer, with the alignment relationship receiving a more direct role than the per-position counts in the earlier paper.

End-to-End Non-Autoregressive Neural Machine Translation with Connectionist Temporal Classification also addresses the relationship between a parallel computation and the variable-length sequence it produces. It frames that task using connectionist temporal classification. The point of contact is an important part of the original method that can be overshadowed by the discussion of word choice. Before output tokens can be computed together, the system needs a way to relate its available prediction positions to the translation that will be read. NAT uses repeated source inputs and their summed fertilities to establish that relationship.

Glancing Transformer for Non-Autoregressive Neural Machine Translation stays with the Transformer architecture and places its contribution in a glancing approach to non-autoregressive translation. It belongs to the line of work that asks what context a parallel Transformer can use to learn coordinated token predictions. The original paper distributes that responsibility across copied inputs, positional attention, and the training targets supplied by a teacher. The later work poses the question through the context indicated by its named method.

Deep Encoder, Shallow Decoder reevaluates non-autoregressive translation by changing how computation is divided between the encoder and decoder. That comparison bears directly on the baseline underlying the original latency result. A matched teacher and student help isolate the change in decoding procedure at a particular architecture size. Moving layers between the two halves asks how the comparison changes when translation systems spend their computation in different places. It brings attention back to the distinction between an encoder pass that can be shared across all target positions and decoder work that may have to be performed repeatedly.

 Institutions

 Fields, topics and concepts

 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksArts and Humanities · 17,959 worksLanguage and Linguistics · 17,789 works

 Topics 1Research subjects and languages the work is about.Machine translation · 1,109 works

Appears in

Mentioned in articles aboutHong Kong

Cite

Cite as Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li and Richard Socher. 2017. Non-Autoregressive Neural Machine Translation. arXiv:1711.02281.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.1711.02281 · arXiv 1711.02281

@misc{gu2017non,
  title = {{Non-Autoregressive Neural Machine Translation}},
  author = {Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li and Richard Socher},
  year = {2017},
  doi = {10.48550/arxiv.1711.02281},
  eprint = {1711.02281},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1711.02281}
}

References

17 references, from the paper's own bibliography.

  1. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015. our card
  2. Peter Brown, Vincent della Pietra, Stephen della Pietra, and Robert Mercer. The mathematics of statistical machine translation: Parameter estimation. Computational Linguistics, 190 (2):0 263–311, 1993. OpenAlex ↗ · Scholar ↗
  3. Kyunghyun Cho. Noisy parallel approximate decoding for conditional recurrent language model. arXiv preprint arXiv:1605.03835, 2016. OpenAlex ↗ · Scholar ↗
  4. Chris Dyer, Victor Chahuneau, and Noah Smith. A simple, fast, and effective reparameterization of IBM Model 2. In NAACL, 2013. OpenAlex ↗ · Scholar ↗
  5. Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017. our card
  6. Łukasz Kaiser, Aidan Gomez, and François Chollet. Depthwise separable convolutions for neural machine translation. arXiv preprint arXiv:1706.03059, 2017. our card
  7. Nal Kalchbrenner, Lasse Espeholt, Karen Simonyan, Aaron van den Oord, Alex Graves, and Koray Kavukçuoǧlu. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099, 2016. OpenAlex ↗ · Scholar ↗
  8. Yoon Kim and Alexander Rush. Sequence-level knowledge distillation. In EMNLP, 2016. our card
  9. Philipp Koehn and Rebecca Knowles. Six challenges for neural machine translation. arXiv preprint arXiv:1706.03872, 2017. our card
  10. Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. In EMNLP, 2015. our card
  11. Randi Martin, Jason Crowther, Meredith Knight, Franklin Tamborello, and Chin-Lung Yang. Planning in sentence production: Evidence for the phrase as a default planning scope. Cognition, 1160 (2):0 177–192, 2010. OpenAlex ↗ · Scholar ↗
  12. Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: A method for automatic evaluation of machine translation. In ACL, pp. 311–318, 2002. our card
  13. Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. our card
  14. Ilya Sutskever, Oriol Vinyals, and Quôc Lê. Sequence to sequence learning with neural networks. In NIPS, 2014. our card
  15. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017. our card
  16. Ronald Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 80 (3-4):0 229–256, 1992. OpenAlex ↗ · Scholar ↗
  17. Y. Wu, M. Schuster, Z. Chen, Q. V. Le, M. Norouzi, W. Macherey, M. Krikun, Y. Cao, Q. Gao, K. Macherey, J. Klingner, A. Shah, M. Johnson, X. Liu, Ł. Kaiser, S. Gouws, Y. Kato, T. Kudo, H. Kazawa, K. Stevens, G. Kurian, N. Patil, W. Wang, C. Young, J. Smith, J. Riesa, A. Rudnick, O. Vinyals, G. Corrado, M. Hughes, and J. Dean. Google's neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. OpenAlex ↗ · Scholar ↗

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/gu-2017-non-autoregressive-neural-machine-translation/