Adaptive Nearest Neighbor Machine Translation

Xin Zheng, Zhirui Zhang, Junliang Guo, Shujian Huang, Boxing Chen +2 more
5/27/2021
cs.CL

Official code: zhengxxn/adaptive-knn-mt (86 stars, MIT, last commit 2022-12-26).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

MIT
8610C++, LuaMay 8, 20213 years agoMIT

Cite this paper

@article{zheng2021adaptive,
  title  = {Adaptive Nearest Neighbor Machine Translation},
  author = {Xin Zheng and Zhirui Zhang and Junliang Guo and Shujian Huang and Boxing Chen and Weihua Luo and Jiajun Chen},
  year   = {2021},
  eprint = {2105.13022},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2105.13022}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2105.13022.svg)](https://codeofpaper.com/paper/2105.13022)

Discussion