Natural Language Inferencing (NLI) Task: Demonstration Using Kaggle Dataset


· Basics of NLP

· Moderate Python coding

What is NLI?

How NLI is different from NLP?

Figure 1: NLP vs NLI. (Source )

Applications of NLI

Models used to Demonstrate NLI Task

Masked LM

Next Sentence Prediction

Model Input

Figure 2: BERT input representation [1]

Model Output

Figure 3: Pre-training procedure of BERT [1]
Figure 4: Illustration for BERT fine-tuning on sentence pair specific tasks like MNLI, QQP, QNLI, RTE, SWAG etc. [1]

BERT GLUE Task Results

Figure 5: GLUE test results [1]
Figure 6: Static vs Dynamic masking results [2]
Figure 7: Model results in comparison when different input formats are used [2]
Figure 8: Model results when trained with different batch sizes [2]

RoBERTa Results on GLUE Tasks

Figure 9: RoBERTa results on GLUE tasks. [2]
Figure 10: XLM-R results on XNLI dataset. [3]

Demonstration of NLI Task Using Kaggle Dataset

Code Flow:





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Affine is a provider of analytics solutions, working with global organizations solving their strategic and day to day business problems