Elamur Research

Non-Parametric Adaptation for Neural Machine Translation

Paper · 2019 · Ankur Bapna and Orhan Firat

Summary

A translator can recognize the meaning of a sentence and still miss the conventional way to express one of its phrases. An earlier translation might contain just the wording it needs, even if that earlier sentence is about something else. Ankur Bapna and Orhan Firat make this distinction the starting point for a study of neural machine translation. Their system searches for passages that resemble parts of the sentence it is translating, then consults both sides of the resulting bilingual examples. It learns to judge which parts of those examples are relevant as it generates the new translation.

The paper changes both how examples are found and how the translator reads them. A search based on whole sentences can work well when a collection contains many similar sentences. It can overlook an example whose value lies in a short expression. The authors instead search with n-grams, or contiguous spans of tokens, and bring back the complete sentence pair in which each match occurs. One version looks for shared words and gives rarer words more weight. Another compares numerical representations of spans, so that passages with different wording can still be close. The translator reads the retrieved source in light of the sentence at hand, then uses that reading to interpret the retrieved translation. A learned gate controls how much weight the resulting memory receives at each step.

In the mixed-domain English-to-French experiment, the strongest overall configuration uses dense span retrieval. Against a Transformer Base trained on the same mixture, it raises the WMT newstest 14 test score from 41.92 to 42.41, the OpenSubtitles test score from 26.67 to 29.06, and the JRC-Acquis test score from 56.19 to 66.92. On IWSLT 2015, word-based span retrieval does slightly better than dense retrieval, scoring 45.09 against 45.02 and a baseline of 43.17. All these scores use BLEU, which measures overlap between generated translations and references. Whole-sentence retrieval helps on OpenSubtitles and JRC-Acquis but lowers scores on WMT and IWSLT. The comparison shows that a memory can help or hurt depending on what the search brings back.

The adaptation experiment starts with systems trained on WMT alone. At test time, the retrieval-equipped translator gains access to bilingual examples from the new domain while its learned parameters stay fixed. On the JRC-Acquis and OpenSubtitles test sets, it scores higher than a standard Transformer that underwent domain-specific fine-tuning. On IWSLT 2015, retrieval improves on the unadapted baseline but falls short of fine-tuning it. Updating the retrieval-equipped translator as well gives the highest scores on all the adaptation domains. The result establishes a practical distinction between learning how to use examples and changing which examples are available for a particular translation job.

Deep dive: Non-Parametric Adaptation for Neural Machine Translation

Non-parametric adaptation gives neural machine translation examples to consult at inference time, improving translation without retraining. · about 36 minutes to read

The problem and its context

Knowing a language and remembering a translation

The paper takes up a problem that remains even when a neural translator is strong in aggregate. It must generalize to sentences it has never seen, yet it is often expected to preserve particular choices seen in training. A conventional rendering of an idiom, for example, can be worth recovering almost as it stands. The rest of the sentence may call for ordinary composition. An approach that represents both kinds of knowledge in the same learned parameters can translate much of a sentence well while missing the expression for which precedent would be most valuable.

The authors place this problem in the context of the earlier shift from phrase-based statistical translation to neural sequence-to-sequence translation. A sequence-to-sequence system reads an input sequence and produces an output sequence, choosing each new target token in light of the source and the output so far. The paper describes large gains in general translation quality from this approach and from subsequent work on architectures and training. The references behind that account include Sequence to Sequence Learning with Neural Networks and Attention Is All You Need.

The gains left uneven performance on particular tasks. The paper points to earlier findings on idioms, unusual words and phrases, and mixtures of domains. It brings these together under the problem of retaining information from individual examples. During gradient-based training, a system changes weights shared by many inputs. An update prompted by one group of examples can change behavior on earlier ones. The authors draw on work about catastrophic forgetting, the loss of learned behavior as parameters shift, to motivate a separate place for individual translations. The translation difficulties are part of the motivation discussed in Six Challenges for Neural Machine Translation and A Challenge Set Approach to Evaluating Machine Translation.

An external translation memory preserves an example in a different form. The source sentence and its translation remain available as records that can be found again. The paper notes that human translators already use translation memories built from individual sentence pairs. Direct access to such pairs brings its own problem. A previous example can supply a good answer for one expression while supplying irrelevant or misleading material for the rest of the sentence. The paper treats the memory and the trained translator as complementary. Search supplies particular cases, and the neural components supply the ability to interpret those cases and generate a new sentence.

A close sentence and a useful phrase

Earlier combinations of retrieval and neural translation usually looked for examples that resembled the query at the sentence level. The authors describe these approaches as successful in narrow domains, where the material used for training and testing can share substantial wording. A sentence with similar content throughout can give a translator several useful correspondences at once. Procedure, subject matter, and structure may all be close enough that much of the earlier translation is worth reading.

In a broad collection, useful evidence can have a different shape. A sentence about an unrelated subject can contain the same expression as the query, while a sentence with more words in common overall can miss that expression entirely. A search criterion that rewards the best overall match can then rank the second candidate higher. The authors' objective differs from the objective of ranking documents by overall similarity. A candidate is useful when the translator can put some of its content to work. Finding that content is a problem in information retrieval.

Phrase-based translation offered a precedent for making the search local. A phrase table gives access to smaller source and target units, and the paper compares its own span search to taking advantage of that kind of evidence. Its distinctive step is to use the small span as the search key and retain the full sentence pair as the result. The surrounding source words can clarify the meaning of a matched phrase, and the full target can show how the expression fits into a sentence. Keeping those surroundings also increases the amount of material the decoder must sift through. The precedent is Statistical Phrase-Based Translation.

