Shaip161/SPRL

Semantic Proto-Role Labelling using Natural Language Inference

0

stars

7

commits

HTML

primary language

Jun 13, 2024

updated

README

Semantic Proto-role Labelling using Natural Language Inference

This Repository contains a viable, novel method for Semantic Proto-role Labelling (SPRL) using Natural Language Inference (NLI). We provide formatted SPRL datasets, a SPRL-finetuned variant of roberta-large-mnli and a logistic regressor to solve the binary classification problem of SPRL. By predicting the entailment of a given property set meant to identify agent- and patientlike qualities of a given argument in a given input sentence, we create an entailment vector functioning as the SPRL model's input. We evaluate the resulting models using state-of-the-art frameworks, baselines and various robustness tests and observe performance in line with the state-of-the-art.

Table of Contents

Authors

Getting Started

In order to get started, clone the repository as follows:

  • git clone https://github.com/Shaip161/SPRL.git --recursive

Use --recursive to clone the roberta-large-mnli submodule as well.

After cloning the repository, create a Python virtual environment in the project directory. This isolates the project dependencies from the global Python environment. Use the following command:

  • python -m venv my_venv

After that, activate the virtual envirnment using the commands:

  • On Windows: my_venv\Scripts\activate
  • On macOS and Linux: source my_venv/bin/activate

With the virtual environment activated, install all required Python packages specified in the requirements.txt file:

  • pip install -r requirements.txt

Concept

In previous work, sets of 14 to 18 properties were applied to target arguments in SPRL tasks. On this basis, sentences were generated with statements postulating the observed argument have that property. We use these sentences as entailment hypotheses and use an NLI model to classify the entailment of this hypothesis in the observed sentence. The NLI model is finetuned on Likert-Scale data: Human annotators annotate each hypothesis with a value of 1 - 5. These annotations infer gold labels for the NLI task.

SPRL-Model

Given the likelihoods of entailment and contradiction for each hypothesis and a gold label based on VerbNet thematic roles, the SPRL model regresses on a weight vector to solve the binary classification into proto-agent and proto-patient.

Data

We used Reisinger's SPR1 and White's SPR2 dataset to create our own datasets (json files) for later use:

Generally, reis.json, reis_labelled.json, spr1.json, spr2.json, spr2_1.json, spr2_no_pilot.json all consist of the following information:

  • applicable: Whether the property is applicable in principle to the argument in question; either True or False.
  • property: The proto-role property being annotated.
  • label: The 5-point Likert scale annotation of the property, where 1 means very unlikely and 5 means very likely.
  • sentence: The base sentence, which we will later use as the premise.
  • split: The training split used in training the model, either train, dev, or test.
  • arg: The argument in the sentence.
  • pred: The predicate in the sentence.
  • gram_func: The grammatical function of the argument. subj, obj or other for Reisinger and nsubj, nsubjpass, dobj or iobj for White.
Reis.json

reis.json was created using Reisinger's SPR1 data to finetune RoBERTa. It additionally contains the following entries:

  • roleset: The propbank roleset of the predicate.
  • arg_num: The propbank argument label; either 0, 1, 2, 3, 4 or 5.

It consists of 6363 entries using 18 different properties.

Reis_labelled.json

reis_labelled.json is the subset of entries in reis.json on which we could find a VerbNet entry for the giving roleset using NLTK. We use this data to train weights for the different property features and also to evaluate how good a model is at the SPRL task. It additionally contains the following entry:

  • is_agent: Denotes if the given argument is of proto-agent status in the given sentence; either 0 or 1. It consists of 2715 entries using the same properties as reis.json.
spr1.json, spr2.json, spr2_1.json

spr1.json, spr2.json, spr2_1.json were created using White's SPR2 data. They are mainly used for finetuning RoBERTa and additionally have the following entry:

  • ispilot: Whether the annotation was part of a pilot or not; either True or False. Pilot annotations pass the filters introduced by Reisinger et al. They respectively consist of 92, 2850 and 1396 entries. Between the three there are however duplicates. spr1.json uses 16 different properties, whereas the remaining two use 14 properties.
