$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.
翻译:$k$NN-MT是一种直接而强大的快速领域自适应方法,它将预训练的神经机器翻译(NMT)模型与领域特定的词级$k$-最近邻($k$NN)检索直接结合,无需重新训练即可实现领域自适应。尽管概念上具有吸引力,但$k$NN-MT由于需要在整个参考语料库上进行最近邻搜索,因此面临巨大的存储需求和高计算复杂度的负担。本文提出了一种简单且可扩展的最近邻机器翻译框架,在保持翻译性能的同时,显著提升了基于$k$NN模型的解码与存储效率。为此,我们通过句子级检索为每个输入动态构建一个极小的数据存储库,以避免在传统$k$NN-MT中搜索整个数据存储库,并在此基础上引入距离自适应适配器,以自适应地将$k$NN检索结果整合到预训练的NMT模型中。在静态领域自适应和在线学习两种通用场景下的机器翻译实验表明,我们提出的方法不仅在不损失性能的前提下实现了接近NMT模型90%的翻译速度,还大幅降低了$k$NN-MT的存储需求。