Skip to main content
QUICK REVIEW

[论文解读] ERNIE-Gram: Pre-Training with Explicitly N-Gram Masked Language Modeling for Natural Language Understanding

Dongling Xiao, Yukun Li|arXiv (Cornell University)|Oct 23, 2020
Topic Modeling参考文献 45被引用 8
一句话总结

ERNIE-Gram 提出了一种显式的 n-gram 掩码语言建模方法,通过直接预测 n-gram 身份而非连续的标记序列来增强预训练,使用生成器采样合理的 n-gram,并实现全面的粗粒度与细粒度预测。该方法在 19 项 NLU 任务上达到最先进性能,显著超越 XLNet 和 RoBERTa,在包含 30 万 n-gram 词典的 GLUE 和 SQuAD 基准上创下新的 SOTA 记录。

ABSTRACT

Coarse-grained linguistic information, such as named entities or phrases, facilitates adequately representation learning in pre-training. Previous works mainly focus on extending the objective of BERT's Masked Language Modeling (MLM) from masking individual tokens to contiguous sequences of n tokens. We argue that such contiguously masking method neglects to model the intra-dependencies and inter-relation of coarse-grained linguistic information. As an alternative, we propose ERNIE-Gram, an explicitly n-gram masking method to enhance the integration of coarse-grained information into pre-training. In ERNIE-Gram, n-grams are masked and predicted directly using explicit n-gram identities rather than contiguous sequences of n tokens. Furthermore, ERNIE-Gram employs a generator model to sample plausible n-gram identities as optional n-gram masks and predict them in both coarse-grained and fine-grained manners to enable comprehensive n-gram prediction and relation modeling. We pre-train ERNIE-Gram on English and Chinese text corpora and fine-tune on 19 downstream tasks. Experimental results show that ERNIE-Gram outperforms previous pre-training models like XLNet and RoBERTa by a large margin, and achieves comparable results with state-of-the-art methods. The source codes and pre-trained models have been released at https://github.com/PaddlePaddle/ERNIE.

研究动机与目标

  • 为解决 BERT 风格掩码语言建模在捕捉粗粒度语言信息(如命名实体和短语)方面的局限性。
  • 克服连续 n-gram 掩码的低效性,后者将掩码跨度中的标记视为独立个体,忽略内部依赖关系。
  • 通过在密集预测空间中显式建模 n-gram 身份而非稀疏标记空间,增强表示学习。
  • 通过全面预测(粗粒度与细粒度)和显式 n-gram 关系学习,提升 n-gram 的语义建模能力。
  • 通过改进的预训练,在多样化 NLU 基准上实现最先进性能。

提出的方法

  • ERNIE-Gram 使用单个 [MASK] 标记掩码 n-gram,并通过预先构建的 n-gram 词典显式预测其身份,将预测空间从 |V_F|^n 缩小至 |V_N|。
  • 采用生成器模型采样合理的 n-gram 身份作为可选掩码,从而提供更鲁棒且多样的训练信号。
  • 通过共享注意力掩码机制,同时预测掩码跨度的显式 n-gram 身份和其组成标记的身份,实现全面的 n-gram 预测。
  • 引入增强的 n-gram 关系建模机制,使模型能够从合理替代中恢复原始 n-gram,显式建模 n-gram 之间的语义关系。
  • 将替换标记检测(RTD)目标适配为区分原始 n-gram 与生成 n-gram,提升 n-gram 与标记级表示之间的交互。
  • 在 16GB 和 160GB 的英文与中文文本语料上,使用 BERT-base 和 BERT-large 设置进行预训练,并在 19 项下游任务上进行微调。

实验结果

研究问题

  • RQ1与掩码单个标记或连续标记跨度相比,显式掩码和预测 n-gram 身份是否能提升表示学习?
  • RQ2在有限的密集空间(V_N)中建模 n-gram 身份是否优于在稀疏的指数空间(V_F^n)中预测,从而带来更好的性能?
  • RQ3对 n-gram 身份和组成标记的全面预测在多大程度上提升了短语和命名实体的语义建模?
  • RQ4显式 n-gram 关系建模——即从合理替代中恢复原始 n-gram——在多大程度上改善了上下文表示学习?
  • RQ5n-gram 词典的最优大小是多少,以在覆盖范围与性能之间实现平衡?

主要发现

  • ERNIE-Gram 在 19 项下游 NLU 任务上显著优于 XLNet 和 RoBERTa,于 GLUE 和 SQuAD 基准上达到最先进结果。
  • 在 GLUE 基准上,ERNIE-Gram 在 SQuAD1.1 上取得 78.9 的 F1 分数,在 SQuAD2.0 上取得 87.4 的 F1 分数,显著优于先前模型。
  • 消融研究显示,若移除全面的 n-gram 预测,性能下降 0.3–0.6 分;若移除增强的 n-gram 关系建模,性能下降 0.4–1.3 分。
  • 当 n-gram 词典大小超过 30 万时,性能下降,表明包含低频 n-gram 会损害学习,40 万词典导致显著性能下降。
  • 案例研究显示,ERNIE-Gram 对长命名实体的召回率更高,且在命名实体内部表现出更强的注意力连贯性,证实其对内部依赖关系建模更优。
  • 注意力头可视化显示,ERNIE-Gram 在命名实体上呈现明亮且连贯的块状激活,表明实体内各标记相互关注,而基线模型则呈现对角线自注意力模式。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。