arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2103.07601cs.CLcs.AI
收藏

近似单头注意力如何学习

Approximating How Single Head Attention Learns

University of California, Berkeley(加州大学伯克利分校)

Charlie Snell, Ruiqi Zhong, Dan Klein, Jacob Steinhardt

摘要:

为什么模型经常关注突出的单词,这在整个训练过程中是如何演变的?我们将模型训练近似为两个阶段的过程:在训练的早期,当注意力权重是均匀的时,模型学习将单个输入单词‘i’翻译为‘o’,如果它们经常同时出现。稍后,模型学习关注“i”,而正确的输出是$o$,因为它知道“i”翻译为“o”。为了形式化,我们定义了一个模型属性,翻译单个单词的知识(KTIW)(例如,知道“i”翻译为“o”),并声称它驱动了注意力的学习。这一主张得到了以下事实的支持:在学习注意力机制之前,可以从单词共现统计中学习KTIW,但反之则不然。特别是,我们可以构建一个训练分布,使KTIW难以学习,注意力的学习失败,模型甚至无法学习将输入单词复制到输出的简单任务。我们的近似解释了为什么模型有时会注意到突出的单词,并激发了一个玩具例子,其中多头注意力模型可以通过改善学习动态而不是表达能力来克服上述困难的训练分布。最后,我们讨论我们的近似框架的局限性,并提出未来的发展方向。

英文摘要:

Why do models often attend to salient words, and how does this evolve throughout training? We approximate model training as a two stage process: early on in training when the attention weights are uniform, the model learns to translate individual input word `i` to `o` if they co-occur frequently. Later, the model learns to attend to `i` while the correct output is $o$ because it knows `i` translates to `o`. To formalize, we define a model property, Knowledge to Translate Individual Words (KTIW) (e.g. knowing that `i` translates to `o`), and claim that it drives the learning of the attention. This claim is supported by the fact that before the attention mechanism is learned, KTIW can be learned from word co-occurrence statistics, but not the other way around. Particularly, we can construct a training distribution that makes KTIW hard to learn, the learning of the attention fails, and the model cannot even learn the simple task of copying the input words to the output. Our approximation explains why models sometimes attend to salient words, and inspires a toy example where a multi-head attention model can overcome the above hard training distribution by improving learning dynamics rather than expressiveness. We end by discussing the limitation of our approximation framework and suggest future directions.

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

↑