arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.12973cs.CLcs.LG
收藏

上下文内语言学习:架构与算法

In-Context Language Learning: Architectures and Algorithms

MIT CSAIL(麻省理工学院计算机科学与人工智能实验室)

Ekin Akyürek, Bailin Wang, Yoon Kim, Jacob Andreas

AI总结:

该研究提出上下文内语言学习(ICLL)任务,研究发现Transformer在该任务上表现优于其他序列模型,其能力依赖n-gram头,硬连接该头可同时提升ICLL和自然语言建模效果。

摘要:

大规模神经语言模型展现出卓越的上下文内学习(ICL)能力:它们能够从作为输入提供的数据集推断出新的函数。目前我们对ICL何时出现以及如何出现的大多数认知,都来自于在极其简单的学习问题(如线性回归和联想回忆)上训练的语言模型。这些模型问题与在大规模文本语料库上训练的语言模型所展现的“真实”ICL之间仍存在显著差距,后者不仅涉及检索和函数逼近,还包括语言和其他结构化输出的自由形式生成。在本文中,我们通过一类我们称之为上下文内语言学习(ICLL)的新型模型问题来研究ICL。在ICLL任务中,语言模型会接收到来自某一形式语言的一组字符串,并且必须生成来自同一语言的更多字符串。我们重点研究由随机有限自动机生成的正则语言的上下文内学习。我们在正则ICLL任务上评估了多种不同的神经序列模型(包括多种RNN、Transformer以及状态空间模型变体),旨在回答三个问题:(1)哪些模型类别在实证上具备ICLL能力?(2)表现成功的模型采用了什么样的算法解决方案来执行ICLL?(3)哪些架构改进能够提升表现较差模型的ICLL能力?我们首先证明,在ICLL任务上,Transformer的表现显著优于带有循环或卷积表示的神经序列模型。接下来,我们提供证据表明,Transformer的这一能力依赖于专门的“n-gram头”(归纳头的高阶变体),这些头计算基于输入条件的下一词元分布。最后,我们证明,将这些头硬连接到神经模型中,不仅能提升ICLL任务的表现,还能改善自然语言建模效果——在SlimPajama数据集上,将3.4亿参数模型的困惑度最多降低了1.14点(6.7%)。

英文摘要:

Large-scale neural language models exhibit a remarkable capacity for in-context learning (ICL): they can infer novel functions from datasets provided as input. Most of our current understanding of when and how ICL arises comes from LMs trained on extremely simple learning problems like linear regression and associative recall. There remains a significant gap between these model problems and the "real" ICL exhibited by LMs trained on large text corpora, which involves not just retrieval and function approximation but free-form generation of language and other structured outputs. In this paper, we study ICL through the lens of a new family of model problems we term in context language learning (ICLL). In ICLL, LMs are presented with a set of strings from a formal language, and must generate additional strings from the same language. We focus on in-context learning of regular languages generated by random finite automata. We evaluate a diverse set of neural sequence models (including several RNNs, Transformers, and state-space model variants) on regular ICLL tasks, aiming to answer three questions: (1) Which model classes are empirically capable of ICLL? (2) What algorithmic solutions do successful models implement to perform ICLL? (3) What architectural changes can improve ICLL in less performant models? We first show that Transformers significantly outperform neural sequence models with recurrent or convolutional representations on ICLL tasks. Next, we provide evidence that their ability to do so relies on specialized "n-gram heads" (higher-order variants of induction heads) that compute input-conditional next-token distributions. Finally, we show that hard-wiring these heads into neural models improves performance not just on ICLL, but natural language modeling -- improving the perplexity of 340M-parameter models by up to 1.14 points (6.7%) on the SlimPajama dataset.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