揭示了多层Transformer中注意力头的分层涌现机制。
Mechanism and Emergence of Stacked Attention Heads in Multi-Layer Transformers
- 通过检索任务发现模型需至少对数级层数才能解决。
- 训练中注意力头按隐式课程顺序逐层出现。
- 无需微调,大模型在不同提示下即可完成复杂推理。
本文引入了检索问题,一种简单但常见的推理任务,仅当Transformer模型层数随输入规模对数增长时才可解决。实验表明,大型语言模型在不同提示形式下无需微调即可完成该任务。为理解其解题机制,作者在最小化设定下训练多个Transformer模型。成功学习仅在存在隐式课程条件下实现。通过分析训练后模型的注意力图,揭示了其内部工作机制。进一步研究训练过程发现,注意力头始终按照特定顺序涌现,由隐式课程引导。
原文摘要 · Abstract (English)
In this paper, I introduce the retrieval problem, a simple yet common reasoning task that can be solved only by transformers with a minimum number of layers, which grows logarithmically with the input size. I empirically show that large language models can solve the task under different prompting formulations without any fine-tuning. To understand how transformers solve the retrieval problem, I train several transformers on a minimal formulation. Successful learning occurs only under the presence of an implicit curriculum. I uncover the learned mechanisms by studying the attention maps in the trained transformers. I also study the training process, uncovering that attention heads always emerge in a specific sequence guided by the implicit curriculum.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。