---
title: Third-Party-Supervised-Word-Aligner-mBERT-base-zhen
canonical_url: "https://www.modelscope.cn/models/jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen"
md_url: "https://www.modelscope.cn/models/jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen.md"
repository: jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen
chinese_name: "基于第三方监督的词对齐工具-mBERT-base-中英方向"
last_updated: 2023-03-01
model_type:
  - bert
architectures:
  - BertForMaskedLM
library_name:
  - pytorch
frameworks:
  - pytorch
downloads: 112
stars: 0
---

# Third-Party-Supervised-Word-Aligner-mBERT-base-zhen

> Third-Party-Supervised-Word-Aligner-mBERT-base-zhen - jpzhang 在 ModelScope 开源的模型。借助第三方词对齐工具在中英方向对mBERT-base模型进行微调，具备优秀的中英词对齐性能。

- **Repository**: jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen
- **Downloads**: 112
- **Stars**: 0
- **Last updated**: 2023-03-01

Source: https://www.modelscope.cn/models/jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen

---

# 基于第三方监督的词对齐工具
Third-Party Supervised Word Aligner
## 模型描述
词对齐任务旨在挖掘平行语料中互为翻译的词对，由于缺乏精确且足够的标注数据集，现有的工作多基于自学习的方式进行训练。本工作提出借助第三方词对齐工具生成监督信号，以微调大规模跨语言预训练模型（mBERT,XLM），进而得到性能更优的神经词对齐工具。

<p align="center">
    <img src="./framework.jpg" width="600" alt="framework" />

模型效果：  
输入：贝利 在 墨西哥 推出 自传 ||| pele promotes autobiography in mexico    
输出：0-0 1-3 2-4 3-1 4-2
## 期望模型使用方式以及适用范围
本模型主要用于对平行语料进行对齐，输入为一组分词后的平行文本，输出为单词级别的对齐信息。具体使用方式请参考代码示例。
### 如何使用
#### 代码范例
```python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

model_id = 'jpzhang/Third-Party-Supervised-Word-Aligner-mBERT-base-zhen'
input = {"sentence_pair": '贝利 在 墨西哥 推出 自传 。||| pele promotes autobiography in mexico .'}
pipeline = pipeline(Tasks.word_alignment, model=model_id)
result = pipeline(input)
print(result['output'])
```
### 模型局限性以及可能的偏差
本模型借助第三方监督信号进行微调，未使用真实标注。模型在LDC(中英)、KFTT（日英）和Europarl（德英，英法，罗英）数据集上训练，不同场景下有可能产生一些偏差，请用户自行评测后决定如何使用。
## 训练数据介绍
中英：LDC数据集(训练，出于版权原因，请自行获取) ，[清华开源数据集](http://nlp.csai.tsinghua.edu.cn/~ly/systems/TsinghuaAligner/TsinghuaAligner.html)（验证与测试）  
日英：[KFTT](http://www.phontron.com/kftt/)  
德英，英法，罗英：[Zenkel等开源](https://github.com/lilt/alignment-scripts)
## 模型训练流程
### 数据预处理
参考 [Zenkel等开源](https://github.com/lilt/alignment-scripts)
### 训练
暂不支持在ModelScope内部进行训练（工作中），可暂时参考我们的 [开源项目](https://github.com/sdongchuanqi/Third-Party-Supervised-Aligner/tree/main/8w) 。
## 数据评估及结果
我们采用[AER评测指标](https://github.com/lilt/alignment-scripts/blob/master/scripts/aer.py)进行评估。
|                   | zh-en | de-en | en-fr | ro-en | ja-en | avg |
|-------------------|-------|-------|-------|-------|-------|-------|
| FastAlign<sup>1</sup>| 27.3 | 27.0 | 10.5 | 32.1 | 51.1 | 29.6 |
| GIZA++<sup>2</sup>  | 18.5 | 20.6 | 5.9 | 26.4 | 48.0 | 23.9 |
| SimAlign<sup>3</sup>  | 19.6 | 19.0 | 6.0 | 30.5 | 48.6 | 26.3 |
| AwesomeAlign<sup>4</sup>  | 13.3 | 15.6 | 4.4 | 23.0 | 38.4 | 18.9 |
| MaskAlign<sup>5</sup>  | 13.8 | 14.4 | 4.4 | 19.5 | 40.8 | 18.6 |
| Ours(mBERT)           | 11.0 | 14.8 | 3.8 | 19.3 | 33.2 | 16.4 |
| Ours(XLM)           | 11.3 | 13.9 | 4.0 | 18.6 | 33.4 | 16.2 |

参考工作：
1. Dyer et al. A simple, fast, and effective reparameterization of ibm model 2. 2013.
2. Och and Ney. A systematic comparison of various statistical alignment models. 2003.
3. Sabet et al. SimAlign: High quality word alignments without parallel training data using static and contextualized embeddings. 2020.
4. Dou and Neubig. Word alignment by fine-tuning embeddings on parallel corpora. 2021.
5. Chen et al. Maskalign: Self-supervised neural word alignment. 2021.
## 相关论文以及引用信息
如果我们的模型对您有帮助，请您引用我们的论文：
```BibTeX
@article{zhang2022third,
  title={Third-Party Aligner for Neural Word Alignments},
  author={Zhang, Jinpeng and Dong, Chuanqi and Duan, Xiangyu and Zhang, Yuqi and Zhang, Min},
  journal={arXiv preprint arXiv:2211.04198},
  year={2022}
}
```
