This repository is dedicated to modeling change in semantic plausibility with the use of large language models and the ADEPT dataset.
The dataset_analysis folder contains the adept_dataset_analysis jupyter notebook. It provides a first look at the data using descriptive statistics (first submission).
The sentence-transformer folder contains the code for fine-tuning a pre-trained sentence transformer model based on MPNet on the ADEPT dataset and the code for the model's performance evaluation. There are two files: notebook_sentence-transformer.ipynb and train_and_evaluate_sentence-transformer.py. The first one is a Jupyter notebook. It's meant for familiarizing oneself with the code as it walks the user through it step by step and shows the intermediate outputs. The second file contains the same code but formatted for streamlining and easy execution.
The transformer folder contains the code for fine-tuning pre-trained transformer models (BERT, DeBERTa, RoBERTa, MPNet) on the ADEPT dataset with performance evaluation. Same as the sentence-transformer folder, the transformer folder contains a Jupyter notebook with comments and the same code as a Python executable file.
The llm folder contains the code for evaluating Mistral-7B-Instruct-v0.3 on the ADEPT test and dev sets in a zero-shot setting. Same as the sentence-transformer folder, the llm folder contains a Jupyter notebook with comments and the same code as a Python executable file.
The significance_testing folder contains the Jupyter notebook for running the significance testing on model performance metrics and resulting model ranking.
To run the code, please do the following:
- Make sure your installation of Python is >version 3.10< or higher. If necessary, update Python.
- Clone the repository to your system with
git clone - Go to the repository directory:
cd Adjectival-Modification-Semantic-Plausibility - Download the ADEPT dataset and put it in the "datasets/adept/train-dev-test-split/" subfolder.
- Install the project dependencies:
pip install -r requirements.txt - Follow the instructions to install
pytorch. - To run one of the Jupyter notebooks, use this command:
jupyter notebook. The Jupyter interface will open in a browser window, where you can navigate through the file system and choose a notebook to run. - To train and evaluate a transformer model, run:
python transformer/train_and_evaluate_transformer.py - To train and evaluate the sentence-transformer model, run:
python sentence-transformer/train_and_evaluate_sentence-transformer.py - To evaluate the zero-shot LLM Mistral, run:
python llm/llm_zero_shot.py
The code is partially based on these tutorials:
- BERT Fine-Tuning Tutorial with PyTorch By Chris McCormick and Nick Ryan
- The documentation for semantic textual similarity on SBERT.net, the source of the sentence-transformer.