spr2_no_pilot.json

spr2_no_pilot.json consists of all spr2.json entries with ispilot = False. It is used for ablation studies. It consists of 2758 entries.

Duplicates

There are sentences which got annotated by multiple annotators. To not have duplicate (premise, hypothesis) pairs and decrease overall finetuning duration, we also use variations of the above datasets where we average over all the labels for a given property.

Weight training

To train the weights of our different properties we created files of the format "model_predictions.json" containing 2715 datapoints which each consist of the following entries:

  • is_agent: Denotes if the given argument is of proto-agent status in the given sentence; either 0 or 1.
  • split: The training split used in training the model, either train, dev, or test.
  • roberta_entailments: The likelihood of entailment which the model returned for a (premise, hypothesis) pair on a given property.
  • roberta_contradictions: The likelihood of contradiction which the model returned for a (premise, hypothesis) pair on a given property.

Training

We finetuned RoBERTa and trained our SPRL model separately, as the SPRL training data had to include the entailment predictions. Due to the sequential nature of this training process, it was not only computationally intensive, but also time-intensive. Thus, a bug which impacted performance of the SPRL model greatly was noticed shortly before the project deadline.

RoBERTa

As our base model we used roberta-large-mnli, which is the RoBERTa large model fine-tuned on the Multi-Genre Natural Language Inference (MNLI) corpus. We use this model to maximize performance on the NLI task needed during the finetuning process.

Procedure

To generate train, test and dev data with gold labels from our own datasets (json) which use likert scale data, we did the following procedure:

We iterate through all datapoints in our dataset. We create the pair of (premise, hypothesis) as follows:

  • premise: The sentence of the datapoint.
  • hypothesis: Created using template hypotheses which use the argument (ARG) and predicate (PRED) of the datapoint. Example for "instigation": "ARG caused PRED to happen."

If a property is deemed applicable in its context, we denote the gold label as 'entailment' if the likert label is >= 4 for the given property and 'contradiction' if the likert label is < 4. If a property is not deemed applicable, we denote the gold label as 'neutral'.

We chose to handle gold labels this way, since non-applicable properties don't provide a feasible likert label for us to use.

Training Arguments

We finetuned the roberta-large-mnli model using Hugging Face's transformer library Trainer class using the following TrainingArguments:

  • num_train_epochs=3 Note: We used 2 epochs on roberta_retrained_non-averaged due to the finetuning process already taking a lot of time.
  • per_device_train_batch_size=16
  • per_device_eval_batch_size=64
  • warmup_steps=500
  • weight_decay=0.01
Models

We finetuned 5 different models:

  • roberta_averaged: Uses averaged versions of reis.json, spr1.json, spr2.json, spr2_1.json.
  • roberta_non-averaged: Uses non-averaged reis.json, spr1.json, spr2.json, spr2_1.json.
  • roberta_reisinger: Uses averaged version of reis.json.
  • roberta_white: Uses averaged version of spr1.json, spr2.json, spr2_1.json.
  • roberta_no-pilot: Uses averaged version of spr2_no_pilot.json.

SPRL-model

Given a model and an instance of our reis_labelled.json, we tackle the SPRL task in the following way:

We use the given model to compute entailment and prediction likelihoods for all 18 properties. We then calculate the dot product of these 36 features with 36 weights, whilst adding an bias. After that, we use the sigmoid function on the result; a value >= 0.5 returns proto-agent as predicted, a value < 0.5 returns proto-patient as predicted.

To get the weights and bias, we created "model_predictions.json" files as mentioned in Data. We then used the scikit-learn library to create a Logistic Regression linear model for training the weights and bias on our train data. We also tried a Support Vector Machine model to make sure we get a good linear decision boundary whilst using Logistic Regression, which turned out to produce the same accuracy. We additionally directly computed weights using the likert scale data from our dataset, but this turned out to overall have significantly worse accuracy.

