🚀 MacBERT
MacBERT 是一种改进版的 BERT 模型,通过引入新颖的 MLM as correction 预训练任务,有效缓解了预训练和微调之间的差异,为中文自然语言处理带来了更优的解决方案。
🚀 快速开始
请使用与 'Bert' 相关的函数来加载此模型!
本仓库包含了论文 《Revisiting Pre-trained Models for Chinese Natural Language Processing》 中的相关资源,该论文即将发表于 "Findings of EMNLP"。你可以通过 ACL Anthology 或 arXiv 预印本 阅读我们的终稿论文。
Revisiting Pre-trained Models for Chinese Natural Language Processing
Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Shijin Wang, Guoping Hu
你可能还对以下内容感兴趣:
- 中文 BERT 系列:https://github.com/ymcui/Chinese-BERT-wwm
- 中文 ELECTRA:https://github.com/ymcui/Chinese-ELECTRA
- 中文 XLNet:https://github.com/ymcui/Chinese-XLNet
- 知识蒸馏工具包 - TextBrewer:https://github.com/airaria/TextBrewer
更多由 HFL 提供的资源:https://github.com/ymcui/HFL-Anthology
✨ 主要特性
MacBERT 是一种改进的 BERT 模型,具有新颖的 MLM as correction 预训练任务,能够缓解预训练和微调之间的差异。
与使用 [MASK] 标记进行掩码不同([MASK] 标记在微调阶段从未出现过),我们提出使用近义词进行掩码。近义词通过 Synonyms 工具包 (Wang and Hu, 2017) 获取,该工具包基于 word2vec (Mikolov et al., 2013) 相似度计算。如果选择对一个 N - gram 进行掩码,我们将分别查找其近义词。在极少数情况下,当没有近义词时,我们将退而使用随机词替换。
以下是我们预训练任务的一个示例:
|
示例 |
原始句子 |
we use a language model to predict the probability of the next word. |
MLM |
we use a language [M] to [M] ##di ##ct the pro [M] ##bility of the next word . |
全词掩码 |
we use a language [M] to [M] [M] [M] the [M] [M] [M] of the next word . |
N - gram 掩码 |
we use a [M] [M] to [M] [M] [M] the [M] [M] [M] [M] [M] next word . |
MLM as correction |
we use a text system to ca ##lc ##ulate the po ##si ##bility of the next word . |
除了新的预训练任务,我们还结合了以下技术:
- 全词掩码 (WWM)
- N - gram 掩码
- 句子顺序预测 (SOP)
请注意,由于我们的 MacBERT 在主要神经网络架构上与原始 BERT 没有差异,因此可以直接替换原始 BERT。
如需了解更多技术细节,请查看我们的论文:Revisiting Pre-trained Models for Chinese Natural Language Processing
📄 许可证
本项目采用 Apache - 2.0 许可证。
📚 详细文档
引用
如果您发现我们的资源或论文有用,请在您的论文中考虑包含以下引用:
- https://arxiv.org/abs/2004.13922
@inproceedings{cui-etal-2020-revisiting,
title = "Revisiting Pre-Trained Models for {C}hinese Natural Language Processing",
author = "Cui, Yiming and
Che, Wanxiang and
Liu, Ting and
Qin, Bing and
Wang, Shijin and
Hu, Guoping",
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings",
month = nov,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.findings-emnlp.58",
pages = "657--668",
}