Augmenting the base neural model with a token-level symbolic datastore is a novel generation paradigm and has achieved promising results in machine translation (MT). In this paper, we introduce a unified framework kNN-BOX, which enables quick development and interactive analysis for this novel paradigm. kNN-BOX decomposes the datastore-augmentation approach into three modules: datastore, retriever and combiner, thus putting diverse kNN generation methods into a unified way. Currently, kNN-BOX has provided implementation of seven popular kNN-MT variants, covering research from performance enhancement to efficiency optimization. It is easy for users to reproduce these existing works or customize their own models. Besides, users can interact with their kNN generation systems with kNN-BOX to better understand the underlying inference process in a visualized way. In the experiment section, we apply kNN-BOX for machine translation and three other seq2seq generation tasks, namely, text simplification, paraphrase generation and question generation. Experiment results show that augmenting the base neural model with kNN-BOX leads to a large performance improvement in all these tasks. The code and document of kNN-BOX is available at https://github.com/NJUNLP/knn-box.
翻译:在基础神经模型上引入token级符号数据存储是一种新型生成范式,已在机器翻译领域取得显著成果。本文提出统一框架kNN-BOX,支持该新范式的快速开发与交互分析。该框架将数据存储增强方法分解为数据存储、检索器和组合器三个模块,从而将多种kNN生成方法整合为统一范式。目前kNN-BOX已实现七种主流kNN-MT变体,涵盖从性能提升到效率优化的研究方案。用户可便捷复现现有工作或定制个性化模型,同时可通过kNN-BOX与kNN生成系统进行可视化交互,深入理解底层推理过程。实验部分将kNN-BOX应用于机器翻译及文本简化、复述生成、问题生成三项序列到序列生成任务,结果表明基于kNN-BOX增强的基础神经模型在所有任务中均实现显著性能提升。kNN-BOX的代码与文档已开源至https://github.com/NJUNLP/knn-box。