显式编码结构对称性是算术任务中长度泛化的关键
Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Tasks
AI总结:
本文针对Transformer在算术任务上的长度泛化失败问题,提出通过修改数字格式和自定义位置编码显式引入数字结构对称性,使模型能从5位数泛化至50位数,并从理论和实验上证明了显式编码结构的必要性。
摘要:
尽管 Transformers 在语言理解、代码生成和逻辑推理方面取得了成功,但它们在加法和乘法等基本算术任务上仍无法在长度上进行泛化。这种失败的一个主要原因是数字与文本在结构上的巨大差异;例如,数字通常从右向左解析,并且不同数字中相同位置上的数字之间存在对应关系。相比之下,对于文本,这种对称性是相当不自然的。在本研究中,我们提出通过修改数字格式和自定义位置编码将这些语义显式地编码到模型中。在实验上,我们的方法允许一个在最多 5 位数字上训练的 Transformer 进行加法和乘法,能够泛化到多达 50 位的数字,而无需为更长的序列使用额外数据。我们进一步证明,传统的绝对位置编码(APE)无法泛化到更长的序列,即使使用捕获任务对称性的增强数据进行训练也是如此。为了阐明显式编码结构的重要性,我们证明了通过位置编码显式地引入结构对于分布外泛化是必要的。最后,我们指出了长度泛化中固有的其他挑战,特别是底层任务的复杂性,并提出了训练分布的修改以解决这些挑战。
英文摘要:
Despite the success of Transformers on language understanding, code generation, and logical reasoning, they still fail to generalize over length on basic arithmetic tasks such as addition and multiplication. A major reason behind this failure is the vast difference in structure between numbers and text; For example, the numbers are typically parsed from right to left, and there is a correspondence between digits at the same position across different numbers. In contrast, for text, such symmetries are quite unnatural. In this work, we propose to encode these semantics explicitly into the model via modified number formatting and custom positional encodings. Empirically, our method allows a Transformer trained on numbers with at most 5-digits for addition and multiplication to generalize up to 50-digit numbers, without using additional data for longer sequences. We further demonstrate that traditional absolute positional encodings (APE) fail to generalize to longer sequences, even when trained with augmented data that captures task symmetries. To elucidate the importance of explicitly encoding structure, we prove that explicit incorporation of structure via positional encodings is necessary for out-of-distribution generalization. Finally, we pinpoint other challenges inherent to length generalization beyond capturing symmetries, in particular complexity of the underlying task, and propose changes in the training distribution to address them.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。