上下文计数:Transformer在定量任务上的机制研究
Contextual Counting: A Mechanistic Study of Transformers on a Quantitative Task
AI总结:
本文提出上下文计数任务以研究Transformer在定量场景下的行为,通过理论与实证分析发现因果注意力及无位置嵌入表现最佳,且分布外性能与偏置词元选择紧密相关。
摘要:
Transformer在多个领域彻底改变了机器学习,但理解其行为依然至关重要,特别是在高风险应用中。本文引入了上下文计数任务,这是一个旨在增强我们对Transformer在定量和科学语境下理解的全新玩具问题。该任务要求在数据集中进行精确定位与计算,类似于目标检测或基于区域的科学分析。我们使用因果和非因果Transformer架构进行了理论与实证分析,研究了各种位置编码对性能和可解释性的影响。具体而言,我们发现因果注意力更适合该任务,并且无位置嵌入能带来最佳准确率,尽管旋转位置编码具有竞争力且更易训练。我们还表明,分布外性能与其用作偏置项的词元紧密相关。
英文摘要:
Transformers have revolutionized machine learning across diverse domains, yet understanding their behavior remains crucial, particularly in high-stakes applications. This paper introduces the contextual counting task, a novel toy problem aimed at enhancing our understanding of Transformers in quantitative and scientific contexts. This task requires precise localization and computation within datasets, akin to object detection or region-based scientific analysis. We present theoretical and empirical analysis using both causal and non-causal Transformer architectures, investigating the influence of various positional encodings on performance and interpretability. In particular, we find that causal attention is much better suited for the task, and that no positional embeddings lead to the best accuracy, though rotary embeddings are competitive and easier to train. We also show that out of distribution performance is tightly linked to which tokens it uses as a bias term.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。