Evaluation

In the following section we will introduce 3 evaluation techniques and results in order to objectively compare the trained models with one another.

Quantitative

The Quantitative technique includes:

  • Overall accuracy, to calculate the proportion of correct predictions across all categories.
  • The F1 score, which balances precision and recall, reflecting the model's reliability in positive case identification.
  • Average Log Loss in order to measure prediction certainty, with lower values indicating higher accuracy.
  • Class-specific accuracy to assess the model's performance in individual categories, identifying potential biases or weaknesses.

The results from our different models:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta-large-mnli0.82091503267973850.83190184049079760.439941782007794270.94428969359331470.7118226600985221
roberta_averaged0.75686274509803920.78669724770642190.54939200160254090.95543175487465180.5812807881773399
roberta_non-averaged0.70196078431372540.74382022471910110.61780362016139780.92200557103064060.5073891625615764
roberta_reisinger0.74117647058823530.76976744186046520.53189264445181630.92200557103064060.5812807881773399
roberta_no-pilot0.76209150326797380.78837209302325580.55090382030010450.94428969359331470.6009852216748769
roberta_white0.4692810457516340.63879003558718860.88620937289934341.00.0

Robustness

To test the robustness of our models, we have carried out:

  • An ablation study, where we systematically remove a specific part of our models to understand its impact on performance. We did this by removing all dataset entries, where the isPilot tag set to true from the SPR2 dataset. This is because these sentences were particularly well suited for entailment questions. By removing them, we have not only reduced the dataset on which the model can train, but we have also removed the sentence where the entailment questions are ideal.
  • Adversarial testing. Here we want to evaluate how our models perform against carefully crafted adversarial examples to test the limits of their understanding. These hand-crafted sentences include, for example, various biases such as gender bias, where a male is generally more likely to be a proto-agent than a female.
  • Out of distribution tests, where we test the models on data that is significantly different from the training distribution. This data includes hand-crafted nonsensical sentences that were not used in the training of our models.

The results of the Adversial Evaluation method using the wights obtained from logistical regression:

The control dataset result

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.70.76923076923076930.4516833029680911.00.4
roberta_non-averaged0.70.76923076923076930.79100627799217791.00.4
roberta_no-pilot0.950.95238095238095230.2032423667532671.00.9
roberta_reisinger0.850.86956521739130440.30827068325834921.00.7
roberta_white0.50.66666666666666660.83689795427197531.00.0
roberta-large-mnli0.90.90909090909090910.238558407928021.00.8

The bias dataset results:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.70.76923076923076930.44898234903946521.00.4
roberta_non-averaged0.70.76923076923076930.81503261489108811.00.4
roberta_no-pilot0.90.90909090909090910.2232136268420371.00.8
roberta_reisinger0.80.83333333333333330.314463676021311531.00.6
roberta_white0.50.66666666666666660.85026377753151891.00.0
roberta-large-mnli0.850.86956521739130440.28072924377701471.00.7

The results of the Out of Distribution method using the wights obtained from logistical regression:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.550.68965517241379310.50936671886595851.00.1
roberta_non-averaged0.60.63636363636363650.77486671163205690.70.5
roberta_no-pilot0.80.74999999999999990.37365042217588170.61.0
roberta_reisinger0.850.85714285714285720.297985117482032660.90.8
roberta_white0.50.66666666666666660.81950117163496981.00.0
roberta-large-mnli0.750.80.49214527782763621.00.5

Interpretability

To understand the decision-making of our SPRL-model, we inspect the weights learned from training: As the entailment of certain properties indicates proto-agenthood, those properties recieve large, positive entailment weights. In turn, proto-patient-related property entailment weights recieve large, positive weights as well. By this system, a largely coherent mapping to proto-agent and proto-patient properties can be extracted.

