Skip to content

Unofficial implementation of the paper: Learning to Generate Question by Asking Question: A Primal-Dual Approach with Uncommon Word Generation

License

Notifications You must be signed in to change notification settings

Shashwath-kumar/Question-Generation-by-Asking-Questions

Repository files navigation

Generate Question by Asking Question: A Primal-Dual Approach with Uncommon Word Generation

This project implements a unified primal-dual framework for automatic question generation and question answering, designed to produce high-quality, relevant questions from passages and answers.

Table of Contents

Overview

The framework combines question generation (primal) with question answering (dual) and consists of three main components:

  • Question generation: Jointly encodes answer and passage, produces question
  • Question answering: Re-asks generated question to ensure target answer is obtained
  • Knowledge distillation: Improves generalization ability for generating uncommon words

Finetuned model

  • QG model finetuned on SQuAD dataset. link

Requirements

To install the required dependencies, run:

pip install -r requirements.txt

Usage

  1. To train the model, run:
python train.py
  1. To evaluate the model with BLEU score, run:
python eval.py
  1. To perform inference with the trained model, run:
python inference.py
  1. The demo.ipynb notebook provides an interactive environment to test the model.

References

This is an unofficial implementation of the following EMNLP paper:

@inproceedings{wang-etal-2022-learning-generate,
    title = "Learning to Generate Question by Asking Question: A Primal-Dual Approach with Uncommon Word Generation",
    author = "Wang, Qifan  and
      Yang, Li  and
      Quan, Xiaojun  and
      Feng, Fuli  and
      Liu, Dongfang  and
      Xu, Zenglin  and
      Wang, Sinong  and
      Ma, Hao",
    booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing",
    month = dec,
    year = "2022",
    address = "Abu Dhabi, United Arab Emirates",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.emnlp-main.4",
    pages = "46--61",
}