---
title: nlp_debertav2_fill-mask_chinese-lite
canonical_url: "https://www.modelscope.cn/models/damo/nlp_debertav2_fill-mask_chinese-lite"
md_url: "https://www.modelscope.cn/models/damo/nlp_debertav2_fill-mask_chinese-lite.md"
repository: damo/nlp_debertav2_fill-mask_chinese-lite
chinese_name: "DeBERTaV2完形填空模型-中文-lite"
last_updated: 2025-06-11
license: "Apache License 2.0"
pipeline_tag: fill-mask
tasks:
  - fill-mask
model_type:
  - deverta_v2
library_name:
  - pytorch
frameworks:
  - pytorch
language:
  - ch
domain:
  - nlp
downloads: 731
stars: 0
tags:
  - transformer
  - "arxiv:2111.09543"
---

# nlp_debertav2_fill-mask_chinese-lite

> nlp_debertav2_fill-mask_chinese-lite - damo 在 ModelScope 开源的模型。中文DeBERTa V2 lite模型

damo/nlp_debertav2_fill-mask_chinese-lite 是 ModelScope 魔搭社区上的fill-mask模型，采用 Apache License 2.0 许可。

- **Repository**: damo/nlp_debertav2_fill-mask_chinese-lite
- **License**: Apache License 2.0
- **Tasks**: fill-mask
- **Tags**: transformer, arxiv:2111.09543
- **Downloads**: 731
- **Stars**: 0
- **Last updated**: 2025-06-11

Source: https://www.modelscope.cn/models/damo/nlp_debertav2_fill-mask_chinese-lite

---

# 基于DeBERTaV2的中文Lite预训练模型介绍（文档更新中）

DeBERTaV2的中文Lite预训练模型是使用wikipedia数据集、wudao数据集及中文网页数据，以masked language model任务训练的中文自然语言理解预训练模型。

## 模型描述

DeBERTaV2在BERT/RoBERTa的基础之上，通过解耦注意力机制、增强的掩码解码机制等方面进行改进，从而更好的对语言理解任务进行建模。详见论文[Deberta: Decoding-enhanced bert with disentangled attention](https://arxiv.org/pdf/2006.03654.pdf)，主要改进点如下：

1. 解耦注意力机制：在通用Transformer自注意力机制基础之上，将每个token的编码解耦为内容编码（content embedding）和位置编码（position embbeding），并通过两者的cross attention进行建模

![Distangled_Attention](./resources/attention.png)

2. 增强的掩码解码机制：MLM任务预训练中在softmax层之前加入专门的解码层，并在解码层中引入绝对位置信息辅助MLM任务训练

![EMD](./resources/emd.png)

3. nGram Induced Input Encoding：在输入层增加char级别的卷积层，以进一步丰富输入token的相信信息
4. 128K vocabulary：结合训练数据，通过中文分词及SentencePiece，构建了包含128K个词语的词典

本模型为Lite规模（Layer-6 / Hidden-768 / Head-12)，参数规模约为137M。

## 期望模型使用方式以及适用范围
本模型主要用于中文相关下游任务微调。用户可以基于自有训练数据进行微调，具体微调训练方式请参考[文档](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AE%AD%E7%BB%83Train)。

### 如何使用
在安装完成ModelScope-lib之后即可基于nlp_debertav2_fill-mask_chinese-lite进行下游任务finetune

#### 代码范例
```python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

ori_text = '你师父差得动你，你师父可差不动我。'
test_input = '你师父差得动你，你师父可[MASK]不动我。'
pipeline_ins = pipeline(
    task=Tasks.fill_mask, model='damo/nlp_debertav2_fill-mask_chinese-lite', model_revision='master')
print(f'\nori_text: {ori_text}\ninput: {test_input}\npipeline: '
      f'{pipeline_ins(test_input)}\n')
```

### 模型局限性以及可能的偏差
基于中文数据进行训练，模型训练数据有限，效果可能存在一定偏差。

## 训练数据介绍
数据来源于[维基数据](https://huggingface.co/datasets/wikipedia)、WuDao数据和中文网页数据等

## 模型训练流程
在中文wiki等无监督数据上，通过MLM任务训练得到。

## 数据评估及结果
暂无

### 相关论文以及引用信息
```BibTex
@article{he2020deberta,
  title={Deberta: Decoding-enhanced bert with disentangled attention},
  author={He, Pengcheng and Liu, Xiaodong and Gao, Jianfeng and Chen, Weizhu},
  journal={arXiv preprint arXiv:2006.03654},
  year={2020}
}
```