Additionally, we observe token importance in our RoBERTa variant models to understand which part of an input sentence is used to infer the queried properties. We perform these observations using transformers-interpret on multiple examples for multiple properties, including sentience and change of state.

Legend: Negative Neutral Positive
Prediction ScoreAttribution LabelAttribution ScoreWord Importance
(0.18)CONTRADICTION-0.85 He listens imp ass ively . He was / were sentient .
(0.63)NEUTRAL0.72 He listens imp ass ively . He was / were sentient .
(0.74)ENTAILMENT0.58 He listens imp ass ively . He was / were sentient .
Legend: Negative Neutral Positive
Prediction ScoreAttribution LabelAttribution ScoreWord Importance
(0.81)CONTRADICTION1.23 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .
(0.73)NEUTRAL2.37 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .
(0.08)ENTAILMENT-2.51 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .

Using ferret, we are able to not only explain the entailment prediction of the property sentience for "He listens impassively.", but also evaluate the explanation by observing correlation between state-of-the-art explainability methods.

 aopc_compraopc_sufftaucorr_loo
Partition SHAP0.17-0.050.45
LIME0.16-0.150.30
Gradient0.010.07-0.09
Gradient (x Input)0.09-0.050.18
Integrated Gradient0.04-0.120.21
Integrated Gradient (x Input)-0.040.15-0.39
HeĠlistensĠimpassivelyĠ.ĠHeĠwas/wereĠsentient.
Partition SHAP0.0813150.045069-0.1048780.0579990.0565980.0394220.004542-0.0516740.056328-0.1181040.3284090.055659
LIME0.177724-0.022607-0.1022710.0488180.0114050.0092880.1305280.0837960.0180730.0011130.2613910.132987
Gradient0.0391010.0462830.0475390.0598780.0551530.0319570.0440650.0511850.0347780.0637440.3600320.056943
Gradient (x Input)0.1375610.070364-0.064036-0.1850720.095231-0.012394-0.022001-0.129332-0.023433-0.0352980.1791820.002415
Integrated Gradient0.064614-0.067027-0.0966240.024009-0.037160-0.124285-0.0404440.0883290.0955350.043687-0.201441-0.011098
Integrated Gradient (x Input)-0.0127210.0128190.0807710.0250400.107646-0.1487540.2377720.071891-0.068089-0.0108410.220317-0.003338

Conclusion

We conclude that the approach to SPRL using NLI has merit, as one of our non-averaged model variants can compete with state-of-the-art baselines on similar datasets. However, our method, especially using roberta-large-mnli is immensely computationally intensive and requires large amounts of data. We therefore see great potential for improvement.

Future Work

  • A refinement of the entailment hypotheses to conform to grammar rules may constitute a large improvement in entailment accuracy, which can incite improvement in the SPRL model. -- Note: Shortly before the project deadline, a bug was found in the averaging algorithm, which impacted performance greatly: applicability values were assumed True/False instead of the actual yes/no values.
  • As by far not all sentences in the Reisinger dataset had corresponding PropBank-roleset - VerbNet-class pairs in nltk, a large amount of data could not be labelled. Using newer or different resources may increase the available amount of data.
  • The PropBank predominantly contains financial data, and may therefore be suboptimally representative of the English language in general. The use of a different dataset, which matches the target distribution better, may improve performance and may be more robust towards out-of-distribution data.

Acknowledgements

We thank our Professor, Dr. Anette Frank, as well as the Institute for Computational Linguistics of the Heidelberg University, for the support we were given and especially the access to resources like the PennTreeBank. This work would not have been possible if not for the written guidance of Reisinger et al. and White et al., who provided the SPR1 and SPR2 datasets. This project additonally powered by huggingface and its provided libraries, the PennTreeBank, PropBank, VerbNet and nltk.

License

We give out our work under the MIT License.

Contributors

Shaip161

7 commits

Shaip161/SPRL

Semantic Proto-Role Labelling using Natural Language Inference

0

stars

7

commits

HTML

primary language

