Non-parametric neural language models (NLMs) learn predictive distributions of text utilizing an external datastore, which allows them to learn through explicitly memorizing the training datapoints. While effective, these models often require retrieval from a large datastore at test time, significantly increasing the inference overhead and thus limiting the deployment of non-parametric NLMs in practical applications. In this paper, we take the recently proposed $k$-nearest neighbors language model (Khandelwal et al., 2019) as an example, exploring methods to improve its efficiency along various dimensions. Experiments on the standard WikiText-103 benchmark and domain-adaptation datasets show that our methods are able to achieve up to a 6x speed-up in inference speed while retaining comparable performance. The empirical analysis we present may provide guidelines for future research seeking to develop or deploy more efficient non-parametric NLMs.
翻译:非对称神经语言模型(NLMs)学习利用外部数据存储处的文字预测分布,从而通过明确记忆化培训数据点来学习,这些模型虽然有效,但往往需要从试验时的大数据储存处检索,从而大大增加了间接推断,从而限制了在实际应用中部署非对称NLM。在本文中,我们以最近提出的美元最近邻语言模型(Khandelwal等人,2019年)为例,探讨在各个方面提高效率的方法。关于标准Wikit-103基准和域适应数据集的实验表明,我们的方法能够在保持可比性能的同时达到最高6x加速的推断速度。我们介绍的经验分析可以为今后寻求开发或部署更有效非参数的NLMs的研究提供指导方针。