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

通过N-gram统计理解Transformer

Understanding Transformers via N-gram Statistics

Google DeepMind(谷歌DeepMind)

Timothy Nguyen

AI总结:

本文通过N-gram统计规则集近似Transformer预测,提出检测过拟合、量化学习进展的方法,并发现TinyStories和Wikipedia上79%和68%的top-1预测与规则集一致。

摘要:

基于Transformer的大型语言模型(LLM)在语言处理方面表现出极高的熟练度,但对其工作机制的精确理解仍然难以捉摸。揭示Transformer预测机制的一种方法是,根据简单的模板函数来描述其预测如何依赖于上下文。本文朝这一方向迈出了第一步,考虑了由训练数据的简单N-gram统计形成的函数族(即规则)。通过研究这些规则集在多大程度上近似Transformer的预测,我们获得了多种新发现:一种无需使用保留集即可在训练过程中检测过拟合的简单方法;一种量化Transformer在训练过程中从学习简单规则到更复杂统计规则的进展的度量;一个决定Transformer预测何时倾向于由N-gram规则描述的模型方差准则;以及关于在规则集变得日益复杂的极限情况下,Transformer能被N-gram规则集近似到何种程度的见解。在后一方向上,我们发现,在TinyStories和Wikipedia上,分别有79%和68%的LLM下一个词元分布中,其top-1预测与我们的N-gram规则集提供的预测一致。

英文摘要:

Transformer based large-language models (LLMs) display extreme proficiency with language yet a precise understanding of how they work remains elusive. One way of demystifying transformer predictions would be to describe how they depend on their context in terms of simple template functions. This paper takes a first step in this direction by considering families of functions (i.e. rules) formed out of simple N-gram based statistics of the training data. By studying how well these rulesets approximate transformer predictions, we obtain a variety of novel discoveries: a simple method to detect overfitting during training without using a holdout set, a quantitative measure of how transformers progress from learning simple to more complex statistical rules over the course of training, a model-variance criterion governing when transformer predictions tend to be described by N-gram rules, and insights into how well transformers can be approximated by N-gram rulesets in the limit where these rulesets become increasingly complex. In this latter direction, we find that for 79% and 68% of LLM next-token distributions on TinyStories and Wikipedia, respectively, their top-1 predictions agree with those provided by our N-gram rulesets.

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

↑