Coder Social home page Coder Social logo

negation-and-nli's Introduction

Negation and Natural Language Inference

This repository contains code of the EMNLP2020 paper "An Analysis of Natural Language Inference Benchmarks through the Lens of Negation". Paper link: https://www.aclweb.org/anthology/2020.emnlp-main.732.pdf
Authors: Md Mosharaf Hossain, Venelin Kovatchev, Pranoy Dutta, Tiffany Kao, Elizabeth Wei and Eduardo Blanco

Data Requirements

Download RTE, SNLI, and MNLI using "download_glue_data.py" script of https://github.com/nyu-mll/GLUE-baselines.

python ./data/download_glue_data.py --data_dir ./data/GLUE --tasks RTE,SNLI,MNLI

Python Requirements

Python 3.6+ (Recommended: Python 3.7)
Python packages: list of packages are provided in ./env-setup/requirements.txt file.
(We used an older version of the huggingface transformers (version 2.1.1) package).

# Create virtual env (Assuming you have Python 3.7 installed in your machine) -> optional step
python3 -m venv your_location/negation-and-nli
source your_location/negation-and-nli/bin/activate

# Install required packages -> required step
pip install -r ./env-setup/requirements.txt

Fine-tune Transformer systams and evaluate on the original dev splits

At the very begining, below directories need to be created. The predicted labels are saved in "outputs/predictions" directory and the fine-tuned models are saved in the "outputs/models" directory.

mkdir outputs
mkdir outputs/predictions
mkdir outputs/models

Fine-tune the transformers using RTE training split and evaluate on the RTE dev split:

sh rte-train.sh

Fine-tune the transformers using SNLI training split and evaluate on the SNLI dev split:

sh snli-train.sh

Fine-tune the transformers using MNLI training split and evaluate on the MNLI dev split:

sh mnli-train.sh

Evaluate the fine-tuned systems on new benchmarks containing negations

Evaluate on new RTE benchmark

sh rte-evaluate.sh

Evaluate on new SNLI benchmark

sh snli-evaluate.sh

Evaluate on new MNLI benchmark

sh mnli-evaluate.sh

Results

Results (Table 7 of our paper) can be achieved by the below script.

  python evaluate.py --corpus corpus_name
  • Arguments: --corpus: Name of the corpus (e.g., rte or snli or mnli)

New NLI benchmarks containing negation

The annotation files of the new NLI benchmarks containing negation are given below.
RTE: ./data/new_benchmarks/clean_data/RTE.txt
SNLI: ./data/new_benchmarks/clean_data/SNLI.txt
MNLI: ./data/new_benchmarks/clean_data/MNLI.txt

Reference

@inproceedings{hossain-etal-2020-analysis,
    title = "An Analysis of Natural Language Inference Benchmarks through the Lens of Negation",
    author = "Hossain, Md Mosharaf  and
      Kovatchev, Venelin  and
      Dutta, Pranoy  and
      Kao, Tiffany  and
      Wei, Elizabeth  and
      Blanco, Eduardo",
    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
    month = nov,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.emnlp-main.732",
    pages = "9106--9118",
}

negation-and-nli's People

Contributors

mosharafhossain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.