The related work includes methods that bring phrase tables or output from a statistical translation system into neural translation. The paper describes the appeal of giving the translator smaller, cleaner pieces of evidence. It also describes the overhead of training and maintaining a separate statistical system, whose output can introduce errors of its own. The authors instead leave the bilingual pairs intact and give the translator a learned way to distinguish the useful parts. Another approach to bringing retrieved fragments into the translation process is Guiding Neural Machine Translation with Retrieved Translation Pieces.

The authors also distinguish using examples as input from using them to update weights. Previous adaptation methods discussed in the paper retrieved examples and ran gradient updates for individual requests. In that setup, the retrieved data change the translator before it produces the answer. The present approach trains the translator to take examples as additional input. Once it has learned that behavior, a different example collection changes what the translator can consult during generation. The computation required to search and read the examples remains part of translation.

The memory design grows out of earlier work on retrieving translated sentences and combining their representations with the current input through gated attention. The authors identify a gap in a design that encodes retrieved targets on their own. The system has to decide which parts of a French sentence are useful for an English query, and the English sentence that French originally translated offers a way to make that connection. Their design also draws on work that extends the Transformer to read additional context, including Improving the Transformer Translation Model with Document-Level Context.

The paper situates this design alongside retrieval in other generation tasks, including dialogue and code generation. It also discusses question answering systems that look outside the training examples for material relevant to an answer. The translation experiment deliberately uses existing bilingual pairs from the training collections. An external text collection can serve a different purpose, since its contents can supply information that was absent from supervised examples. The paper illustrates that broader role for retrieval through Reading Wikipedia to Answer Open-Domain Questions.

The method, step by step

From the sentence to a bilingual memory

Consider a query whose crucial expression appears in an otherwise unrelated training sentence. The first job is to find the training pair. The search operates on the English sides of the collection, where it can compare the wording of the query with other English wording. Once it finds a match, it brings back the corresponding French translation as well. Search therefore needs no proposed French translation of the query. Its result is a set of examples from which the decoder can draw evidence as it writes.

The next job is to interpret each pair. The system encodes the new English sentence and reads each retrieved English sentence with access to that encoding. It can then read the French side with access to the representation of the retrieved English side. This sequence gives the French representation an indirect route back to the new English sentence. It is the basis of the Conditional Source Target Memory, or CSTM. The decoder consults this memory together with the ordinary representation of the query.

The term semi-parametric refers to the combination of these mechanisms. The neural components have learned weights for representing sentences, attending to them, and predicting target tokens. The retrieved pairs come from a collection whose contents can be changed independently of those weights. In the adaptation experiment, the authors apply this distinction by changing the collection at evaluation time. The design belongs to the broad family of retrieval-augmented generation, with a bilingual collection and an explicit path through the original source of each retrieved translation.

Translating with a retrieved bilingual memory

The steps in order.

Translating with a retrieved bilingual memoryStep 1: Search source sentences for locally similar spans1. Search source sentences for locally similar spansStep 2: Retrieve the complete bilingual pairs2. Retrieve the complete bilingual pairsStep 3: Encode the current source sentence3. Encode the current source sentenceStep 4: Read retrieved sources in light of the query4. Read retrieved sources in light of the queryStep 5: Read retrieved translations through their sources5. Read retrieved translations through their sourcesStep 6: Join the encoded translations into memory6. Join the encoded translations into memoryStep 7: Gate source and memory evidence during decoding7. Gate source and memory evidence during decoding

What the decoder predicts

The paper begins with the usual sequence-to-sequence prediction. At a particular position in the output, the translator estimates a distribution over possible next tokens. Here and in the retrieval definition, a token is a unit of the text representation. It can be a word or a fragment of a word, depending on the stage. Splitting text into these units is tokenization.

p(yₜ | X, y₁, …, yₜ₋₁)

Here p is the conditional probability assigned to a candidate next token. The candidate is yₜ, and t is its position in the target. X is the full source sequence. The sequence y₁, …, yₜ₋₁ is the target prefix already available at that position, starting at y₁ and ending at the token immediately before yₜ. The vertical bar means that the quantities after it are given when the probability is evaluated. The paper calls the completed target sequence Y.

The retrieval stage produces a set of examples for each source. An example carries both the source that search found and the target that was paired with it in the corpus.

Φₓ = {(X₁, Y₁), …, (Xₙ, Yₙ)}

Φₓ is the set associated with the query X. The subscript x marks that association. X₁ and Y₁ are the source and target of the first example in this notation. Xₙ and Yₙ are the source and target of the last, and the ellipsis stands for the intervening pairs. The final subscript n here denotes the number of neighbors, which the paper writes as N. The parentheses group the two sides of a stored translation, and the braces collect the pairs. In the span search below, the paper uses lower-case n for span width, a separate quantity.

With the examples available, the prediction changes as follows.

p(yₜ | X, y₁, …, yₜ₋₁, Φₓ)

The probability p of the target token yₜ again depends on the source X and target prefix y₁, …, yₜ₋₁, at position t. It now also depends on Φₓ, the retrieved sentence pairs for that source. The conditioning bar includes the new input with the existing ones. Conceptually, the examples can influence the probability of any token in the output, while the source and the growing prefix still determine what the sentence has to say and how it has been built so far.

