arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2410.20210cs.CLcs.LG
收藏

超越 Top-1 观察:Transformers 按顺序确定 Top Tokens

Looking Beyond The Top-1: Transformers Determine Top Tokens In Order

The Hebrew University of Jerusalem(耶路撒冷希伯来大学);The University of Chicago(芝加哥大学)

Daria Lioubashevski, Tomer Schlank, Gabriel Stanovsky, Ariel Goldstein

AI总结:

本文揭示 Transformers 按排名顺序依次确定 top-k tokens 的饱和现象,提出任务转换机制并加以验证,据此设计出更优的 token 级早退策略。

摘要:

理解 Transformers 的内部工作机制,对于实现更准确、更高效的预测至关重要。在本研究中,我们分析了在 top-1 预测已经固定之后,Transformers 在各层中执行的计算;这一时刻此前被称为“饱和事件”。我们将饱和事件的概念扩展到 top-k tokens,证明类似的饱和事件会出现在语言、视觉和语音模型中。我们发现,这些饱和事件按照相应 tokens 的排名顺序发生,即模型首先确定排名最高的 token,然后确定排名第二高的 token,依此类推。这一现象似乎是 Transformer 架构所固有的:它出现在不同架构变体中(decoder-only、encoder-only,以及程度较轻的 full-Transformer),甚至出现在未经训练的 Transformers 中。我们为这种顺序饱和提出了一种任务转换的底层机制,其中任务 k 对应于预测第 k 个最可能的 token,而饱和事件实际上是任务之间的离散转换。为支持这一点,我们表明可以根据隐藏层嵌入预测当前任务。此外,通过一种干预方法,我们证明可以使模型从一个任务切换到下一个任务。最后,利用这些发现,我们提出了一种新的 token 级早退策略,该策略在平衡性能与效率方面优于现有方法。

英文摘要:

Understanding the inner workings of Transformers is crucial for achieving more accurate and efficient predictions. In this work, we analyze the computation performed by Transformers in the layers after the top-1 prediction has become fixed, which has been previously referred to as the "saturation event". We expand the concept of saturation events for top-k tokens, demonstrating that similar saturation events occur across language, vision, and speech models. We find that these saturation events happen in order of the corresponding tokens' ranking, i.e., the model first decides on the top ranking token, then the second highest ranking token, and so on. This phenomenon seems intrinsic to the Transformer architecture, occurring across different architectural variants (decoder-only, encoder-only, and to a lesser extent full-Transformer), and even in untrained Transformers. We propose an underlying mechanism of task transition for this sequential saturation, where task k corresponds to predicting the k-th most probable token, and the saturation events are in fact discrete transitions between the tasks. In support of this we show that it is possible to predict the current task from hidden layer embedding. Furthermore, using an intervention method we demonstrate that we can cause the model to switch from one task to the next. Finally, leveraging our findings, we introduce a novel token-level early-exit strategy, which surpasses existing methods in balancing performance and efficiency.

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

↑