Jun 13, 2024

updated

README

Semantic Proto-role Labelling using Natural Language Inference

This Repository contains a viable, novel method for Semantic Proto-role Labelling (SPRL) using Natural Language Inference (NLI). We provide formatted SPRL datasets, a SPRL-finetuned variant of roberta-large-mnli and a logistic regressor to solve the binary classification problem of SPRL. By predicting the entailment of a given property set meant to identify agent- and patientlike qualities of a given argument in a given input sentence, we create an entailment vector functioning as the SPRL model's input. We evaluate the resulting models using state-of-the-art frameworks, baselines and various robustness tests and observe performance in line with the state-of-the-art.

Table of Contents

Authors

Getting Started

In order to get started, clone the repository as follows:

  • git clone https://github.com/Shaip161/SPRL.git --recursive

Use --recursive to clone the roberta-large-mnli submodule as well.

After cloning the repository, create a Python virtual environment in the project directory. This isolates the project dependencies from the global Python environment. Use the following command:

  • python -m venv my_venv

After that, activate the virtual envirnment using the commands:

  • On Windows: my_venv\Scripts\activate
  • On macOS and Linux: source my_venv/bin/activate

With the virtual environment activated, install all required Python packages specified in the requirements.txt file:

  • pip install -r requirements.txt

Concept

In previous work, sets of 14 to 18 properties were applied to target arguments in SPRL tasks. On this basis, sentences were generated with statements postulating the observed argument have that property. We use these sentences as entailment hypotheses and use an NLI model to classify the entailment of this hypothesis in the observed sentence. The NLI model is finetuned on Likert-Scale data: Human annotators annotate each hypothesis with a value of 1 - 5. These annotations infer gold labels for the NLI task.

SPRL-Model

Given the likelihoods of entailment and contradiction for each hypothesis and a gold label based on VerbNet thematic roles, the SPRL model regresses on a weight vector to solve the binary classification into proto-agent and proto-patient.

Data

We used Reisinger's SPR1 and White's SPR2 dataset to create our own datasets (json files) for later use:

Generally, reis.json, reis_labelled.json, spr1.json, spr2.json, spr2_1.json, spr2_no_pilot.json all consist of the following information:

  • applicable: Whether the property is applicable in principle to the argument in question; either True or False.
  • property: The proto-role property being annotated.
  • label: The 5-point Likert scale annotation of the property, where 1 means very unlikely and 5 means very likely.
  • sentence: The base sentence, which we will later use as the premise.
  • split: The training split used in training the model, either train, dev, or test.
  • arg: The argument in the sentence.
  • pred: The predicate in the sentence.
  • gram_func: The grammatical function of the argument. subj, obj or other for Reisinger and nsubj, nsubjpass, dobj or iobj for White.
Reis.json

reis.json was created using Reisinger's SPR1 data to finetune RoBERTa. It additionally contains the following entries:

  • roleset: The propbank roleset of the predicate.
  • arg_num: The propbank argument label; either 0, 1, 2, 3, 4 or 5.

It consists of 6363 entries using 18 different properties.

Reis_labelled.json

reis_labelled.json is the subset of entries in reis.json on which we could find a VerbNet entry for the giving roleset using NLTK. We use this data to train weights for the different property features and also to evaluate how good a model is at the SPRL task. It additionally contains the following entry:

  • is_agent: Denotes if the given argument is of proto-agent status in the given sentence; either 0 or 1. It consists of 2715 entries using the same properties as reis.json.
spr1.json, spr2.json, spr2_1.json

spr1.json, spr2.json, spr2_1.json were created using White's SPR2 data. They are mainly used for finetuning RoBERTa and additionally have the following entry:

  • ispilot: Whether the annotation was part of a pilot or not; either True or False. Pilot annotations pass the filters introduced by Reisinger et al. They respectively consist of 92, 2850 and 1396 entries. Between the three there are however duplicates. spr1.json uses 16 different properties, whereas the remaining two use 14 properties.