The authors test different ways of producing Φₓ and different ways of encoding it. This separation matters when comparing systems. A retrieval comparison can keep the memory architecture the same and change which pairs it receives. A memory comparison can hold the retrieval strategy fixed and change the information available as the targets are read. The adaptation comparison changes the corpus supplying examples at test time, after the translator has learned the prediction task.

A score for shared and unshared words

The lexical search uses inverse document frequency, abbreviated IDF. In this setting the unit used to count occurrences is a sentence from the training collection. The intuition is that a word present in many sentences gives weaker evidence of a particular match than a word that appears in relatively few. The authors compute a weight for each token as follows.

fₜ = log(|C| / nₜ)

Here fₜ is the IDF weight for the token t. The symbol t indexes a token type in this expression. C is the training corpus, and |C| is its size in sentence pairs. The quantity nₜ counts sentences containing t. The slash denotes division, and log is the logarithm applied to that quotient. Because the count is of sentences containing the token, repetitions within one sentence do not increase its document frequency.

The similarity score combines the weights of the words the two inputs share with weights from the complete set of words they contain. The score is used on source text, and the retrieved target comes from the pair associated with the selected source.

sim(Xᵢ, Xⱼ) = 2 × Σₜ∈(Xᵢ ∩ Xⱼ) fₜ − Σₜ∈(Xᵢ ∪ Xⱼ) fₜ

The function sim scores the source texts Xᵢ and Xⱼ, with i and j indexing the compared items. The intersection symbol ∩ selects token types present in both texts, and the union symbol ∪ selects those present in either. The expression t ∈ indicates that the token t belongs to the corresponding set. Each Σ adds the weights fₜ over its set. The shared-token sum is multiplied by 2, and the union sum is subtracted. A token shared by the two texts therefore contributes positively overall, and a token exclusive to either text contributes a penalty. A rare shared word can carry more weight, and a rare unmatched word can also count more heavily against a match.

Applied to whole sentences, this is the paper's sentence-retrieval baseline. Each query is compared with sources from the training corpus and assigned its most similar training pairs. The same idea supplies examples for queries from the training, development, and test splits. The comparison is based on sets of words. Sentence order still matters in the later encoding and translation stages, where the complete sentences are passed to the neural components.

Searching the same collection with smaller queries

For lexical span retrieval, the scoring rule stays the same and its inputs change. An n-gram is a contiguous stretch of tokens, and the paper considers several span widths so that evidence can come from a shorter expression or a longer passage. It first defines the spans starting at positions throughout a sentence, with padding available near the end. The small spans drive search. A hit still leads back to its full bilingual record.

Sₓⁿ = {(tᵢ, …, tᵢ₊ₙ) for 1 ≤ i ≤ T}

Sₓⁿ denotes the set of spans of the designated width n for the source sentence X. The sentence consists of the tokens tᵢ, with i denoting their positions and T the length of the sentence. The range 1 ≤ i ≤ T allows a start at each position. The parentheses enclose the contiguous token sequence at a given start, with the ellipsis covering the intermediate positions. The paper displays the endpoint as i + n and includes padding at the end. The braces collect the spans over the indicated starts.

Overlapping spans provide multiple views of the same sentence, and keeping every start would increase the search work. The authors use a reduced set to represent each sentence.

Ŝₓⁿ = {(tᵢ, …, tᵢ₊ₙ) for 1 ≤ i ≤ T and i mod 2 = 1}

Ŝₓⁿ is the reduced span set for X at width n. As before, tᵢ is the token at position i, T is the sentence length, and the tuple runs from tᵢ to the displayed endpoint tᵢ₊ₙ. The remainder operation mod restricts which starts are included. The condition i mod 2 = 1 selects odd starting positions from the range beginning at 1 and ending at T. The reduction still lets adjacent retained spans overlap when the spans are wide enough.

For each retained query span, the search finds the closest training span using the IDF score. A training span can occur in several sentences. The authors choose one of those sentences at random when resolving that case. If a search result would add a sentence already in the neighbor set, the procedure looks for the next most similar sentence. The resulting memory can cover distinct parts of the query, with the retrieved sentences kept distinct even when multiple query spans would lead to the same example.

The choice to score a local match and keep its surrounding sentence separates the jobs of retrieval and interpretation. At search time, unrelated words elsewhere in the candidate sentence do not penalize a good local match. At encoding time, those words are available to explain what the local phrase meant in its original setting. They are also potential noise. The conditional encoding and gated attention are intended to let the translator use the benefit of the larger record while limiting its influence where it is irrelevant.

The experiments use widths 6, 10, and 18 for both kinds of span retrieval. During training the neighborhood is limited to 10 examples per query, a choice the authors made to fit the computation on P100 hardware. During decoding, the system can use the neighbors associated with all the spans it searches. The possible number of examples thus grows with the sentence length, subject to duplicate removal. The whole-sentence comparison uses 10 neighbors in both training and evaluation.

Comparing spans through their representations

The dense variant changes how the system judges a span match. The lexical score needs overlap in token identity to reward a shared term. The dense score gives each span a numerical representation and compares those representations. The authors take them from a pretrained Transformer Base encoder trained on WMT. The starting representation of each unit comes from encoding the full sentence, so vectors entering a span representation originate in a reading of the surrounding text. The architecture uses Transformer attention.

For this variant the input units are sub-words. A written word may be represented by several units, and the span is a run of those units instead of a run of whole words. The span representation is the mean of the encoder vectors for the sub-words in that span. Averaging gives the search a single vector to compare for each candidate, including across occurrences with different surrounding sentences. The token units used in this variant are a case of subword tokenization.

