arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2307.03381cs.LG
收藏

向小型Transformer教授算术

Teaching Arithmetic to Small Transformers

University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Princeton University(普林斯顿大学)

Nayoung Lee, Kartik Sreenivasan, Jason D. Lee, Kangwook Lee, Dimitris Papailiopoulos

AI总结:

本文研究小型Transformer如何通过下一词预测目标高效学习算术,发现改进数据格式和采用思维链风格数据能显著提升准确率、样本效率与收敛速度,并揭示了与低秩矩阵补全相关的相变现象。

摘要:

像GPT-4这样的大型语言模型,在大量文本数据上训练时,尽管无监督的下一词预测目标并未显式编码这些任务,却能在基础算术等通用任务上展现出涌现能力。本研究探讨了从随机初始化开始训练的小型Transformer,如何利用下一词预测目标高效地学习加法、乘法等算术运算以及平方根等初等函数。我们首先证明,传统训练数据对于算术学习并非最有效,简单的格式改变就能显著提高准确率。这导致了作为训练数据规模函数的尖锐相变现象,在某些情况下,可以通过与低秩矩阵补全的联系加以解释。在先前工作的基础上,我们随后在包含中间步骤结果的思维链风格数据上进行训练。即使完全没有预训练,这种方法也能同时显著提高准确率、样本复杂度和收敛速度。我们还研究了训练过程中算术数据与文本数据之间的相互作用,并考察了少样本提示、预训练和模型规模的影响。此外,我们讨论了长度泛化方面的挑战。我们的工作强调了高质量、具有指导性的数据的重要性,这些数据考虑了下一词预测目标的特定特征,从而能够快速激发算术能力。

英文摘要:

Large language models like GPT-4 exhibit emergent capabilities across general-purpose tasks, such as basic arithmetic, when trained on extensive text data, even though these tasks are not explicitly encoded by the unsupervised, next-token prediction objective. This study investigates how small transformers, trained from random initialization, can efficiently learn arithmetic operations such as addition, multiplication, and elementary functions like square root, using the next-token prediction objective. We first demonstrate that conventional training data is not the most effective for arithmetic learning, and simple formatting changes can significantly improve accuracy. This leads to sharp phase transitions as a function of training data scale, which, in some cases, can be explained through connections to low-rank matrix completion. Building on prior work, we then train on chain-of-thought style data that includes intermediate step results. Even in the complete absence of pretraining, this approach significantly and simultaneously improves accuracy, sample complexity, and convergence speed. We also study the interplay between arithmetic and text data during training and examine the effects of few-shot prompting, pretraining, and model scale. Additionally, we discuss length generalization challenges. Our work highlights the importance of high-quality, instructive data that considers the particular characteristics of the next-word prediction objective for rapidly eliciting arithmetic capabilities.

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

↑