K-Nearest Neighbor Neural Machine Translation (kNN-MT) successfully incorporates external corpus by retrieving word-level representations at test time. Generally, kNN-MT borrows the off-the-shelf context representation in the translation task, e.g., the output of the last decoder layer, as the query vector of the retrieval task. In this work, we highlight that coupling the representations of these two tasks is sub-optimal for fine-grained retrieval. To alleviate it, we leverage supervised contrastive learning to learn the distinctive retrieval representation derived from the original context representation. We also propose a fast and effective approach to constructing hard negative samples. Experimental results on five domains show that our approach improves the retrieval accuracy and BLEU score compared to vanilla kNN-MT.
翻译:K- Nearest Neearbor Neural 机器翻译 (kNN-MT) 通过在测试时检索字级表达方式成功地整合了外部内容。 一般来说, kNN- MT 借用了翻译任务中现成的背景表达方式, 例如, 最后解码层的输出, 作为检索任务的查询矢量 。 在这项工作中, 我们强调, 将这两项任务的表达方式合并起来对于精细的检索来说是次优的。 为了减轻这一影响, 我们利用监督的对比性学习来学习从原始背景表达方式中得出的独特检索表达方式。 我们还提出了一个快速而有效的方法来构建硬负样本。 五个领域的实验结果显示, 我们的方法提高了检索的准确性和比 Vanilla kNN- MT 的 BLEU 分数。