Skip to content

amazon-science/fewshotqa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FewshotQA: A simple framework for few-shot learning of question answering tasks using pre-trained text-to-text models

This is the source code accompanying the EMNLP 2021 paper FewshotQA.

Please download the dataset and install the required dependencies by following the "setup.sh" script.

Example invocation: "cd src/fewshot_qa; python run.py" runs the fine-tuning and reports results for the 128 example scenario on the SQuAD dataset.

For the default seed of 42, you should get a test F1 score of 81.4. This was tested on a p3.2xlarge EC2 instance.

Please cite the paper if you use this material:

@inproceedings{chada-natarajan-2021-fewshotqa,
    title = "{F}ewshot{QA}: A simple framework for few-shot learning of question answering tasks using pre-trained text-to-text models",
    author = "Chada, Rakesh  and
      Natarajan, Pradeep",
    booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing",
    month = nov,
    year = "2021",
    address = "Online and Punta Cana, Dominican Republic",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.emnlp-main.491",
    doi = "10.18653/v1/2021.emnlp-main.491",
    pages = "6081--6090",
    abstract = "The task of learning from only a few examples (called a few-shot setting) is of key importance and relevance to a real-world setting. For question answering (QA), the current state-of-the-art pre-trained models typically need fine-tuning on tens of thousands of examples to obtain good results. Their performance degrades significantly in a few-shot setting ({\textless} 100 examples). To address this, we propose a simple fine-tuning framework that leverages pre-trained text-to-text models and is directly aligned with their pre-training framework. Specifically, we construct the input as a concatenation of the question, a mask token representing the answer span and a context. Given this input, the model is fine-tuned using the same objective as that of its pre-training objective. Through experimental studies on various few-shot configurations, we show that this formulation leads to significant gains on multiple QA benchmarks (an absolute gain of 34.2 F1 points on average when there are only 16 training examples). The gains extend further when used with larger models (Eg:- 72.3 F1 on SQuAD using BART-large with only 32 examples) and translate well to a multilingual setting . On the multilingual TydiQA benchmark, our model outperforms the XLM-Roberta-large by an absolute margin of upto 40 F1 points and an average of 33 F1 points in a few-shot setting ({\textless}= 64 training examples). We conduct detailed ablation studies to analyze factors contributing to these gains.",
}

License

This project is under the CC-BY-NC 4.0 license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published