Skip to main content
QUICK REVIEW

[Paper Review] Simple and Scalable Nearest Neighbor Machine Translation

Yuhan Dai, Zhirui Zhang|arXiv (Cornell University)|Feb 23, 2023
Natural Language Processing TechniquesComputer Science9 citations
TL;DR

SK-MT builds a dynamic, sentence-level small datastore and a distance-aware adapter to speed up kNN-MT and reduce storage, while maintaining translation quality.

ABSTRACT

$k$NN-MT is a straightforward yet powerful approach for fast domain adaptation, which directly plugs pre-trained neural machine translation (NMT) models with domain-specific token-level $k$-nearest-neighbor ($k$NN) retrieval to achieve domain adaptation without retraining. Despite being conceptually attractive, $k$NN-MT is burdened with massive storage requirements and high computational complexity since it conducts nearest neighbor searches over the entire reference corpus. In this paper, we propose a simple and scalable nearest neighbor machine translation framework to drastically promote the decoding and storage efficiency of $k$NN-based models while maintaining the translation performance. To this end, we dynamically construct an extremely small datastore for each input via sentence-level retrieval to avoid searching the entire datastore in vanilla $k$NN-MT, based on which we further introduce a distance-aware adapter to adaptively incorporate the $k$NN retrieval results into the pre-trained NMT models. Experiments on machine translation in two general settings, static domain adaptation and online learning, demonstrate that our proposed approach not only achieves almost 90% speed as the NMT model without performance degradation, but also significantly reduces the storage requirements of $k$NN-MT.

Motivation & Objective

  • Motivate fast and practical domain adaptation for neural machine translation without full model retraining.
  • Reduce the storage and decoding cost of kNN-MT by avoiding full-datastore searches.
  • Leverage sentence-level retrieval to build an extremely small, dynamic datastore per input.
  • Introduce a distance-aware adapter to adaptively fuse kNN retrieval with the NMT model.
  • Demonstrate effectiveness in static domain adaptation and online learning scenarios.

Proposed method

  • Retrieve top-64 bilingual sentences per input using BM25 on the training corpus.
  • Rank retrieved sentences with a similarity score and keep the top-m sentence pairs to form a tiny datastore for the input.
  • Construct the per-input datastore by running the pre-trained NMT model on the selected sentence pairs to obtain (key, value) pairs for decoding.
  • Compute a retrieval distribution p_kNN based on Euclidean distances to the current context and combine it with the NMT distribution using an interpolation coefficient.
  • Make the interpolation coefficient lambda adaptive by setting lambda = ReLU(1 - d0 / tau), where d0 is the top-1 distance and tau is a temperature parameter.
  • Optionally, learn or tune hyper-parameters (k, m, tau) and compare SK-MT variants (SK-MT1 with m=2, k=1 and SK-MT2 with m=16, k=2).

Experimental results

Research questions

  • RQ1Can a dynamically constructed, very small per-input datastore maintain or improve kNN-MT performance compared to using a full datastore?
  • RQ2Does a distance-aware, adaptive fusion of kNN retrieval with the NMT model yield robust performance across domain adaptation and online learning?
  • RQ3What are the speedups and storage benefits of SK-MT relative to traditional kNN-MT and fast variants under realistic decoding settings?
  • RQ4How does sentence-level retrieval impact translation quality for low-frequency or out-of-domain words?

Key findings

  • SK-MT achieves about 90% decoding speed of the base NMT model and outperforms standard kNN-MT in speed and storage efficiency.
  • A tiny dynamic datastore built from top-m sentence pairs per input significantly reduces storage from tens of gigabytes to megabytes while maintaining performance.
  • SK-MT2 (m=16, k=2) attains comparable or better BLEU/ChrF scores than AK-MT and surpasses FK-MT, EK-MT, and CK-MT baselines on multi-domain IT, Medical, Koran, and Law datasets.
  • The adaptive lambda strategy improves translation quality by preventing noisy kNN contributions when distance is large, while leveraging kNN when neighbors are relevant.
  • In online learning scenarios with human feedback, SK-MT variants outperform kNN-MT and are competitive with KoK, showing faster adaptation to new corrections.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.