Downloads · 30 days
0
RibhavOjha/bert-evidence-detection
bert-evidence-detection is a machine learning model from RibhavOjha. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
language: en license: cc-by-4.0 tags: - pairwise-sequence-classification-evidence-detection repo: https://github.com/RibhavOjha/NLUed ---
Downloads · 30 days
0
Access
Public
Updated Apr 24, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md5.1 KB · 77%
From the Hugging Face model README
language: en license: cc-by-4.0 tags:
This is a classification model that was trained to detect, given a pair of claim and evidence, if the evidence supports or refutes the claim.
This model is based upon a BERT model that was fine-tuned on 23.7K pairs of texts as a part of the ED (Evidence Detection) dataset.
This model is intended for the task of pairwise sequence classification for ED. It can be further finetuned on related pairwise sequence classification tasks.
23702 pairs of texts given in the coursework
First, all the necessary libraries are imported such as pytorch, huggingface transformer, sklearn and pandas. Then, the data is loaded from the csv file. The data is made compatible with what BERT expects by making a custom dataset class. Just fine-tuning the model without modifications yielded an accuracy of 86% on the dev dataset. Different batch sizes, learning rates, and model architectures were experimented with. First, the training data was split into training and validation. This was done to keep track of model's performance while training. Next, the trained model was tested on the dev dataset. Finally, the predictions were generated using the test dataset.
To improve the performance, we added a dropout and a linear classification layer on top of the existing BERT model. This helped in reducing the overfitting of the data. This helped to improve the model accuracy to 88% on the dev dataset. We use Adam optimizer and CrossEntropyLoss as our loss function.
- learning_rate: 2e-05
- train_batch_size: 8
- eval_batch_size: 8
- num_epochs: 1
- max_length: 128
- optimizer: Adam
- overall training time: 30 minutes
- duration per training epoch: 30 minutes
- model size: 417MB
A subset of the development set provided, amounting to 5926 pairs.
- Precision
- Recall
- F1-score
- Accuracy
- Support
- Macro Average
- Weighted Average
The model obtained an F1-score of 92% for irrelvant pairs, and 77% for relevant pairs. The model obtained an accuracy of 88.12%. The macro avg and weighted avg numbers are close to each other, suggesting that the model's performance is consistent across classes and considering the class distribution. An F1-score of 0.88 indicates a good balance between precision and recall, considering both the macro avg and weighted avg.
- GPU: T4
- Transformers 4.18.0
- Pytorch 1.11.0+cu113
Any inputs (concatenation of two sequences) longer than 512 subwords will be truncated by the model. BERT can be susceptible to biases in its training dataset. This is important to consider to create more inclusive and ethical AI systems. BERT also requires high computational resources. This makes it less accessible to organizations with limited budget.
Another limitation is that this model is trained on a relatively small dataset. It might perform poorly when tested on other datasets.
The hyperparameters were determined by experimentation with different values.