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

Transformer 在预测被掩码词时是否进行句法解析?

Do Transformers Parse while Predicting the Masked Word?

Princeton University(普林斯顿大学);Duke University(杜克大学)

Haoyu Zhao, Abhishek Panigrahi, Rong Ge, Sanjeev Arora

AI总结:

本文研究 Transformer 是否真正进行句法解析,证明中等规模掩码语言模型可近似执行 Inside-Outside 算法,并构造特定 Transformer 在 PTB 上实现高 F1 分数,揭示其隐式解析能力。

摘要:

预训练语言模型已被证明在无监督损失函数(如掩码语言建模)的训练过程中,能够在其嵌入中编码语言结构,例如依存句法树和成分句法树。有人质疑这些模型是否真正在进行句法解析,还是仅仅执行了与句法解析弱相关的某种计算。我们研究以下问题:(a)是否有可能明确描述具有现实嵌入维度、头数等参数的 Transformer,使其能够进行句法解析——甚至近似句法解析?(b)为什么预训练模型能够捕获句法解析结构?本文在概率上下文无关文法(PCFG)的生成建模背景下,朝着回答这些问题迈出了一步。我们表明,中等规模的掩码语言模型(如 BERT 或 RoBERTa)能够近似执行针对英语 PCFG [Marcus 等人,1993] 的 Inside-Outside 算法。我们还表明,对于 PCFG 生成的数据,Inside-Outside 算法在掩码语言建模损失上是最优的。我们还给出了一个 Transformer 的构造,该构造平均具有 50 层、15 个注意力头和 1275 维嵌入,利用其嵌入可以在 PTB 数据集上以超过 70% 的 F1 分数进行成分句法解析。我们对在 PCFG 生成数据上预训练的模型进行了探针实验,以表明这不仅能够恢复近似的句法树,还能恢复由 Inside-Outside 算法计算的边际跨度概率,这暗示了掩码语言建模对该算法的隐式偏好。

英文摘要:

Pre-trained language models have been shown to encode linguistic structures, e.g. dependency and constituency parse trees, in their embeddings while being trained on unsupervised loss functions like masked language modeling. Some doubts have been raised whether the models actually are doing parsing or only some computation weakly correlated with it. We study questions: (a) Is it possible to explicitly describe transformers with realistic embedding dimension, number of heads, etc. that are capable of doing parsing -- or even approximate parsing? (b) Why do pre-trained models capture parsing structure? This paper takes a step toward answering these questions in the context of generative modeling with PCFGs. We show that masked language models like BERT or RoBERTa of moderate sizes can approximately execute the Inside-Outside algorithm for the English PCFG [Marcus et al, 1993]. We also show that the Inside-Outside algorithm is optimal for masked language modeling loss on the PCFG-generated data. We also give a construction of transformers with $50$ layers, $15$ attention heads, and $1275$ dimensional embeddings in average such that using its embeddings it is possible to do constituency parsing with $>70\%$ F1 score on PTB dataset. We conduct probing experiments on models pre-trained on PCFG-generated data to show that this not only allows recovery of approximate parse tree, but also recovers marginal span probabilities computed by the Inside-Outside algorithm, which suggests an implicit bias of masked language modeling towards this algorithm.

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

↑