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

Transformer在不同深度下能学到什么?序列学习任务的案例研究

What Can Transformer Learn with Varying Depth? Case Studies on Sequence Learning Tasks

The University of Hong Kong(香港大学)

Xingwu Chen, Difan Zou

AI总结:

本文通过设计序列学习任务,系统研究了Transformer深度对其记忆、推理、泛化和上下文泛化能力的影响,发现不同能力所需的最小注意力层数不同,并指出复杂任务可由单层可执行的简单操作组合并通过堆叠多层注意力层解决。

摘要:

我们研究了不同深度下Transformer架构的能力。具体而言,我们设计了一组新颖的序列学习任务,以系统评估和理解Transformer的深度如何影响其执行记忆、推理、泛化和上下文泛化的能力。我们表明,仅具有一个注意力层的Transformer在记忆方面表现出色,但在其他任务上有所不足。然后,我们表明展现推理和泛化能力要求Transformer至少具有两个注意力层,而上下文泛化能力可能需要三个注意力层。此外,我们识别出一类单个注意力层可以执行的简单操作,并表明复杂任务可以视为这些简单操作的组合,因此可以通过堆叠多个注意力层来解决。这为研究超出我们设计的更实际和复杂的任务提供了启示。数值实验证实了我们的理论发现。

英文摘要:

We study the capabilities of the transformer architecture with varying depth. Specifically, we designed a novel set of sequence learning tasks to systematically evaluate and comprehend how the depth of transformer affects its ability to perform memorization, reasoning, generalization, and contextual generalization. We show a transformer with only one attention layer can excel in memorization but falls short in other tasks. Then, we show that exhibiting reasoning and generalization ability requires the transformer to have at least two attention layers, while context generalization ability may necessitate three attention layers. Additionally, we identify a class of simple operations that a single attention layer can execute, and show that the complex tasks can be approached as the combinations of these simple operations and thus can be resolved by stacking multiple attention layers. This sheds light on studying more practical and complex tasks beyond our design. Numerical experiments corroborate our theoretical findings.

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

↑