The search uses L2 distance, the ordinary straight-line distance between the span vectors, and favors smaller distances. The intended advantage is that equivalent or related ways of saying something can lie near one another even where the words differ. The distance is still a search criterion. It says which candidates to bring back and leaves the relevance of their actual French wording for the translation stage to assess. As in lexical span retrieval, the authors search at multiple widths and discard duplicate sentence neighbors.

This variant changes several things together relative to lexical span retrieval. It uses sub-words as the units of the span, obtains vectors from a trained English encoder, pools those vectors, and ranks candidates by distance rather than by the IDF score. The experiments compare the resulting retrieval procedures as packages. A gain for the dense procedure would establish the value of that combination in the setup. The comparison gives no separate estimate of how much came from using sub-words or how much came from the representation and distance criterion.

Reading the original source of each translation

The CSTM keeps the link between each retrieved English sentence and its own French translation. It starts with the encoding of the current source. Each retrieved source has a Transformer layer that reads its own tokens through self-attention, which lets positions in a sequence draw information from other positions in that sequence. The layer also uses cross-attention to the current source encoding. Cross-attention lets a position in the retrieved source draw on another sequence, here the query. The resulting retrieved-source representation reflects the sentence itself and its relation to the query.

The retrieved target is encoded next. It uses the same general combination of attention operations, with cross-attention directed to the representation of its paired retrieved source. That source already carries information from the query. The French side therefore receives information about the new job along a chain that preserves the connection to the English sentence it originally translated. If a match is valuable only for a local phrase, this design gives the target encoder a way to represent that phrase in connection with its source and to give different treatment to unrelated material.

All the encoded targets are then concatenated along their sequence dimension. The result is a memory containing positions from every retrieved translation, so the decoder can attend to particular places in that memory. A retrieved pair supplies context for the representations. Its words do not have to be emitted as a group, and a selected pair does not dictate the target sentence. The trained decoder can combine cues from the memory with cues from the current source at the positions where they matter.

The memory design gives the system distinct ways to respond to an irrelevant result. Conditioning can affect the representations before the decoder reads them. Attention can then give different weights to positions inside the memory. Finally, the decoder's gate can reduce the contribution of the resulting memory context relative to the current source context. The paper evaluates whether the source-conditioning path improves translation as a whole. These stages describe where filtering can happen, while the scores measure its consequences at the output.

Combining the source and the memory

In each decoder layer that uses cross-attention, the extended system produces a source context and a memory context. A context vector is a summary drawn from the positions being attended to. The two vectors come from separate multi-head attention operations using the same decoder query. This gives the current decoding state a way to ask separately what it needs from the English input and what it can use from the memory. The paper keeps the rest of the decoder architecture as in the Transformer.

gₜ = σ(Wᵍˢ cₜˢ + Wᵍᵐ cₜᵐ)

Here t is the decoding position, and gₜ is the scalar gate at that position. The vector cₜˢ is the context from the source encoder, and cₜᵐ is the context from the memory. The superscripts s and m stand for source and memory. Wᵍˢ and Wᵍᵐ are learned parameters that map the respective context vectors to contributions to the gate. Juxtaposition denotes applying each learned projection, and the plus sign adds their outputs. The sigmoid σ converts that sum to a weight between zero and one. The attention operations producing the contexts use qₜ, the decoder's query at position t.

The decoder uses the gate and its complement to build the context it passes onward.

cₜ = gₜ ∗ cₜˢ + (1 − gₜ) ∗ cₜᵐ

The vector cₜ is the combined context at decoder position t. The scalar gₜ weights the source vector cₜˢ, while its complement, 1 − gₜ, weights the memory vector cₜᵐ. The symbol ∗ indicates scalar multiplication of a vector, and the plus sign adds the weighted vectors. A gate nearer one gives the source more influence. A gate nearer zero gives the memory more influence. Since the contexts depend on the decoder's query, the balance can vary as the target sentence takes shape.

This gate differs in role from the retrieval ranking. Search compares source passages and selects candidate sentence pairs before the target is generated. The gate acts on the contexts drawn from the selected material during generation. A pair can therefore be useful enough to retrieve while supplying little help at most output positions. Conversely, the decoder can consult the memory for a particular construction while relying more heavily on the source for the names, details, or relationships that distinguish the new sentence.

How the systems learn to use the memory

The retrieval-equipped translator is trained on examples that already have retrieved context. It learns to produce the training target while consulting the source and neighbors. The dense retrieval representation comes from the pretrained WMT encoder described above. In the translation architecture, the memory layers and decoder learn to use the selected pairs as part of the translation task. The paper describes the choice of retrieval method separately from optimization of the translator.

For the mixed-domain runs, the training corpora are concatenated without sampling to balance their sizes. The authors first tokenize them with Moses and use a shared SentencePiece vocabulary of 32,000 tokens for the sub-word representation. That vocabulary supplies a common inventory for the bilingual setup. The paper's tokenizer reference is SentencePiece.

The authors train each system for 1M steps and choose among the last 5 checkpoints by validation performance. The baseline uses the Transformer Base training schedule and batching scheme. The retrieval system retains the Transformer Base dimensional settings, including 8 attention heads, a representation dimension of 512, and a hidden dimension of 2048. The same sizes are used for the added memory components. Keeping the dimensions comparable leaves a substantial architectural difference, since the retrieval-equipped translator has additional components for reading and using the examples.

