knn-seq: Efficient, Extensible kNN-MT Framework

Hiroyuki Deguchi, Hayate Hirano, Tomoki Hoshino, Yuto Nishida, Justin Vasselli +1 more
10/18/2023
cs.CL

Official code: naist-nlp/knn-seq (19 stars, MIT, last commit 2024-09-07).

Abstract

k-nearest-neighbor machine translation (kNN-MT) boosts the translation quality of a pre-trained neural machine translation (NMT) model by utilizing translation examples during decoding. Translation examples are stored in a vector database, called a datastore, which contains one entry for each target token from the parallel data it is made from. Due to its size, it is computationally expensive both to construct and to retrieve examples from the datastore. In this paper, we present an efficient and extensible kNN-MT framework, knn-seq, for researchers and developers that is carefully designed to run efficiently, even with a billion-scale large datastore. knn-seq is developed as a plug-in on fairseq and easy to switch models and kNN indexes. Experimental results show that our implemented kNN-MT achieves a comparable gain to the original kNN-MT, and the billion-scale datastore construction took 2.21 hours in the WMT'19 German-to-English translation task. We publish our knn-seq as an MIT-licensed open-source project and the code is available on https://github.com/naist-nlp/knn-seq . The demo video is available on https://youtu.be/zTDzEOq80m0 .

View on arXivView PDF

Code Implementations(1)

naist-nlp/knn-seqOfficial100%
MIT

Efficient, Extensible kNN-MT Framework

191PythonAug 31, 20222 years agoMIT

Cite this paper

@article{deguchi2023knnseq,
  title  = {knn-seq: Efficient, Extensible kNN-MT Framework},
  author = {Hiroyuki Deguchi and Hayate Hirano and Tomoki Hoshino and Yuto Nishida and Justin Vasselli and Taro Watanabe},
  year   = {2023},
  eprint = {2310.12352},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.12352v1}
}

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/2310.12352.svg)](https://codeofpaper.com/paper/2310.12352)

Discussion