[Paper Review] Adaptive Nearest Neighbor Machine Translation
This paper proposes Adaptive $k$ NN-MT, a method that dynamically adjusts the number of nearest neighbors ($k$) for each target token using a lightweight Meta-$k$ Network, improving translation accuracy by filtering noisy retrieval results. The approach achieves 1.44–2.97 BLEU gains over vanilla $k$ NN-MT and generalizes across domains with minimal fine-tuning.
kNN-MT, recently proposed by Khandelwal et al. (2020a), successfully combines pre-trained neural machine translation (NMT) model with token-level k-nearest-neighbor (kNN) retrieval to improve the translation accuracy. However, the traditional kNN algorithm used in kNN-MT simply retrieves a same number of nearest neighbors for each target token, which may cause prediction errors when the retrieved neighbors include noises. In this paper, we propose Adaptive kNN-MT to dynamically determine the number of k for each target token. We achieve this by introducing a light-weight Meta-k Network, which can be efficiently trained with only a few training samples. On four benchmark machine translation datasets, we demonstrate that the proposed method is able to effectively filter out the noises in retrieval results and significantly outperforms the vanilla kNN-MT model. Even more noteworthy is that the Meta-k Network learned on one domain could be directly applied to other domains and obtain consistent improvements, illustrating the generality of our method. Our implementation is open-sourced at https://github.com/zhengxxn/adaptive-knn-mt.
Motivation & Objective
- To address the sensitivity and poor generalization of fixed-$k$ $k$ NN-MT, which fails to filter noisy neighbors when context is sparse.
- To improve translation robustness and accuracy in low-resource or out-of-domain settings by adapting $k$ per target token.
- To develop a lightweight, trainable mechanism that requires few samples and generalizes across domains.
- To enable more reliable and interpretable retrieval-based NMT by conditioning neighbor utilization on local context quality.
Proposed method
- Introduces a Meta-$k$ Network that evaluates the confidence of $k$-nearest neighbor predictions for each target token, using features like distance and value count.
- Uses a set of candidate $k$ values up to an upper bound $K$, and applies the Meta-$k$ Network to select the optimal $k$ dynamically per token.
- Employs a learnable aggregation mechanism that combines predictions from different $k$ values based on estimated confidence, improving robustness.
- Designs input features for the Meta-$k$ Network: (1) distance-based confidence and (2) count of distinct values among retrieved neighbors.
- Trains the Meta-$k$ Network with only a few hundred to a few thousand in-domain sentences, enabling efficient adaptation.
- Applies interpolation between NMT and $k$ NN predictions using a learnable $λ$, maintaining model consistency.
Experimental results
Research questions
- RQ1Can dynamically adjusting $k$ per target token improve translation performance compared to fixed-$k$ $k$ NN-MT?
- RQ2How effective is the Meta-$k$ Network in filtering noisy neighbors when context is sparse or ambiguous?
- RQ3Can a Meta-$k$ Network trained on one domain be transferred to other domains without retraining?
- RQ4What features are most predictive of reliable neighbor predictions in retrieval-based NMT?
- RQ5How many training examples are needed to effectively train the Meta-$k$ Network for strong performance?
Key findings
- Adaptive $k$ NN-MT achieves 1.44–2.97 BLEU point improvements over vanilla $k$ NN-MT across four benchmark domains when $K \geq 4$.
- The Meta-$k$ Network generalizes well: a model trained on the IT domain achieves comparable performance on medical, news, and scientific domains without retraining.
- The method maintains strong performance even with only 100 training sentences for Meta-$k$ training, demonstrating low data efficiency.
- The distance-based feature is more informative than the value count feature, with ablation showing it contributes more to performance gains.
- In domain-mismatch settings (e.g., IT input to medical model), Adaptive $k$ NN-MT prevents performance degradation seen in vanilla $k$ NN-MT, proving robustness.
- With just 0.6k parameters, the Meta-$k$ Network achieves significant gains, showing high parameter efficiency.
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.