
# Model Card of `lmqg/mt5-base-zhquad-qg-ae`
This model is fine-tuned version of [google/mt5-base](https://huggingface.co/google/mt5-base) for question generation and answer extraction jointly on the [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) (dataset_name: default) via [`lmqg`](https://github.com/asahi417/lm-question-generation).


### Overview
- **Language model:** [google/mt5-base](https://huggingface.co/google/mt5-base)   
- **Language:** zh  
- **Training data:** [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) (default)
- **Online Demo:** [https://autoqg.net/](https://autoqg.net/)
- **Repository:** [https://github.com/asahi417/lm-question-generation](https://github.com/asahi417/lm-question-generation)
- **Paper:** [https://arxiv.org/abs/2210.03992](https://arxiv.org/abs/2210.03992)

### Usage
- With [`lmqg`](https://github.com/asahi417/lm-question-generation#lmqg-language-model-for-question-generation-)
```python
from lmqg import TransformersQG

# initialize model
model = TransformersQG(language="zh", model="lmqg/mt5-base-zhquad-qg-ae")

# model prediction
question_answer_pairs = model.generate_qa("南安普敦的警察服务由汉普郡警察提供。南安普敦行动的主要基地是一座新的八层专用建筑，造价3000万英镑。该建筑位于南路，2011年启用，靠近南安普敦中央火车站。此前，南安普顿市中心的行动位于市民中心西翼，但由于设施老化，加上计划在旧警察局和地方法院建造一座新博物馆，因此必须搬迁。在Portswood、Banister Park、Hille和Shirley还有其他警察局，在南安普顿中央火车站还有一个英国交通警察局。")

```

- With `transformers`
```python
from transformers import pipeline

pipe = pipeline("text2text-generation", "lmqg/mt5-base-zhquad-qg-ae")

# answer extraction
answer = pipe("generate question: 南安普敦的警察服务由汉普郡警察提供。南安普敦行动的主要基地是一座新的八层专用建筑，造价3000万英镑。该建筑位于南路，2011年启用，靠近<hl> 南安普敦中央 <hl>火车站。此前，南安普顿市中心的行动位于市民中心西翼，但由于设施老化，加上计划在旧警察局和地方法院建造一座新博物馆，因此必须搬迁。在Portswood、Banister Park、Hille和Shirley还有其他警察局，在南安普顿中央火车站还有一个英国交通警察局。")

# question generation
question = pipe("extract answers: 南安普敦的警察服务由汉普郡警察提供。 南安普敦行动的主要基地是一座新的八层专用建筑，造价3000万英镑。 <hl> 该建筑位于南路，2011年启用，靠近 南安普敦中央 火车站。 <hl> 此前，南安普顿市中心的行动位于市民中心西翼，但由于设施老化，加上计划在旧警察局和地方法院建造一座新博物馆，因此必须搬迁。 在Portswood、Banister Park、Hille和Shirley还有其他警察局，在南安普顿中央火车站还有一个英国交通警察局。")

```

## Evaluation


- ***Metric (Question Generation)***: [raw metric file](https://huggingface.co/lmqg/mt5-base-zhquad-qg-ae/raw/main/eval/metric.first.sentence.paragraph_answer.question.lmqg_qg_zhquad.default.json) 

|            |   Score | Type    | Dataset                                                          |
|:-----------|--------:|:--------|:-----------------------------------------------------------------|
| BERTScore  |   76.82 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_1     |   36.9  | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_2     |   25.74 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_3     |   19.13 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_4     |   14.63 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| METEOR     |   23.69 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| MoverScore |   57.24 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| ROUGE_L    |   34.07 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |


- ***Metric (Question & Answer Generation)***:  [raw metric file](https://huggingface.co/lmqg/mt5-base-zhquad-qg-ae/raw/main/eval/metric.first.answer.paragraph.questions_answers.lmqg_qg_zhquad.default.json)

|                                 |   Score | Type    | Dataset                                                          |
|:--------------------------------|--------:|:--------|:-----------------------------------------------------------------|
| QAAlignedF1Score (BERTScore)    |   78.4  | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| QAAlignedF1Score (MoverScore)   |   53.55 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| QAAlignedPrecision (BERTScore)  |   75.27 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| QAAlignedPrecision (MoverScore) |   51.56 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| QAAlignedRecall (BERTScore)     |   81.92 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| QAAlignedRecall (MoverScore)    |   55.82 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |


- ***Metric (Answer Extraction)***: [raw metric file](https://huggingface.co/lmqg/mt5-base-zhquad-qg-ae/raw/main/eval/metric.first.answer.paragraph_sentence.answer.lmqg_qg_zhquad.default.json)

|                  |   Score | Type    | Dataset                                                          |
|:-----------------|--------:|:--------|:-----------------------------------------------------------------|
| AnswerExactMatch |   95.07 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| AnswerF1Score    |   95.15 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| BERTScore        |   99.76 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_1           |   92.37 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_2           |   89.37 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_3           |   86.14 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| Bleu_4           |   82.63 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| METEOR           |   71.18 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| MoverScore       |   98.8  | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |
| ROUGE_L          |   95.72 | default | [lmqg/qg_zhquad](https://huggingface.co/datasets/lmqg/qg_zhquad) |



## Training hyperparameters

The following hyperparameters were used during fine-tuning:
 - dataset_path: lmqg/qg_zhquad
 - dataset_name: default
 - input_types: ['paragraph_answer', 'paragraph_sentence']
 - output_types: ['question', 'answer']
 - prefix_types: ['qg', 'ae']
 - model: google/mt5-base
 - max_length: 512
 - max_length_output: 32
 - epoch: 5
 - batch: 32
 - lr: 0.0005
 - fp16: False
 - random_seed: 1
 - gradient_accumulation_steps: 2
 - label_smoothing: 0.15

The full configuration can be found at [fine-tuning config file](https://huggingface.co/lmqg/mt5-base-zhquad-qg-ae/raw/main/trainer_config.json).

## Citation
```
@inproceedings{ushio-etal-2022-generative,
    title = "{G}enerative {L}anguage {M}odels for {P}aragraph-{L}evel {Q}uestion {G}eneration",
    author = "Ushio, Asahi  and
        Alva-Manchego, Fernando  and
        Camacho-Collados, Jose",
    booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing",
    month = dec,
    year = "2022",
    address = "Abu Dhabi, U.A.E.",
    publisher = "Association for Computational Linguistics",
}

```

{"language": "zh", "license": "cc-by-4.0", "tags": ["question generation", "answer extraction"], "datasets": ["lmqg/qg_zhquad"], "metrics": ["bleu4", "meteor", "rouge-l", "bertscore", "moverscore"], "pipeline_tag": "text2text-generation", "widget": [{"text": "generate question: \u5357\u5b89\u666e\u6566\u7684\u8b66\u5bdf\u670d\u52a1\u7531\u6c49\u666e\u90e1\u8b66\u5bdf\u63d0\u4f9b\u3002\u5357\u5b89\u666e\u6566\u884c\u52a8\u7684\u4e3b\u8981\u57fa\u5730\u662f\u4e00\u5ea7\u65b0\u7684\u516b\u5c42\u4e13\u7528\u5efa\u7b51\uff0c\u9020\u4ef73000\u4e07\u82f1\u9551\u3002\u8be5\u5efa\u7b51\u4f4d\u4e8e\u5357\u8def\uff0c2011\u5e74\u542f\u7528\uff0c\u9760\u8fd1<hl> \u5357\u5b89\u666e\u6566\u4e2d\u592e <hl>\u706b\u8f66\u7ad9\u3002\u6b64\u524d\uff0c\u5357\u5b89\u666e\u987f\u5e02\u4e2d\u5fc3\u7684\u884c\u52a8\u4f4d\u4e8e\u5e02\u6c11\u4e2d\u5fc3\u897f\u7ffc\uff0c\u4f46\u7531\u4e8e\u8bbe\u65bd\u8001\u5316\uff0c\u52a0\u4e0a\u8ba1\u5212\u5728\u65e7\u8b66\u5bdf\u5c40\u548c\u5730\u65b9\u6cd5\u9662\u5efa\u9020\u4e00\u5ea7\u65b0\u535a\u7269\u9986\uff0c\u56e0\u6b64\u5fc5\u987b\u642c\u8fc1\u3002\u5728Portswood\u3001Banister Park\u3001Hille\u548cShirley\u8fd8\u6709\u5176\u4ed6\u8b66\u5bdf\u5c40\uff0c\u5728\u5357\u5b89\u666e\u987f\u4e2d\u592e\u706b\u8f66\u7ad9\u8fd8\u6709\u4e00\u4e2a\u82f1\u56fd\u4ea4\u901a\u8b66\u5bdf\u5c40\u3002", "example_title": "Question Generation Example 1"}, {"text": "generate question: \u829d\u52a0\u54e5\u5927\u5b66\u7684<hl> 1960\u201461 <hl>\u96c6\u56e2\u7406\u8bba\u5e74\u6c47\u96c6\u4e86Daniel Gorenstein\u3001John G. Thompson\u548cWalter Feit\u7b49\u56e2\u4f53\u7406\u8bba\u5bb6\uff0c\u5960\u5b9a\u4e86\u4e00\u4e2a\u5408\u4f5c\u7684\u57fa\u7840\uff0c\u501f\u52a9\u4e8e\u5176\u4ed6\u4f17\u591a\u6570\u5b66\u5bb6\u7684\u8f93\u5165\uff0c1982\u4e2d\u5bf9\u6240\u6709\u6709\u9650\u7684\u7b80\u5355\u7fa4\u8fdb\u884c\u4e86\u5206\u7c7b\u3002\u8fd9\u4e2a\u9879\u76ee\u7684\u89c4\u6a21\u8d85\u8fc7\u4e86\u4ee5\u5f80\u7684\u6570\u5b66\u7814\u7a76\uff0c\u65e0\u8bba\u662f\u8bc1\u660e\u7684\u957f\u5ea6\u8fd8\u662f\u7814\u7a76\u4eba\u5458\u7684\u6570\u91cf\u3002\u76ee\u524d\u6b63\u5728\u8fdb\u884c\u7814\u7a76\uff0c\u4ee5\u7b80\u5316\u8fd9\u4e00\u5206\u7c7b\u7684\u8bc1\u660e\u3002\u5982\u4eca\uff0c\u7fa4\u8bba\u4ecd\u7136\u662f\u4e00\u4e2a\u975e\u5e38\u6d3b\u8dc3\u7684\u6570\u5b66\u5206\u652f\uff0c\u5f71\u54cd\u7740\u8bb8\u591a\u5176\u4ed6\u9886\u57df", "example_title": "Question Generation Example 2"}, {"text": "extract answers: \u5357\u5b89\u666e\u6566\u7684\u8b66\u5bdf\u670d\u52a1\u7531\u6c49\u666e\u90e1\u8b66\u5bdf\u63d0\u4f9b\u3002 \u5357\u5b89\u666e\u6566\u884c\u52a8\u7684\u4e3b\u8981\u57fa\u5730\u662f\u4e00\u5ea7\u65b0\u7684\u516b\u5c42\u4e13\u7528\u5efa\u7b51\uff0c\u9020\u4ef73000\u4e07\u82f1\u9551\u3002 <hl> \u8be5\u5efa\u7b51\u4f4d\u4e8e\u5357\u8def\uff0c2011\u5e74\u542f\u7528\uff0c\u9760\u8fd1 \u5357\u5b89\u666e\u6566\u4e2d\u592e \u706b\u8f66\u7ad9\u3002 <hl> \u6b64\u524d\uff0c\u5357\u5b89\u666e\u987f\u5e02\u4e2d\u5fc3\u7684\u884c\u52a8\u4f4d\u4e8e\u5e02\u6c11\u4e2d\u5fc3\u897f\u7ffc\uff0c\u4f46\u7531\u4e8e\u8bbe\u65bd\u8001\u5316\uff0c\u52a0\u4e0a\u8ba1\u5212\u5728\u65e7\u8b66\u5bdf\u5c40\u548c\u5730\u65b9\u6cd5\u9662\u5efa\u9020\u4e00\u5ea7\u65b0\u535a\u7269\u9986\uff0c\u56e0\u6b64\u5fc5\u987b\u642c\u8fc1\u3002 \u5728Portswood\u3001Banister Park\u3001Hille\u548cShirley\u8fd8\u6709\u5176\u4ed6\u8b66\u5bdf\u5c40\uff0c\u5728\u5357\u5b89\u666e\u987f\u4e2d\u592e\u706b\u8f66\u7ad9\u8fd8\u6709\u4e00\u4e2a\u82f1\u56fd\u4ea4\u901a\u8b66\u5bdf\u5c40\u3002", "example_title": "Answer Extraction Example 1"}], "model-index": [{"name": "lmqg/mt5-base-zhquad-qg-ae", "results": [{"task": {"type": "text2text-generation", "name": "Text2text Generation"}, "dataset": {"name": "lmqg/qg_zhquad", "type": "default", "args": "default"}, "metrics": [{"type": "bleu4_question_generation", "value": 14.63, "name": "BLEU4 (Question Generation)"}, {"type": "rouge_l_question_generation", "value": 34.07, "name": "ROUGE-L (Question Generation)"}, {"type": "meteor_question_generation", "value": 23.69, "name": "METEOR (Question Generation)"}, {"type": "bertscore_question_generation", "value": 76.82, "name": "BERTScore (Question Generation)"}, {"type": "moverscore_question_generation", "value": 57.24, "name": "MoverScore (Question Generation)"}, {"type": "qa_aligned_f1_score_bertscore_question_answer_generation_with_gold_answer", "value": 78.4, "name": "QAAlignedF1Score-BERTScore (Question & Answer Generation (with Gold Answer))"}, {"type": "qa_aligned_recall_bertscore_question_answer_generation_with_gold_answer", "value": 81.92, "name": "QAAlignedRecall-BERTScore (Question & Answer Generation (with Gold Answer))"}, {"type": "qa_aligned_precision_bertscore_question_answer_generation_with_gold_answer", "value": 75.27, "name": "QAAlignedPrecision-BERTScore (Question & Answer Generation (with Gold Answer))"}, {"type": "qa_aligned_f1_score_moverscore_question_answer_generation_with_gold_answer", "value": 53.55, "name": "QAAlignedF1Score-MoverScore (Question & Answer Generation (with Gold Answer))"}, {"type": "qa_aligned_recall_moverscore_question_answer_generation_with_gold_answer", "value": 55.82, "name": "QAAlignedRecall-MoverScore (Question & Answer Generation (with Gold Answer))"}, {"type": "qa_aligned_precision_moverscore_question_answer_generation_with_gold_answer", "value": 51.56, "name": "QAAlignedPrecision-MoverScore (Question & Answer Generation (with Gold Answer))"}, {"type": "bleu4_answer_extraction", "value": 82.63, "name": "BLEU4 (Answer Extraction)"}, {"type": "rouge_l_answer_extraction", "value": 95.72, "name": "ROUGE-L (Answer Extraction)"}, {"type": "meteor_answer_extraction", "value": 71.18, "name": "METEOR (Answer Extraction)"}, {"type": "bertscore_answer_extraction", "value": 99.76, "name": "BERTScore (Answer Extraction)"}, {"type": "moverscore_answer_extraction", "value": 98.8, "name": "MoverScore (Answer Extraction)"}, {"type": "answer_f1_score__answer_extraction", "value": 95.15, "name": "AnswerF1Score (Answer Extraction)"}, {"type": "answer_exact_match_answer_extraction", "value": 95.07, "name": "AnswerExactMatch (Answer Extraction)"}]}]}]}
transformers pytorch mt5 text2text-generation question generation answer extraction zh dataset:lmqg/qg_zhquad arxiv:2210.03992 license:cc-by-4.0 model-index autotrain_compatible endpoints_compatible text-generation-inference region:us