🚀 MacBERT
MacBERT是一个改进版的BERT模型,通过引入新颖的预训练任务,有效缓解了预训练和微调之间的差异问题。本项目包含了相关论文的资源,为中文自然语言处理提供了更强大的预训练模型。
🚀 快速开始
请使用与 'Bert' 相关的函数来加载此模型!
本仓库包含了我们发表在 "Findings of EMNLP" 上的论文 "Revisiting Pre-trained Models for Chinese Natural Language Processing" 的相关资源。你可以通过 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] 标记进行掩码不同,我们建议使用相似的词进行掩码。相似词是通过 同义词工具包 (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作为校正 |
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",
}