spr2_no_pilot.json

spr2_no_pilot.json consists of all spr2.json entries with ispilot = False. It is used for ablation studies. It consists of 2758 entries.

Duplicates

There are sentences which got annotated by multiple annotators. To not have duplicate (premise, hypothesis) pairs and decrease overall finetuning duration, we also use variations of the above datasets where we average over all the labels for a given property.

Weight training

To train the weights of our different properties we created files of the format "model_predictions.json" containing 2715 datapoints which each consist of the following entries:

  • is_agent: Denotes if the given argument is of proto-agent status in the given sentence; either 0 or 1.
  • split: The training split used in training the model, either train, dev, or test.
  • roberta_entailments: The likelihood of entailment which the model returned for a (premise, hypothesis) pair on a given property.
  • roberta_contradictions: The likelihood of contradiction which the model returned for a (premise, hypothesis) pair on a given property.

Training

We finetuned RoBERTa and trained our SPRL model separately, as the SPRL training data had to include the entailment predictions. Due to the sequential nature of this training process, it was not only computationally intensive, but also time-intensive. Thus, a bug which impacted performance of the SPRL model greatly was noticed shortly before the project deadline.

RoBERTa

As our base model we used roberta-large-mnli, which is the RoBERTa large model fine-tuned on the Multi-Genre Natural Language Inference (MNLI) corpus. We use this model to maximize performance on the NLI task needed during the finetuning process.

Procedure

To generate train, test and dev data with gold labels from our own datasets (json) which use likert scale data, we did the following procedure:

We iterate through all datapoints in our dataset. We create the pair of (premise, hypothesis) as follows:

  • premise: The sentence of the datapoint.
  • hypothesis: Created using template hypotheses which use the argument (ARG) and predicate (PRED) of the datapoint. Example for "instigation": "ARG caused PRED to happen."

If a property is deemed applicable in its context, we denote the gold label as 'entailment' if the likert label is >= 4 for the given property and 'contradiction' if the likert label is < 4. If a property is not deemed applicable, we denote the gold label as 'neutral'.

We chose to handle gold labels this way, since non-applicable properties don't provide a feasible likert label for us to use.

Training Arguments

We finetuned the roberta-large-mnli model using Hugging Face's transformer library Trainer class using the following TrainingArguments:

  • num_train_epochs=3 Note: We used 2 epochs on roberta_retrained_non-averaged due to the finetuning process already taking a lot of time.
  • per_device_train_batch_size=16
  • per_device_eval_batch_size=64
  • warmup_steps=500
  • weight_decay=0.01
Models

We finetuned 5 different models:

  • roberta_averaged: Uses averaged versions of reis.json, spr1.json, spr2.json, spr2_1.json.
  • roberta_non-averaged: Uses non-averaged reis.json, spr1.json, spr2.json, spr2_1.json.
  • roberta_reisinger: Uses averaged version of reis.json.
  • roberta_white: Uses averaged version of spr1.json, spr2.json, spr2_1.json.
  • roberta_no-pilot: Uses averaged version of spr2_no_pilot.json.

SPRL-model

Given a model and an instance of our reis_labelled.json, we tackle the SPRL task in the following way:

We use the given model to compute entailment and prediction likelihoods for all 18 properties. We then calculate the dot product of these 36 features with 36 weights, whilst adding an bias. After that, we use the sigmoid function on the result; a value >= 0.5 returns proto-agent as predicted, a value < 0.5 returns proto-patient as predicted.

To get the weights and bias, we created "model_predictions.json" files as mentioned in Data. We then used the scikit-learn library to create a Logistic Regression linear model for training the weights and bias on our train data. We also tried a Support Vector Machine model to make sure we get a good linear decision boundary whilst using Logistic Regression, which turned out to produce the same accuracy. We additionally directly computed weights using the likert scale data from our dataset, but this turned out to overall have significantly worse accuracy.

Evaluation

