基于检索的语言模型(R-LM)通过将标准语言模型(LM)与在测试时从外部数据存储中检索的示例结合使用自然语言文本的概率。虽然有效,但在实践中使用这些模型的主要瓶颈是计算昂贵的数据存储搜索,可以像每个时间步骤一样频繁地执行。在本文中,我们提出了retomaton-检索自动机 - 基于(1)在连续的数据存储条目之间保存指针,以及(2)将条目聚类到“状态”中。这有效地导致了在数据存储顶部构建的加权有限自动机,而不是将数据存储表示为平面列表。自动机的创建是无监督的,可以从任何文本集合中构造一个retomaton:原始训练语料库或另一个域。在推理时与LM推理并行遍历此自动机,将其困惑降低到1.85,或者可节省多达$ k $ nn-lm的最近邻居搜索的83%(Khandelwal等,2020年,没有),没有伤害困惑。我们的代码和训练有素的模型可在https://github.com/neulab/retomaton上找到。
translated by 谷歌翻译
非参数神经语言模型(NLMS)学习利用外部数据存储的预测性的文本分布,这允许他们通过显式记忆训练数据点来学习。虽然有效,这些模型通常需要从测试时间的大型数据存储中检索,从而显着增加推断开销,从而限制了在实际应用中的非参数NLMS的部署。在本文中,我们采取最近提出的$ k $-n $邻居语言模型(Khandelwal等,2020),例如探索沿各种尺寸提高其效率的方法。标准Wikitext-103基准和域 - 适应数据集的实验表明,我们的方法能够在推理速度的推动速度上实现高达6倍,同时保留可比性。我们所呈现的实证分析可以为未来的研究指导提供寻求开发或部署更高效的非参数NLM的指导。
translated by 谷歌翻译
Semi-parametric models, which augment generation with retrieval, have led to impressive results in language modeling and machine translation, due to their ability to retrieve fine-grained information from a datastore of examples. One of the most prominent approaches, $k$NN-MT, exhibits strong domain adaptation capabilities by retrieving tokens from domain-specific datastores \citep{khandelwal2020nearest}. However, $k$NN-MT requires an expensive retrieval operation for every single generated token, leading to a very low decoding speed (around 8 times slower than a parametric model). In this paper, we introduce a \textit{chunk-based} $k$NN-MT model which retrieves chunks of tokens from the datastore, instead of a single token. We propose several strategies for incorporating the retrieved chunks into the generation process, and for selecting the steps at which the model needs to search for neighbors in the datastore. Experiments on machine translation in two settings, static and ``on-the-fly'' domain adaptation, show that the chunk-based $k$NN-MT model leads to significant speed-ups (up to 4 times) with only a small drop in translation quality.
translated by 谷歌翻译
在这项工作中,由{\它复制的概念更容易记住}的概念,我们介绍了GNN-LM,它通过允许在整个训练语料库中引用类似的上下文来扩展Vanilla神经语言模型(LM)。我们在输入上下文和从训练语料库中选择的语义相关邻居之间构建一个定向的异构图,其中节点是输入上下文中的令牌和检索到的邻居上下文,并且边缘表示节点之间的连接。图形神经网络(GNNS)在图表上构建,以聚合来自类似上下文的信息来解码令牌。此学习范例提供了直接访问参考上下文,并有助于提高模型的泛化能力。我们进行全面的实验以验证GNN-LM的有效性:GNN-LM在Wikitext-103上实现了14.8的新的最先进的困惑(在Vanilla LM模型的对应于的4.5点改进)和显示对强大基线的十亿个单词和enWiki8数据集进行大量改进。进行深度消融研究以了解GNN-LM的机制。可以在\ url {https://github.com/shannonai/gnn-lm}中找到代码}
translated by 谷歌翻译
基于$ K $ NN的神经电机翻译($ K $ NN-MT)已经实现了最先进的MT任务。 $ k $ nn-mt的一个重要缺点在于识别来自整个数据存储的查询表示的$ k $最近邻居的效率低下,这在数据存储大小大的情况下是毫无疑问的。在这项工作中,我们提出\ TextBF {更快$ k $ nn-mt}来解决这个问题。更快的k $ nn-mt的核心思想是使用分层聚类策略来近似数据存储区中的查询和数据点之间的距离,该数据点被分解为两个部分:查询与中心之间的距离群集数据点属于,以及数据点与群集中心之间的距离。我们提出了实际的方法来以明显更快的方式计算这两个部分。通过对不同的MT基准测试的大量实验,我们展示了\ TextBF {更快$ K $ NN-MT}速度快于Fast $ K $ NN-MT \ CITEP {Meng2021Fast},只略微(1.2次)比其香草对应物慢保持模型性能为$ k $ nn-mt。更快$ k $ nn-mt,可以在现实世界MT服务上部署$ K $ NN-MT模型。
translated by 谷歌翻译
Recent work has improved language models (LMs) remarkably by equipping them with a non-parametric memory component. However, most existing approaches only introduce mem-ories at testing time or represent them using a separately trained encoder, resulting in suboptimal training of the language model. In this work, we present TRIME, a novel yet simple training approach designed for training LMs with memory augmentation. Our approach uses a training objective that directly takes in-batch examples as accessible memory. We also present new methods for memory construction and data batching, which are used for adapting to different sets of memories--local, long-term, and external memory--at testing time. We evaluate TRIME on multiple language modeling and machine translation benchmarks and show that it is able to achieve significant improvements across all the settings. Concretely, TRIME reduces the perplexity from 18.70 to 15.37 on WIKITEXT-103, by effectively leveraging a large memory set from the training corpus. Compared to standard LM training, TRIME adds negligible computational overhead and is compatible with different neural architectures, making it a versatile solution for training memory-augmented LMs.
translated by 谷歌翻译
kNN-MT presents a new paradigm for domain adaptation by building an external datastore, which usually saves all target language token occurrences in the parallel corpus. As a result, the constructed datastore is usually large and possibly redundant. In this paper, we investigate the interpretability issue of this approach: what knowledge does the NMT model need? We propose the notion of local correctness (LAC) as a new angle, which describes the potential translation correctness for a single entry and for a given neighborhood. Empirical study shows that our investigation successfully finds the conditions where the NMT model could easily fail and need related knowledge. Experiments on six diverse target domains and two language-pairs show that pruning according to local correctness brings a light and more explainable memory for kNN-MT domain adaptation.
translated by 谷歌翻译
我们研究了在循环机器翻译中对人体反馈的在线学习问题,其中人类翻译人员修改了机器生成的翻译,然后使用校正的翻译来改善神经电机翻译(NMT)系统。然而,以前的方法需要在线模型更新或额外的翻译记忆网络来实现高质量的性能,使它们在实践中不灵活和效率低下。在本文中,我们提出了一种新颖的非参数在线学习方法而不改变模型结构。这种方法引入了两个K-Cirelte-邻(KNN)模块:一个模块记住了人类反馈,这是人类翻译人员提供的正确句子,而另一个模块是自适应地平衡历史人体反馈和原始NMT模型的使用。在EMEA和JRC-ACQUIS基准上进行的实验表明,我们所提出的方法对翻译准确性的大量改进,并通过更少的人力校正操作实现更好的适应性能。
translated by 谷歌翻译
Causal language modeling (LM) uses word history to predict the next word. BERT, on the other hand, makes use of bi-directional word information in a sentence to predict words at masked positions. While BERT is effective in sequence encoding, it is non-causal by nature and is not designed for sequence generation. In this paper, we propose a novel language model, SUffix REtrieval-Augmented LM (SUREALM), that simulates a bi-directional contextual effect in an autoregressive manner. SUREALM employs an embedding retriever to search for training sentences in a data store that share similar word history during sequence generation. In particular, the suffix portions of the retrieved sentences mimick the "future" context. We evaluated our proposed model on the DSTC9 spoken dialogue corpus and showed promising word perplexity reduction on the validation and test set compared to competitive baselines.
translated by 谷歌翻译
端到端语音翻译(E2E-ST)由于其误差传播的潜力,较低的延迟和较少的参数而受到了越来越多的关注。但是,基于神经的方法对该任务的有效性受到可用培训语料库的严重限制,尤其是对于较少或不存在的域中三重障碍培训数据的领域适应性。在本文中,我们提出了一种新型的非参数方法,该方法利用特定于域的文本翻译语料库来实现E2E-ST系统的域适应性。为此,我们首先将一个附加的编码器纳入预先训练的E2E-ST模型中,以实现文本翻译建模,然后通过减少可用三重态训练数据中的通讯表示不匹配来统一解码器的输出表示形式,以实现文本和语音翻译任务。在域适应过程中,引入了K-Nearest-neighbor(KNN)分类器,以使用由域特异性文本翻译语料库构建的外部数据存储器生成最终的翻译分布,而采用通用输出表示来执行相似性搜索。 Europarl-St基准的实验表明,仅涉及内域文本翻译数据时,我们提出的方法在所有翻译方向上平均将基线显着提高了基线,即使表现出强大的强度内域微调方法。
translated by 谷歌翻译
我们通过与与前面令牌的局部相似度,通过调节从大语料库检索的文档块来增强自动回归语言模型。尽管使用25美元\时分,我们的检索增强型变压器(RetroCro)的检索增强型变压器(RetroCr)对GPT-3和侏罗纪-1获得了可比性的性能。微调后,复古表演转换为下游知识密集型任务,如问题应答。复古结合了冷冻BERT猎犬,一种可微分的编码器和块状的横向机制,以预测基于数量级的令牌,而不是训练期间通常消耗的数量。我们通常从头开始训练复古,还可以快速改造预先接受的变压器,通过检索,仍然达到良好的性能。我们的工作通过以前所未有的规模开辟了通过显式内存改进语言模型的新途径。
translated by 谷歌翻译
大型语言模型在各种任务上显示出令人印象深刻的几次结果。但是,当知识是此类结果的关键时,就像问题回答和事实检查之类的任务一样,似乎需要存储知识的大量参数计数。众所周知,检索增强模型可以在不需要多个参数的情况下在知识密集的任务上表现出色,但是目前尚不清楚它们是否在几个弹药设置中工作。在这项工作中,我们介绍了地图集,这是一个经过精心设计和预先训练的增强语言模型,能够通过很少的培训示例学习知识密集型任务。我们对包括MMLU,苏格兰短裙和归类等各种任务进行评估,并研究文档索引内容的影响,表明它可以很容易地进行更新。值得注意的是,在自然问题上仅使用64个示例在自然问题上达到超过42 \%的准确性,尽管参数少了50倍,但比540B参数模型的表现优于540b参数模型。
translated by 谷歌翻译
Existing language models (LMs) predict tokens with a softmax over a finite vocabulary, which can make it difficult to predict rare tokens or phrases. We introduce NPM, the first nonparametric masked language model that replaces this softmax with a nonparametric distribution over every phrase in a reference corpus. We show that NPM can be efficiently trained with a contrastive objective and an in-batch approximation to full corpus retrieval. Zero-shot evaluation on 9 closed-set tasks and 7 open-set tasks demonstrates that NPM outperforms significantly larger parametric models, either with or without a retrieve-and-generate approach. It is particularly better on dealing with rare patterns (word senses or facts), and predicting rare or nearly unseen words (e.g., non-Latin script). We release the model and code at github.com/facebookresearch/NPM.
translated by 谷歌翻译
The word alignment task, despite its prominence in the era of statistical machine translation (SMT), is niche and under-explored today. In this two-part tutorial, we argue for the continued relevance for word alignment. The first part provides a historical background to word alignment as a core component of the traditional SMT pipeline. We zero-in on GIZA++, an unsupervised, statistical word aligner with surprising longevity. Jumping forward to the era of neural machine translation (NMT), we show how insights from word alignment inspired the attention mechanism fundamental to present-day NMT. The second part shifts to a survey approach. We cover neural word aligners, showing the slow but steady progress towards surpassing GIZA++ performance. Finally, we cover the present-day applications of word alignment, from cross-lingual annotation projection, to improving translation.
translated by 谷歌翻译
尽管蒙版语言模型具有高度性能,并且被NLP从业人员广泛采用,但它们不能轻易用于自回归语言建模(下一个单词预测和序列概率估计)。我们提出了一种基于LSTM的自回归语言模型,该模型使用融合(例如串联)使用前缀嵌入(来自验证的蒙版语言模型),以获得语言建模的更丰富的上下文表示。我们发现Fusion有助于可靠地降低困惑(16.74 $ \ rightarrow $ 15.80),甚至在从与培训数据的不同领域传输到数据集后,它甚至可以保留。我们还通过将其下一个单词的惊人估计与人类阅读时间相关联,评估了表现最佳的融合模型。与我们的期望相矛盾,尽管整体上的困惑程度有所改善,但相关性仍然与基线模型相同。最后,尽管我们专注于在文本上预先训练的语言模型作为融合的来源,但我们的方法可能会扩展到将表示为固定尺寸矢量表示的任何信息融合到自动回归语言模型中。这些包括例如句子外部信息是为知识库或多模式编码器的表示形式检索的。
translated by 谷歌翻译
如何根据新出现的情况有效地调整神经电机翻译(NMT)模型而不会再培训?尽管神经机翻译成功,但更新部署的型号在线仍然是一个挑战。现有的非参数方法从数据库中检索类似的示例以指导翻译过程是有希望的,但容易被检索到的示例过度。在这项工作中,我们建议使用示例检索(Kster)进行内核平滑的翻译,这是一种在线调整神经计算机翻译模型的有效方法。域适应和多域机平移数据集的实验表明,即使没有昂贵的再培训,Kster也能够通过最佳现有在线适应方法实现1.1至1.5 BLEU分数的提高。代码和培训的型号在https://github.com/jiangqn/kster发布。
translated by 谷歌翻译
测序技术容易出错,对下游应用程序进行纠错(EC)。需要手动配置EC工具以获得最佳性能。我们发现最佳参数(例如,k-mer大小)是依赖于工具和数据集。此外,评估给定工具的性能(即,对准速率或增益)通常依赖于参考基因组,但是质量参考基因组并不总是可用的。我们介绍了基于K-MEC的自动配置的Lerna。 Lerna首先创建未校正的基因组读取的语言模型(LM);然后,计算困惑度量以评估不同参数选择的校正读取。接下来,在不使用参考基因​​组的情况下发现产生最高对准率的那个。我们的方法的基本直觉是困惑度量与纠错后的组件的质量与组件的质量相反。结果:首先,我们表明,即使对于相同的EC工具,不同的数据集也可以对不同的数据集格变化。其次,我们使用其组件基于关注的变压器显示了我们的LM的收益。我们展示了误差校正前后困惑度量的模型的估计。校正后的困惑越低,k-mer大小越好。我们还表明,用于校正读取的对准率和组装质量与困惑强烈地呈负相关,从而实现了k-mer值的自动选择以获得更好的纠错,因此改善的组装质量。此外,我们表明我们的注意力模型对于整个管道的重大运行时间改善 - 由于并行化注意机制和JIT编译对GPU推理的使用JIT编译,因此整个管道的运行时间更快。
translated by 谷歌翻译
随着新趋势影响在线讨论,用户生成的社交媒体数据正在不断变化,从而导致社交媒体NLP应用程序的测试数据分布变化。此外,随着用户数据删除,培训数据通常可能会更改。当前的大多数NLP系统都是静态的,并且依赖固定培训数据。结果,他们无法在没有频繁,昂贵的重新训练的情况下适应时间变化 - 既包括测试分配变化又删除了培训数据。在本文中,我们通过纵向主题标签预测的任务来研究时间适应,并提出一种非参数技术作为一种简单但有效的解决方案:非参数分类器使用可以更新的数据存储器,以适应测试分配移位或培训数据删除,无需重新训练。我们发布了一个新的基准数据集,该数据集由2021年的713m推文以及它们的主题标签组成,分为连续的颞桶。我们将需要重新训练进行适应的参数神经主题标签分类和标签生成模型与非参数,无训练的密集检索方法进行了比较,该方法基于文本嵌入距离返回最近的邻居的主题标签。在我们的纵向Twitter数据集的实验中,我们发现密集的邻居检索的相对性能增益比测试集的最佳参数基线的相对性能增长率为64.12%,该测试集的表现出分布移位而不需要基于梯度的重新训练。此外,我们表明我们的数据存储方法特别适合动态删除的用户数据,并具有可忽略的计算成本和性能损失。我们的新颖基准数据集和实证分析可以支持未来对现实世界用户数据中AI系统部署时的重要挑战的研究。
translated by 谷歌翻译
We introduce a new type of deep contextualized word representation that models both (1) complex characteristics of word use (e.g., syntax and semantics), and (2) how these uses vary across linguistic contexts (i.e., to model polysemy). Our word vectors are learned functions of the internal states of a deep bidirectional language model (biLM), which is pretrained on a large text corpus. We show that these representations can be easily added to existing models and significantly improve the state of the art across six challenging NLP problems, including question answering, textual entailment and sentiment analysis. We also present an analysis showing that exposing the deep internals of the pre-trained network is crucial, allowing downstream models to mix different types of semi-supervision signals.
translated by 谷歌翻译
Transfer learning, where a model is first pre-trained on a data-rich task before being finetuned on a downstream task, has emerged as a powerful technique in natural language processing (NLP). The effectiveness of transfer learning has given rise to a diversity of approaches, methodology, and practice. In this paper, we explore the landscape of transfer learning techniques for NLP by introducing a unified framework that converts all text-based language problems into a text-to-text format. Our systematic study compares pre-training objectives, architectures, unlabeled data sets, transfer approaches, and other factors on dozens of language understanding tasks. By combining the insights from our exploration with scale and our new "Colossal Clean Crawled Corpus", we achieve state-of-the-art results on many benchmarks covering summarization, question answering, text classification, and more. To facilitate future work on transfer learning for NLP, we release our data set, pre-trained models, and code.
translated by 谷歌翻译