[Paper Review] Nearest Neighbor Machine Translation
This paper introduces k-Nearest Neighbor Machine Translation (kNN-MT), a non-parametric method that enhances pre-trained neural machine translation models by retrieving relevant translation examples from a large, static datastore using semantic representations. By interpolating the model's output with a nearest-neighbor classifier over billions of cached examples, kNN-MT improves translation quality by up to 9.2 BLEU on out-of-domain data and 3 BLEU on multilingual adaptation without any fine-tuning.
We introduce $k$-nearest-neighbor machine translation ($k$NN-MT), which predicts tokens with a nearest neighbor classifier over a large datastore of cached examples, using representations from a neural translation model for similarity search. This approach requires no additional training and scales to give the decoder direct access to billions of examples at test time, resulting in a highly expressive model that consistently improves performance across many settings. Simply adding nearest neighbor search improves a state-of-the-art German-English translation model by 1.5 BLEU. $k$NN-MT allows a single model to be adapted to diverse domains by using a domain-specific datastore, improving results by an average of 9.2 BLEU over zero-shot transfer, and achieving new state-of-the-art results -- without training on these domains. A massively multilingual model can also be specialized for particular language pairs, with improvements of 3 BLEU for translating from English into German and Chinese. Qualitatively, $k$NN-MT is easily interpretable; it combines source and target context to retrieve highly relevant examples.
Motivation & Objective
- To improve neural machine translation performance without fine-tuning by leveraging external, cached examples.
- To enable domain adaptation and multilingual specialization using a single pre-trained model and domain-specific datastores.
- To enhance model interpretability by making retrieval decisions transparent through visible, relevant training examples.
- To scale nearest neighbor retrieval to billions of key-value pairs for high expressiveness in generation tasks.
Proposed method
- The method uses a pre-trained neural MT model to compute context representations for source and partial target sequences.
- A datastore is constructed offline, storing key-value pairs where the key is the decoder representation f(s, t_{1:i-1}) and the value is the ground-truth target token t_i.
- At inference, the model queries the datastore using the current context representation to retrieve k nearest neighbors based on cosine similarity.
- A distribution over target tokens is computed from the k retrieved neighbors using a softmax with temperature scaling.
- The final prediction is a weighted interpolation between the neural model’s output and the kNN distribution.
- The approach requires no additional training and can be applied to any pre-trained MT model.
Experimental results
Research questions
- RQ1Can nearest neighbor retrieval over a large, static datastore improve neural machine translation performance without fine-tuning?
- RQ2Can kNN-MT effectively adapt a single model to out-of-domain or low-resource domains using domain-specific datastores?
- RQ3Does retrieval at the token level, based on contextual representations, yield more relevant examples than sentence-level retrieval?
- RQ4Can kNN-MT improve multilingual models for specific language pairs without retraining?
Key findings
- kNN-MT improves a state-of-the-art German-English translation model by 1.5 BLEU without any training.
- When adapted to out-of-domain domains using domain-specific datastores, kNN-MT achieves an average improvement of 9.2 BLEU over zero-shot transfer.
- For multilingual models, kNN-MT improves translation from English to German and Chinese by 3 BLEU using language-pair-specific datastores.
- Retrievals are highly contextually relevant, with examples showing effective subword representation usage, such as reconstructing named entities split across subwords.
- The method is interpretable, as retrieved examples are directly visible and contribute meaningfully to predictions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.