The baseline trains on 16 GPUs. The retrieval systems train on 32 GPUs, with each replica split across 2 GPUs. One handles the translation computation and the other handles the CSTM computation. The retrieval systems use the learning-rate schedule reported as (3, 40K), drawn from The Best of Both Worlds. The paper gives that setting in compact form and describes the schedule as conservative.

Both kinds of translator use a dropout rate of 0.1 across the inputs, residual connections, attention, and ReLU connections. Dropout is a regularization technique used during training, as described in Dropout. The authors also use label smoothing with an uncertainty setting of 0.1 and apply layer normalization to the output of the CSTM. The systems are implemented in Tensorflow-Lingvo, and all use Adam for optimization.

Experiments and results

The corpora and what each experiment measures

The authors run the experiments on English-to-French translation. The mixed-domain experiment combines training examples from WMT, IWSLT, JRC-Acquis, and OpenSubtitles. The four sources serve different roles in the analysis. WMT and IWSLT are treated as broader collections for assessing the reach of retrieval, and JRC-Acquis and OpenSubtitles are treated as narrower domains. Since the systems share the mixed training data, the separate test scores show how each design behaves on the different sources within that mixture.

The WMT training set contains 36 million pairs, with newstest 13 serving as the validation set and newstest 14 as the test set. IWSLT contributes 237k pairs. Its validation material combines test corpora from 2012-14, and its evaluation uses test 2015. The names of the splits matter because the reported scores refer to these particular collections and because checkpoint choice is made using validation performance. The mixed-domain validation set joins the individual validation sets into a single collection.

JRC-Acquis contributes 797k training pairs. The authors set up their own validation and test partitions because they report no publicly available benchmark split for this dataset. After deduplication, the JRC-Acquis test set has 6574 pairs and the validation set has 5121 pairs. The underlying collection is documented in The JRC-Acquis.

OpenSubtitles contributes 33M training pairs. Its validation and test partitions are also prepared by the authors. The test set contains 3975 pairs, and the validation set contains 3488 pairs. Together, the corpus sizes illustrate how unequal the raw contributions are to the mixed training collection. The authors use that collection directly, so the test breakdown reports results by domain while the overall training mixture retains those differences in size.

Search is limited to the appropriate training partition for each corpus. For instance, a JRC-Acquis test query can retrieve JRC-Acquis training pairs. For the mixed-domain experiment, the learned parameters are shared across the mixture, but the corpus used for lookup is selected by domain. The paper gives scalability as the reason for that choice. It also means the experiment tests the quality of lookup within a known collection, a different task from discovering which collection to search.

The metric throughout is BLEU. The authors use the Moses script multi-bleu.perl to compare tokenized, truecased outputs and references. This scoring procedure measures agreement with reference wording at the collection level. The paper's hand-picked examples give a closer view of what a difference in wording can look like in a particular sentence. The aggregate scores are the basis for comparing the different setups.

Mixed-domain translation

The baseline is Transformer Base trained on the pooled corpus without a retrieval memory. The other systems use the CSTM with one of the three search strategies. This setup asks whether consulting examples improves on a competent translator already trained on the same mixture, and whether any gains depend on the granularity or representation used to find those examples.

On WMT newstest 14, the no-memory baseline scores 41.92 BLEU. Whole-sentence IDF retrieval lowers the score to 40.89. Lexical span retrieval returns it to 41.92, and dense span retrieval gives 42.41. The authors describe the last result as a gain of 0.5 BLEU points on WMT 14. The progression is informative because the baseline is already strong and the sign of the outcome changes with the retrieval procedure. Access to extra text alone does not account for the improvement.

The IWSLT 2015 test set also shows a loss with whole-sentence retrieval. Both span approaches score above the baseline, and lexical spans give the highest test score in this comparison. The small ordering difference between the span methods matters when reporting the results. Dense retrieval has the best overall pattern across the domains, while the IWSLT table favors IDF span retrieval.

Retrieval strategies on the IWSLT 2015 test set

Both span searches outperform the baseline, with lexical span retrieval scoring highest.

Retrieval strategies on the IWSLT 2015 test setTransformer Base without retrieval: 43.17Transformer Base without retrieval43.17CSTM with IDF sentence retrieval: 42.35CSTM with IDF sentence retrieval42.35CSTM with IDF span retrieval (this paper): 45.09CSTM with IDF span retrieval (thispaper)45.09CSTM with dense span retrieval: 45.02CSTM with dense span retrieval45.02
The numbers
System or settingBLEU
Transformer Base without retrieval43.17
CSTM with IDF sentence retrieval42.35
CSTM with IDF span retrieval (this paper)45.09
CSTM with dense span retrieval45.02

On the OpenSubtitles test set, the scores rise from 26.67 BLEU without retrieval to 28.25 with IDF sentence retrieval, 28.74 with IDF span retrieval, and 29.06 with dense span retrieval. Unlike on WMT or IWSLT, whole-sentence retrieval adds value here. Each span variant improves on the sentence-based result, so the benefits of a local search remain visible in a corpus where whole-sentence lookups can already help.

The largest gains occur on the JRC-Acquis test set. Transformer Base scores 56.19 BLEU. Adding whole-sentence retrieval raises the figure to 65.38. The lexical span version scores 66.39 and the dense span version reaches 66.92. The authors describe the best result as an improvement of more than 10 BLEU points. The high score of the sentence method is important to the interpretation. On this collection, many examples can be useful even when they are selected by a criterion that expects overlap across the sentence.

