DeBERTa 借助解耦注意力机制和增强型掩码解码器,对 BERT 和 RoBERTa 模型进行了改进。凭借这两项改进,在使用 80GB 训练数据的情况下,DeBERTa 在大多数自然语言理解(NLU)任务上的表现均优于 RoBERTa。
在 DeBERTa V3 中,我们通过采用 ELECTRA 风格的预训练方法并结合梯度解耦嵌入共享技术,进一步提升了 DeBERTa 的效率。与 DeBERTa 相比,我们的 V3 版本在下游任务上的模型性能得到了显著提升。有关新模型的更多技术细节,可参考我们的 论文。
更多实现细节和更新,请查阅 官方代码库。
DeBERTa V3 base 模型包含 12 层,隐藏层大小为 768。其骨干网络参数仅为 8600 万,词汇表包含 128K 个 token,这使得嵌入层的参数达到 9800 万。该模型使用与 DeBERTa V2 相同的 160GB 数据进行训练。
我们展示了在 SQuAD 2.0 和 MNLI 任务上的开发集结果。
| 模型 | 词汇量(K) | 骨干网络参数(M) | SQuAD 2.0(F1/EM) | MNLI-m/mm(准确率) |
|---|---|---|---|---|
| RoBERTa-base | 50 | 86 | 83.7/80.5 | 87.6/- |
| XLNet-base | 32 | 92 | -/80.2 | 86.8/- |
| ELECTRA-base | 30 | 86 | -/80.5 | 88.8/ |
| DeBERTa-base | 50 | 100 | 86.2/83.1 | 88.8/88.5 |
| DeBERTa-v3-base | 128 | 86 | 88.4/85.4 | 90.6/90.7 |
| DeBERTa-v3-base + SiFT | 128 | 86 | -/- | 91.0/- |
我们展示了在 SQuAD 1.1/2.0 和 MNLI 任务上的开发集结果。
import argparse
import torch
from openmind import pipeline, is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
default=None,
type=str,
help="Path to model",
required=False,
)
args = parser.parse_args()
return args
if __name__=="__main__":
args = parse_args()
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#推理
unmasker = pipeline('fill-mask', model=args.model_name_or_path, device=device)
print(unmasker("Hello I'm a [MASK] model."))
如果您发现DeBERTa对您的工作有所帮助,请引用以下论文:
@misc{he2021debertav3,
title={DeBERTaV3: Improving DeBERTa using ELECTRA-Style Pre-Training with Gradient-Disentangled Embedding Sharing},
author={Pengcheng He and Jianfeng Gao and Weizhu Chen},
year={2021},
eprint={2111.09543},
archivePrefix={arXiv},
primaryClass={cs.CL}
}@inproceedings{
he2021deberta,
title={DEBERTA: DECODING-ENHANCED BERT WITH DISENTANGLED ATTENTION},
author={Pengcheng He and Xiaodong Liu and Jianfeng Gao and Weizhu Chen},
booktitle={International Conference on Learning Representations},
year={2021},
url={https://openreview.net/forum?id=XPZIaotutsD}
}