Injecting external knowledge can improve the performance of pre-trained language models (PLMs) on various downstream NLP tasks. However, massive retraining is required to deploy new knowledge injection methods or knowledge bases for downstream tasks. In this work, we are the first to study how to improve the flexibility and efficiency of knowledge injection by reusing existing downstream models. To this end, we explore a new paradigm plug-and-play knowledge injection, where knowledge bases are injected into frozen existing downstream models by a knowledge plugin. Correspondingly, we propose a plug-and-play injection method map-tuning, which trains a mapping of knowledge embeddings to enrich model inputs with mapped embeddings while keeping model parameters frozen. Experimental results on three knowledge-driven NLP tasks show that existing injection methods are not suitable for the new paradigm, while map-tuning effectively improves the performance of downstream models. Moreover, we show that a frozen downstream model can be well adapted to different domains with different mapping networks of domain knowledge. Our code and models are available at https://github.com/THUNLP/Knowledge-Plugin.
翻译:注入外部知识可以提升预训练语言模型(PLMs)在各种下游自然语言处理(NLP)任务中的性能。然而,针对下游任务部署新的知识注入方法或知识库通常需要大量的重新训练。本文首次研究了如何通过复用现有下游模型来提高知识注入的灵活性和效率。为此,我们探索了一种新范式——即插即用知识注入,其中知识库通过知识插件注入到冻结的现有下游模型中。相应地,我们提出了一种即插即用的注入方法——映射调优(map-tuning),该方法通过训练知识嵌入的映射来丰富模型输入,同时保持模型参数冻结。在三个知识驱动的NLP任务上的实验结果表明,现有注入方法不适用于新范式,而映射调优能有效提升下游模型的性能。此外,我们证明了一个冻结的下游模型可以通过不同的领域知识映射网络很好地适应不同领域。我们的代码和模型可在 https://github.com/THUNLP/Knowledge-Plugin 获取。