Taken together, the test sets give a more specific answer than a single pooled score would. Local retrieval preserves the benefit of example lookup in the narrow domains and makes it viable on the broader sets used here. Dense span retrieval exceeds the no-memory baseline on every tested corpus. The best search for IWSLT is lexical, while the best listed search for the other corpora is dense. The data support the change from sentence search to finer retrieval more consistently than they support a universal preference for dense scoring.

Adaptation from WMT training

The second experiment asks whether a translator can benefit from examples from a new corpus with its learned weights fixed. The authors train a standard Transformer Base on WMT and separately train a CSTM translator with dense span retrieval on WMT. The latter learns to read and use WMT examples during training. These starting points are distinct systems, a fact that matters when interpreting the size and cause of any subsequent difference.

For the standard adaptation comparison, the authors initialize from the WMT-trained Transformer Base and fine-tune independently on each new domain's training data. For retrieval-only adaptation, they use the WMT-trained CSTM translator and change its search collection to the training partition for the evaluation domain. Its weights remain fixed. The authors also test the combination of retrieval and in-domain fine-tuning to see how much performance remains available after switching the corpus alone.

The WMT newstest 14 scores give a reference for performance on the original domain under this training setup. The WMT-only baseline scores 41.16 BLEU and the WMT-trained retrieval system scores 41.57. Those rows belong to the experiment whose training starts with WMT alone. The newstest 14 scores from the mixed-domain comparison come from a different training mixture. The adaptation table gives no corresponding fine-tuning scores on newstest 14.

On IWSLT 2015, the unadapted Transformer scores 39.75 BLEU. Using retrieval alone gives 40.95. Fine-tuning the standard Transformer gives 42.87, while using in-domain retrieval and also fine-tuning the retrieval-equipped translator gives 43.82. Here retrieval provides a route to improvement with fixed weights, but the domain-specific weight update in the standard system gives a higher score than retrieval alone. The combined approach gives the strongest result of the tested options.

On the OpenSubtitles test set, the unadapted Transformer scores 22.92 BLEU. The standard fine-tuned version scores 26.55, and retrieval alone gives 27.09. Combining fine-tuning with retrieval gives 29.12. In this case, the WMT-trained translator can gain enough from subtitle examples at inference time to exceed the conventional fine-tuning baseline. Its score can improve further when it also learns from the in-domain training data through weight updates.

JRC-Acquis displays the same ordering as OpenSubtitles. The authors' result here shows how large a change can be induced by exposing the translator to a collection of in-domain pairs after training. It also shows that the advantage of the retrieval-equipped setup continues when both retrieval and fine-tuning are available.

Adaptation strategies on the JRC-Acquis test set

Retrieval alone beats standard fine-tuning, and the combined strategy scores highest.

Adaptation strategies on the JRC-Acquis test setWMT-trained Transformer Base: 53.1WMT-trained Transformer Base53.1Standard in-domain fine-tuning: 62.99Standard in-domain fine-tuning62.99In-domain retrieval with fixed weights: 64.93In-domain retrieval with fixed weights64.93In-domain retrieval and fine-tuning (this paper): 66.72In-domain retrieval and fine-tuning(this paper)66.72
The numbers
System or settingBLEU
WMT-trained Transformer Base53.1
Standard in-domain fine-tuning62.99
In-domain retrieval with fixed weights64.93
In-domain retrieval and fine-tuning (this paper)66.72

These experiments distinguish the costs of preparing the translation system from the choices made for a new domain. Before adaptation, the CSTM translator has undergone training to make use of a memory. At evaluation on a new corpus, the retrieval-only condition changes the pool of examples and leaves that training intact. The request still incurs search and memory computation, and it still relies on a domain-specific bilingual collection. The comparison concerns the value of those examples as inference-time input and the benefit of avoiding a new round of weight updates.

The results make the strongest case for this form of adaptation on JRC-Acquis and OpenSubtitles. IWSLT qualifies that conclusion while still showing improvement over the unadapted baseline. The combined scores give another useful distinction. The ability to improve with frozen weights demonstrates that changing the examples can affect performance. The higher scores after fine-tuning indicate that domain-specific parameter changes still carry additional value in these tests.

What the ablations show

How much source information the memory needs

The memory ablation keeps dense span retrieval in the mixed-domain setup and varies how the examples are represented. The simplest memory, TM, encodes the retrieved target sentences on their own. The Conditional Target Memory, or CTM, adds a direct connection from the retrieved targets to the current source. It omits the retrieved sources from target encoding. CSTM instead gives each retrieved target access to its own source, after that source has been encoded with access to the query. The comparison also includes the standard no-memory Transformer.

The difference between TM and CTM tests the value of giving the retrieved French text access to the current query during encoding. Since the query is English, the memory encoder has to connect French passages directly to the English input in CTM. The difference between CTM and CSTM tests whether it helps to route that information through the English side of the retrieved pair. CSTM restores the evidence of what the French was meant to translate. With it, a locally similar English passage can help place the relevant French passage in context.

The WMT results distinguish smaller memory improvements from the effect of the full architecture. Both reduced memories fall below the no-memory baseline. Adding query conditioning to the target-only memory makes up some of the loss, and the complete source-to-target conditioning path produces the highest score. For that test set, the quality of the memory representation determines whether the retrieved examples are associated with a gain.

Memory architectures on the WMT newstest 14 test set

The full conditioning path is the only tested memory that raises the score above the no-memory baseline.

