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

不种树而学习句法:理解 Transformer 中的层级泛化

Learning Syntax Without Planting Trees: Understanding Hierarchical Generalization in Transformers

University of Washington(华盛顿大学);Carnegie Mellon University(卡内基梅隆大学);Microsoft Research(微软研究院);Allen Institute for AI(艾伦人工智能研究所)

Kabir Ahuja, Vidhisha Balachandran, Madhur Panwar, Tianxing He, Noah A. Smith, Navin Goyal, Yulia Tsvetkov

AI总结:

本文通过合成数据集、训练目标对比、剪枝实验和贝叶斯分析,揭示语言建模目标促使 Transformer 形成层级句法泛化偏置。

摘要:

已有研究表明,在自然语言数据上训练的 Transformer 能够学习其层级结构,并在没有显式编码任何结构偏置的情况下,泛化到具有未见句法结构的句子。在本工作中,我们研究 transformer 模型及其训练中归纳偏置的来源,这些偏置可能导致此类泛化行为出现。我们对在多个合成数据集上、以不同训练目标训练的 transformer 模型进行了大量实验,结果表明,尽管其他目标(例如序列到序列建模、前缀语言建模)往往无法带来层级泛化,但使用语言建模目标训练的模型始终能够学会进行层级泛化。随后,我们开展剪枝实验,以研究使用语言建模目标训练的 transformer 如何编码层级结构。剪枝后,我们发现模型内部同时存在具有不同泛化行为的子网络(分别对应层级结构和线性顺序的子网络)。最后,我们采用贝叶斯视角进一步揭示 transformer 对层级泛化的偏好:我们建立了一种相关性,即 transformer 是否在某个数据集上进行层级泛化,与该数据集的最简解释是否由层级语法(而非表现出线性泛化的正则语法)给出相关。

英文摘要:

Transformers trained on natural language data have been shown to learn its hierarchical structure and generalize to sentences with unseen syntactic structures without explicitly encoding any structural bias. In this work, we investigate sources of inductive bias in transformer models and their training that could cause such generalization behavior to emerge. We extensively experiment with transformer models trained on multiple synthetic datasets and with different training objectives and show that while other objectives e.g. sequence-to-sequence modeling, prefix language modeling, often failed to lead to hierarchical generalization, models trained with the language modeling objective consistently learned to generalize hierarchically. We then conduct pruning experiments to study how transformers trained with the language modeling objective encode hierarchical structure. When pruned, we find joint existence of subnetworks within the model with different generalization behaviors (subnetworks corresponding to hierarchical structure and linear order). Finally, we take a Bayesian perspective to further uncover transformers' preference for hierarchical generalization: We establish a correlation between whether transformers generalize hierarchically on a dataset and whether the simplest explanation of that dataset is provided by a hierarchical grammar compared to regular grammars exhibiting linear generalization.

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

↑