[论文解读] A Better Way to Do Masked Language Model Scoring
本文提出 PLL-word-l2r,一种改进的掩码语言模型评分方法,该方法在推理过程中同时屏蔽目标词及其所有后续的词内子词,以解决词汇外(OOV)词汇的得分膨胀问题。该方法在满足理论期望方面优于原始 PLL 和全词掩码方法,并且与自回归模型得分的相关性更强,尤其在 BLiMP 等受控基准测试中表现更优。
Estimating the log-likelihood of a given sentence under an autoregressive language model is straightforward: one can simply apply the chain rule and sum the log-likelihood values for each successive token. However, for masked language models (MLMs), there is no direct way to estimate the log-likelihood of a sentence. To address this issue, Salazar et al. (2020) propose to estimate sentence pseudo-log-likelihood (PLL) scores, computed by successively masking each sentence token, retrieving its score using the rest of the sentence as context, and summing the resulting values. Here, we demonstrate that the original PLL method yields inflated scores for out-of-vocabulary words and propose an adapted metric, in which we mask not only the target token, but also all within-word tokens to the right of the target. We show that our adapted metric (PLL-word-l2r) outperforms both the original PLL metric and a PLL metric in which all within-word tokens are masked. In particular, it better satisfies theoretical desiderata and better correlates with scores from autoregressive models. Finally, we show that the choice of metric affects even tightly controlled, minimal pair evaluation benchmarks (such as BLiMP), underscoring the importance of selecting an appropriate scoring metric for evaluating MLM properties.
研究动机与目标
- 解决原始伪对数似然(PLL)度量在掩码语言模型中对词汇外(OOV)词汇的对数似然得分过高估计的问题。
- 通过确保满足诸如句子长度与对数似然的反比关系、词频与得分的正相关性等关键理论期望,提升 PLL 度量的理论有效性。
- 通过增强双向模型(如 BERT)与单向模型(如 GPT-2)之间得分的相关性,提升跨模型可比性。
- 评估度量选择对最小对基准测试的影响,特别是在受控语言评估(如 BLiMP)中的表现。
提出的方法
- 提出 PLL-word-l2r,一种改进的 PLL 评分方法,在推理过程中屏蔽目标词及其右侧所有词内子词,确保不使用未来子词上下文。
- 修改 minicons 库以在新掩码方案下计算句子级别的 PLL 得分,同时保持从左到右的自回归生成顺序。
- 采用从左到右的掩码策略,模拟更自然、上下文受限的预测过程,避免未来子词对 OOV 词汇预测的影响。
- 在多个评估标准和数据集上,将 PLL-word-l2r 与 PLL-original 和 PLL-whole-word(掩码所有词内子词)进行比较。
- 使用皮尔逊相关系数评估度量与理论期望的一致性,例如句子长度与意外度的反比关系,以及词频与 PLL 得分的正相关性。
- 将这些度量应用于 BLiMP 基准,以评估其对最小对语言评估的影响。

实验结果
研究问题
- RQ1原始 PLL 度量是否因可访问未来词内子词而系统性地高估词汇外(OOV)词汇的对数似然?
- RQ2一种屏蔽未来词内子词的改进 PLL 度量是否能更好地满足理论期望,如句子长度与句子意外度的反比关系?
- RQ3PLL-word-l2r 是否相比原始 PLL 或全词掩码方法,与单向模型得分(如 GPT-2)具有更强的相关性?
- RQ4PLL 度量的选择如何影响在受控语言基准(如 BLiMP)上的表现?
主要发现
- PLL-word-l2r 在所有度量中与词频的相关性最高(r = 0.62),显著优于 PLL-original(r = 0.38)和 PLL-whole-word(r = 0.58)。
- PLL-word-l2r 展现出最强的句子长度与负句子 PLL 之间的反比关系(r = -0.71),满足了句子越长、意外度越高的理论期望。
- PLL-word-l2r 与 GPT-2 对数似然得分的相关性最高(r = 0.78),优于 PLL-original(r = 0.52)和 PLL-whole-word(r = 0.74)。
- 在 BLiMP 基准上,PLL-word-l2r 在所有测试模型中均取得最高总体得分,包括 BERT-base(84.7)、BERT-large(85.0)、RoBERTa-base(86.7)和 RoBERTa-large(87.5)。
- 原始 PLL 度量会因剩余子词提供上下文,而对 OOV 词汇(如 'souvenir')产生得分膨胀,该词被拆分为子词(如 so ##uven ##ir),导致概率被错误地高估。
- 所提出的度量在不同模型和数据集上均表现稳健,即使在更大的模型和低 OOV 数据集中也持续表现出改进,尽管在低 OOV 情况下效果有所减弱。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。