Memory architectures on the WMT newstest 14 test setNo memory: 41.92No memory41.92Target Memory: 41.64Target Memory41.64Conditional Target Memory: 41.87Conditional Target Memory41.87Conditional Source Target Memory (this paper): 42.41Conditional Source Target Memory (thispaper)42.41
The numbers
System or settingBLEU
No memory41.92
Target Memory41.64
Conditional Target Memory41.87
Conditional Source Target Memory (this paper)42.41

On IWSLT 2015, Target Memory scores 44.32 BLEU and Conditional Target Memory scores 44.76, before CSTM raises the result to 45.02. On OpenSubtitles, the corresponding test scores are 27.38, 27.74, and 29.06. Here even the target-only memory contains enough useful material to exceed the baseline. Additional conditioning increases the score in both cases. This is consistent with the proposed role of source information, since the candidates come from the same dense retrieval strategy.

On JRC-Acquis, the sequence is 64.25 BLEU for Target Memory, 65.18 for Conditional Target Memory, and 66.92 for CSTM on the test set. The substantial benefit of target-only memory on this domain is compatible with the sentence-retrieval results. An earlier French sentence can already contain a great deal of applicable wording. Access to the new English source, and then to the particular English sentence behind the earlier translation, provides still more evidence about which wording to use.

Across the ablations, using the complete conditioning path gives the highest score among the memory designs on every corpus. This supports the authors' claim that the sources help the system extract relevant material. The experiment also changes the structure of the encoder and the route through which information travels. It measures the total contribution of the alternative designs. It does not provide a direct reading of a particular attention weight or show exactly how a given token in the retrieved English sentence affected a resulting French word.

What the example translations reveal

The retrieval comparison holds the CSTM architecture in place while changing the examples found for it. The authors inspected retrieved candidates and attributed the losses from sentence search on WMT and IWSLT to difficulty finding useful matches. Their examples illustrate the different shapes a useful match can take. The illustrations complement the corpus scores by showing how a retrieved passage can improve a particular translation, though the paper does not give counts of how often these patterns occur.

In the JRC-Acquis example, the query and the retrieved source both describe a document that must remain on a vehicle for the full journey. The details of the vehicle and the name of the form differ. The ordinary translator renders some wording too literally, including the reference to the top copy. The system given the retrieved pair uses the French phrasing for the original of the journey document and retains the query's reference to a bus or coach. The example shows why a close match to a whole legal sentence can supply much of the needed structure without settling all its details.

The IWSLT example works differently. The query links consciousness to what makes life worth living. The retrieved sentence is a longer discussion of positive psychology with the same expression embedded in it. Much of the earlier sentence would be extraneous in the new translation. The retrieval-equipped system produces the French construction used in the reference for the local expression, while keeping consciousness as the topic. This is the central case for span retrieval. The search finds an applicable phrase through a short match, and the translator puts that phrase to work in a different sentence.

The WMT idiom example offers related evidence about lexical span search. The query describes expected signs of anger along with a fight at a gate. The retrieved sentence uses the same teeth-related idiom in a discussion of political reaction in the United States. The ordinary translation gives an inappropriate literal rendering. With the example available, the output conveys the idiom in the reference's terms and still follows the query's separate scenario. The result shows how matching a sequence of words on the source side can expose the translator to an established rendering for their combined meaning.

The dense search example features an artist whose death is reported with a day and an age. The closest useful passage describes the death of a former minister, with different circumstances and different wording for the death. The ordinary translator uses a different French expression for dying, and the retrieval-equipped translator uses the expression found in the neighbor and preferred by the reference. It keeps the artist and the details of the current sentence. This illustrates the authors' reason for using dense vectors. The retrieval stage can associate locally related expressions beyond exact wording, and conditioning can leave the surrounding factual differences with the current source.

The examples also help explain why the architecture reads full pairs after a short search. A retrieved French phrase may require a change of grammatical form or a change in how it is attached to the new sentence. Seeing the full French sentence gives the encoder information about its role there. Seeing the English side of that same example helps connect the role to a matching passage in the query. The outputs illustrate selective use of neighboring text, while the ablation measures the benefit of enabling that use across a whole test set.

Limitations

Boundaries the authors state

The search collections remain within the domain of each query. The authors explicitly restrict retrieval to the corresponding training partition for scalability. Accordingly, the mixed-domain test shows that shared translation parameters can take advantage of several separate stores, each selected in advance for its corpus. A single store mixing all domains would pose a different ranking problem. It could return useful matches from other collections and would also expose the decoder to more chances for superficially similar but unsuitable context.

The authors also limit the number of examples used in training for memory reasons. The span systems train with 10 neighbors and can use the neighbors from all searched spans at decoding. The increased computation of memory encoding is visible in the hardware configuration, where the translation system and CSTM computation occupy separate GPUs within a training replica. The paper gives a reason for the training limit and a recipe that fits the hardware it uses. Its quality comparisons leave open how search and generation would scale under different service requirements.

The conclusions keep the demonstrated setup to retrieved context from parallel text. The authors propose documents and bilingual dictionaries as additional sources the memory architecture could use. They also suggest that dense representations might enable extensions involving images or speech, and the related work discusses obtaining material from unsupervised corpora. Those proposals have a different evidence requirement. The experiments here use bilingual sentence pairs whose source and target are already associated, a relationship the CSTM uses directly.

The adaptation idea is also wider than the test of it. The authors see a translator with a replaceable store as a possible way to support new domains or individual documents. Their adaptation experiments change the store to an existing domain training collection. Those results show that such a collection can be used without a new parameter update. Whether a small document-specific memory could supply enough relevant bilingual material depends on the amount and quality of data available for that document, a condition the domain tests do not vary.