In the following section we will introduce 3 evaluation techniques and results in order to objectively compare the trained models with one another.

Quantitative

The Quantitative technique includes:

  • Overall accuracy, to calculate the proportion of correct predictions across all categories.
  • The F1 score, which balances precision and recall, reflecting the model's reliability in positive case identification.
  • Average Log Loss in order to measure prediction certainty, with lower values indicating higher accuracy.
  • Class-specific accuracy to assess the model's performance in individual categories, identifying potential biases or weaknesses.

The results from our different models:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta-large-mnli0.82091503267973850.83190184049079760.439941782007794270.94428969359331470.7118226600985221
roberta_averaged0.75686274509803920.78669724770642190.54939200160254090.95543175487465180.5812807881773399
roberta_non-averaged0.70196078431372540.74382022471910110.61780362016139780.92200557103064060.5073891625615764
roberta_reisinger0.74117647058823530.76976744186046520.53189264445181630.92200557103064060.5812807881773399
roberta_no-pilot0.76209150326797380.78837209302325580.55090382030010450.94428969359331470.6009852216748769
roberta_white0.4692810457516340.63879003558718860.88620937289934341.00.0

Robustness

To test the robustness of our models, we have carried out:

  • An ablation study, where we systematically remove a specific part of our models to understand its impact on performance. We did this by removing all dataset entries, where the isPilot tag set to true from the SPR2 dataset. This is because these sentences were particularly well suited for entailment questions. By removing them, we have not only reduced the dataset on which the model can train, but we have also removed the sentence where the entailment questions are ideal.
  • Adversarial testing. Here we want to evaluate how our models perform against carefully crafted adversarial examples to test the limits of their understanding. These hand-crafted sentences include, for example, various biases such as gender bias, where a male is generally more likely to be a proto-agent than a female.
  • Out of distribution tests, where we test the models on data that is significantly different from the training distribution. This data includes hand-crafted nonsensical sentences that were not used in the training of our models.

The results of the Adversial Evaluation method using the wights obtained from logistical regression:

The control dataset result

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.70.76923076923076930.4516833029680911.00.4
roberta_non-averaged0.70.76923076923076930.79100627799217791.00.4
roberta_no-pilot0.950.95238095238095230.2032423667532671.00.9
roberta_reisinger0.850.86956521739130440.30827068325834921.00.7
roberta_white0.50.66666666666666660.83689795427197531.00.0
roberta-large-mnli0.90.90909090909090910.238558407928021.00.8

The bias dataset results:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.70.76923076923076930.44898234903946521.00.4
roberta_non-averaged0.70.76923076923076930.81503261489108811.00.4
roberta_no-pilot0.90.90909090909090910.2232136268420371.00.8
roberta_reisinger0.80.83333333333333330.314463676021311531.00.6
roberta_white0.50.66666666666666660.85026377753151891.00.0
roberta-large-mnli0.850.86956521739130440.28072924377701471.00.7

The results of the Out of Distribution method using the wights obtained from logistical regression:

ModelOverall AccuracyF1Average Log LossProto-Agent Class AccuracyProto-Patient Class Accuracy
roberta_averaged0.550.68965517241379310.50936671886595851.00.1
roberta_non-averaged0.60.63636363636363650.77486671163205690.70.5
roberta_no-pilot0.80.74999999999999990.37365042217588170.61.0
roberta_reisinger0.850.85714285714285720.297985117482032660.90.8
roberta_white0.50.66666666666666660.81950117163496981.00.0
roberta-large-mnli0.750.80.49214527782763621.00.5

Interpretability

To understand the decision-making of our SPRL-model, we inspect the weights learned from training: As the entailment of certain properties indicates proto-agenthood, those properties recieve large, positive entailment weights. In turn, proto-patient-related property entailment weights recieve large, positive weights as well. By this system, a largely coherent mapping to proto-agent and proto-patient properties can be extracted.

