Nearest Neighbor Machine Translation ($k$NN-MT) has achieved great success in domain adaptation tasks by integrating pre-trained Neural Machine Translation (NMT) models with domain-specific token-level retrieval. However, the reasons underlying its success have not been thoroughly investigated. In this paper, we comprehensively analyze $k$NN-MT through theoretical and empirical studies. Initially, we provide new insights into the working mechanism of $k$NN-MT as an efficient technique to implicitly execute gradient descent on the output projection layer of NMT, indicating that it is a specific case of model fine-tuning. Subsequently, we conduct multi-domain experiments and word-level analysis to examine the differences in performance between $k$NN-MT and entire-model fine-tuning. Our findings suggest that: (1) Incorporating $k$NN-MT with adapters yields comparable translation performance to fine-tuning on in-domain test sets, while achieving better performance on out-of-domain test sets; (2) Fine-tuning significantly outperforms $k$NN-MT on the recall of in-domain low-frequency words, but this gap could be bridged by optimizing the context representations with additional adapter layers.
翻译:最近邻机器翻译($k$NN-MT)通过将预训练的神经机器翻译(NMT)模型与领域特定的词级检索相结合,在领域自适应任务中取得了巨大成功。然而,其成功背后的原因尚未得到深入研究。本文通过理论与实证研究,全面分析了$k$NN-MT。首先,我们揭示了$k$NN-MT工作机制的新见解:它是一种高效隐式执行NMT输出投影层梯度下降的技术,表明其是模型微调的一种特例。随后,我们进行了多领域实验和词级分析,以检验$k$NN-MT与全模型微调在性能上的差异。我们的发现表明:(1)将$k$NN-MT与适配器结合使用时,在领域内测试集上可获得与微调相当的翻译性能,同时在领域外测试集上表现更优;(2)微调在领域内低频词的召回率上显著优于$k$NN-MT,但通过使用额外的适配器层优化上下文表示,这一差距可以缩小。