Limits of the evidence

The benchmark covers English-to-French only. It can establish that local retrieval helps across the particular test collections in this direction. The dependence of the method on the available examples makes it especially important to distinguish that finding from a claim about other settings. An experiment with another language direction or a sparse parallel collection would change both the supply of useful neighbors and how readily their target phrases can be adapted. The paper gives no corresponding test scores for those situations.

The comparison uses one aggregate translation metric. BLEU can reward recovery of conventional wording where that wording appears in the reference, as the examples illustrate. The corpus scores alone cannot show how often the system improves idioms, preserves source details more faithfully, or chooses an acceptable alternative to the reference. The examples make those phenomena concrete but are selected successes. An estimate of their prevalence would require an evaluation organized around those phenomena. The experiments also give no uncertainty intervals for the scores, which matters when interpreting close comparisons such as the IWSLT ranking of the span methods.

The motivation invokes catastrophic forgetting, and the external store does preserve records independently of parameter updates. The tests measure the effect of accessing those records on translation outputs. They do not follow a translator through a sequence of training updates while measuring what it forgets. The result therefore supports the value of recoverable examples for these translation tasks. It leaves open how much of any baseline error came from losing behavior previously learned, as opposed to failing to learn it reliably in the first place.

The retrieval comparisons separate granularity from architecture to a useful degree, especially when sentence and span IDF search use the same memory design. The dense comparison changes the token unit and the way similarity is estimated together. It has no independently measured effect for switching from words to sub-words. In the broader comparison with the no-memory Transformer, the CSTM adds learned layers and uses a different training schedule and hardware setup. The ablations within the memory family are thus the more direct evidence for the value of conditional source information.

The adaptation comparison also has an important baseline distinction. Both initial translators train on WMT, but one already has a CSTM and one is a standard Transformer. The WMT newstest 14 figures show a difference between them even on that original domain. The results report how full adaptation strategies compare. They do not report every new-domain evaluation using both an original WMT store and an in-domain store with the same frozen retrieval-equipped translator. Such a comparison would isolate the contribution of replacing the store under fixed architecture and weights.

Finally, the fixed-weight result establishes that adaptation can proceed without gradient updates on the new domain. It leaves the cost of the full translation pipeline open. Search, encoding the bilingual context, and decoder attention all take work, and the adaptation procedure still assumes access to the domain's parallel training data. The paper does not compare end-to-end time or resource costs against fine-tuning across a range of retrieval workloads. Its strongest cost-related conclusion is about which learning step becomes optional.

What came after

Two ways to revisit adaptation

The citing work on scalable translation adaptation and multilingual adapter generation takes up the question of how to specialize a shared trained system. In Bapna and Firat's retrieval study, the shareable part is the translator trained to read examples. The domain-specific part is the bilingual collection it can search. Scalable adaptation is the explicit subject of a separate paper from the same year, Simple, Scalable Adaptation for Neural Machine Translation. Its place in this line of work is the shared objective of making specialization practical across multiple settings.

Adapter generation identifies another way to approach that objective. The adapter is the unit being generated for cross-lingual transfer. This puts the emphasis on supplying a language-specific component of the system, whereas the retrieval paper supplies examples for a particular input from a selected collection. The connection is at the level of efficient specialization, with cross-lingual transfer giving it a different setting from the English-to-French domain experiments. The later work is MAD-G.

The store, the neighbors, and the generation task

The original experiments assume the domain of the query is known and use this information to choose a search collection. Work on unsupervised domain clustering addresses how domain structure can be identified in pretrained representations. The connection concerns the organization of text by domain. In the retrieval paper, the organization is established by the supplied corpora and determines where lookup occurs. Domain clustering makes the organization itself an object of study, as in Unsupervised Domain Clusters.

Adaptive nearest-neighbor translation is the closest topical continuation of the paper's use of neighboring examples. Bapna and Firat already separate finding neighbors from deciding how to use the retrieved evidence. Their search uses local span matches, and their decoder learns a gate for memory and source context. The later work places adaptation explicitly in the setting of nearest-neighbor translation. The citation connects the approaches through their reliance on retrieved examples, with specific differences in neighbor selection or integration belonging to Adaptive Nearest Neighbor Machine Translation.

Adaptive semi-parametric language generation takes up the combination of learned parameters and retrieved information beyond bilingual translation. The original paper asks what becomes possible when an English-to-French translator can use an example store whose contents change independently of its weights. The later title identifies adaptive semi-parametric language generation as the wider subject. This is the conceptual link to Adaptive Semiparametric Language Models.

The citation also reaches a survey concerned with harms from language generation and possible responses. That is a broader use of the paper in the literature. Bapna and Firat measure translation quality and domain adaptation, and the survey addresses actions in response to harms from generated language. The citation places a retrieval-based generation technique within that broader discussion. The translation scores provide no direct evidence about harm reduction, the question taken up by the Actionable Survey on Language Generation Harms.

Cite

Cite as Ankur Bapna and Orhan Firat. 2019. Non-Parametric Adaptation for Neural Machine Translation. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/n19-1191

@inproceedings{bapna2019non,
  title = {{Non-Parametric Adaptation for Neural Machine Translation}},
  author = {Ankur Bapna and Orhan Firat},
  booktitle = {Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)},
  year = {2019},
  doi = {10.18653/v1/n19-1191},
  url = {https://doi.org/10.18653/v1/n19-1191}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/bapna-2019-non-parametric-adaptation-neural-machine/