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

理解 Transformer 长度泛化的形式化框架

A Formal Framework for Understanding Length Generalization in Transformers

Saarland University(萨尔大学);University of Notre Dame(圣母大学);University of Oxford(牛津大学);Apple(苹果公司)

Xinting Huang, Andy Yang, Satwik Bhattamishra, Yash Sarrof, Andreas Krebs, Hattie Zhou, Preetum Nakkiran, Michael Hahn

AI总结:

本文引入了一个严格的理论框架,分析具有可学习绝对位置编码的因果 Transformer 的长度泛化问题,刻画了可识别函数并证明了其泛化可能性,且通过实验验证了该理论能有效预测长度泛化的成功与失败。

摘要:

transformer 面临的一个主要挑战是泛化到比训练时观察到的更长的序列。虽然先前的研究在经验上表明,transformer 在长度泛化方面可能成功或失败,具体取决于任务,但对这一现象的理论理解仍然有限。在本研究中,我们引入了一个严格的理论框架,以分析具有可学习绝对位置编码的因果 transformer 中的长度泛化。具体而言,我们刻画了在使用基于范数的正则化器的理想化推理方案下,那些可以通过绝对位置编码从足够长的输入中在极限情况下被识别的函数。这使我们能够证明对于一类丰富的问题存在长度泛化的可能性。我们在一系列算法和形式语言任务上通过实验验证了该理论作为长度泛化成功与失败预测指标的有效性。我们的理论不仅解释了大量的经验观察结果,还为可证明地预测 transformer 中的长度泛化能力开辟了道路。

英文摘要:

A major challenge for transformers is generalizing to sequences longer than those observed during training. While previous works have empirically shown that transformers can either succeed or fail at length generalization depending on the task, theoretical understanding of this phenomenon remains limited. In this work, we introduce a rigorous theoretical framework to analyze length generalization in causal transformers with learnable absolute positional encodings. In particular, we characterize those functions that are identifiable in the limit from sufficiently long inputs with absolute positional encodings under an idealized inference scheme using a norm-based regularizer. This enables us to prove the possibility of length generalization for a rich family of problems. We experimentally validate the theory as a predictor of success and failure of length generalization across a range of algorithmic and formal language tasks. Our theory not only explains a broad set of empirical observations but also opens the way to provably predicting length generalization capabilities in transformers.

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

↑