Additionally, we observe token importance in our RoBERTa variant models to understand which part of an input sentence is used to infer the queried properties. We perform these observations using transformers-interpret on multiple examples for multiple properties, including sentience and change of state.

Legend: Negative Neutral Positive
Prediction ScoreAttribution LabelAttribution ScoreWord Importance
(0.18)CONTRADICTION-0.85 He listens imp ass ively . He was / were sentient .
(0.63)NEUTRAL0.72 He listens imp ass ively . He was / were sentient .
(0.74)ENTAILMENT0.58 He listens imp ass ively . He was / were sentient .
Legend: Negative Neutral Positive
Prediction ScoreAttribution LabelAttribution ScoreWord Importance
(0.81)CONTRADICTION1.23 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .
(0.73)NEUTRAL2.37 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .
(0.08)ENTAILMENT-2.51 He listens imp ass ively . He was / were altered or somehow changed during or by the end of listens .

Using ferret, we are able to not only explain the entailment prediction of the property sentience for "He listens impassively.", but also evaluate the explanation by observing correlation between state-of-the-art explainability methods.

 aopc_compraopc_sufftaucorr_loo
Partition SHAP0.17-0.050.45
LIME0.16-0.150.30
Gradient0.010.07-0.09
Gradient (x Input)0.09-0.050.18
Integrated Gradient0.04-0.120.21
Integrated Gradient (x Input)-0.040.15-0.39
HeĠlistensĠimpassivelyĠ.ĠHeĠwas/wereĠsentient.
Partition SHAP0.0813150.045069-0.1048780.0579990.0565980.0394220.004542-0.0516740.056328-0.1181040.3284090.055659
LIME0.177724-0.022607-0.1022710.0488180.0114050.0092880.1305280.0837960.0180730.0011130.2613910.132987
Gradient0.0391010.0462830.0475390.0598780.0551530.0319570.0440650.0511850.0347780.0637440.3600320.056943
Gradient (x Input)0.1375610.070364-0.064036-0.1850720.095231-0.012394-0.022001-0.129332-0.023433-0.0352980.1791820.002415
Integrated Gradient0.064614-0.067027-0.0966240.024009-0.037160-0.124285-0.0404440.0883290.0955350.043687-0.201441-0.011098
Integrated Gradient (x Input)-0.0127210.0128190.0807710.0250400.107646-0.1487540.2377720.071891-0.068089-0.0108410.220317-0.003338

Conclusion

We conclude that the approach to SPRL using NLI has merit, as one of our non-averaged model variants can compete with state-of-the-art baselines on similar datasets. However, our method, especially using roberta-large-mnli is immensely computationally intensive and requires large amounts of data. We therefore see great potential for improvement.

Future Work

  • A refinement of the entailment hypotheses to conform to grammar rules may constitute a large improvement in entailment accuracy, which can incite improvement in the SPRL model. -- Note: Shortly before the project deadline, a bug was found in the averaging algorithm, which impacted performance greatly: applicability values were assumed True/False instead of the actual yes/no values.
  • As by far not all sentences in the Reisinger dataset had corresponding PropBank-roleset - VerbNet-class pairs in nltk, a large amount of data could not be labelled. Using newer or different resources may increase the available amount of data.
  • The PropBank predominantly contains financial data, and may therefore be suboptimally representative of the English language in general. The use of a different dataset, which matches the target distribution better, may improve performance and may be more robust towards out-of-distribution data.

Acknowledgements

We thank our Professor, Dr. Anette Frank, as well as the Institute for Computational Linguistics of the Heidelberg University, for the support we were given and especially the access to resources like the PennTreeBank. This work would not have been possible if not for the written guidance of Reisinger et al. and White et al., who provided the SPR1 and SPR2 datasets. This project additonally powered by huggingface and its provided libraries, the PennTreeBank, PropBank, VerbNet and nltk.

License

We give out our work under the MIT License.

Contributors

Shaip161

7 commits

Languages

HTML

56.7%

Python

43.3%