Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,107 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
# Fine-Tuned BERT Model for Misinformation Classification
|
6 |
+
**Model type**: BERT (Bidirectional Encoder Representations from Transformers)
|
7 |
+
**Architecture**: Fine-tuned BERT-base
|
8 |
+
**Task**: Text Classification
|
9 |
+
|
10 |
+
|
11 |
+
## Model Description
|
12 |
+
This model is a fine-tuned version of [BERT-base](https://huggingface.co/bert-base-uncased) trained on a synthetic dataset generated to tackle classification of chatbot responses as `false`, `partially true`, `mostly true`, and `true` categories.
|
13 |
+
|
14 |
+
|
15 |
+
## Datasets Used
|
16 |
+
This model was fine-tuned using the [Synthetic Text Classification Dataset](https://huggingface.co/datasets/Intel/misinformation-guard-synthetic) and evaluated on the [Synthetic Benchmark Dataset](https://huggingface.co/datasets/Intel/misinformation-guard-benchmark).
|
17 |
+
|
18 |
+
### Key Features:
|
19 |
+
- Fine-tuned on a synthetic dataset created for misinformation multi-label classification.
|
20 |
+
- Designed to perform well on text related to health and medicine, politics and government, climate change and environmental issues, science and technology, conspiracy theories, economics and financial markets, social and cultural issues, and technology and AI.
|
21 |
+
|
22 |
+
### Use Cases:
|
23 |
+
- Identify misinformation in text.
|
24 |
+
- Protection against adversarial attacks.
|
25 |
+
|
26 |
+
## Description of labels
|
27 |
+
- **false**: Completely untrue or fabricated information.
|
28 |
+
- **partially true**: Contains some truth but is misleading or lacks important context.
|
29 |
+
- **mostly true**: Largely accurate but may have minor inaccuracies or omissions.
|
30 |
+
- **true**: Entirely accurate and factual information.
|
31 |
+
|
32 |
+
|
33 |
+
## Model Details
|
34 |
+
- **Training Data**: This model was trained on the [MisInformation Guard dataset](https://huggingface.co/datasets/Intel/misinformation-guard), a synthetic dataset generated specifically for multi-label classification of text according to misinformation.
|
35 |
+
- **Base Model**: The base model is [BERT-base](https://huggingface.co/bert-base-uncased), with 12 layers, 110M parameters.
|
36 |
+
- **Fine-tuning Process**: Fine-tuning was performed on misinformation-guard synthetic dateset for 5 epochs, using learning rate 2e-05, with AdamW optimizer that is the default optimizer in Hugging Face `Trainer` framework with weight decay. The best hyperparameters for fine-tuning were selected by a grid search on the following grid:
|
37 |
+
|
38 |
+
```python
|
39 |
+
param_grid = {
|
40 |
+
'learning_rate': [5e-5, 3e-5, 2e-5],
|
41 |
+
'per_device_train_batch_size': [16, 32],
|
42 |
+
'num_train_epochs': [3, 4, 5],
|
43 |
+
}
|
44 |
+
```
|
45 |
+
|
46 |
+
Early stopping and model checkpointing were used in fine-tuning BERT to ensure optimal training.
|
47 |
+
|
48 |
+
### Performance
|
49 |
+
|
50 |
+
Here are the key performance metrics for both the synthetic data and the manually annotated benchmark dataset:
|
51 |
+
|
52 |
+
- **F1-Score**: 86% on the misinformation-guard synthetic dataset.
|
53 |
+
|
54 |
+
|
55 |
+
## How to Use
|
56 |
+
|
57 |
+
This fine-tuned BERT model can be used for categorizing text into classes `false`, `partially true`, `mostly true`, and `true`.
|
58 |
+
|
59 |
+
```python
|
60 |
+
from transformers import pipeline
|
61 |
+
|
62 |
+
classifier = pipeline("text-classification", "Intel/misinformation-guard")
|
63 |
+
text = "Your input text"
|
64 |
+
output = classifier(text)
|
65 |
+
print(output)
|
66 |
+
```
|
67 |
+
|
68 |
+
### Load the model and tokenizer:
|
69 |
+
|
70 |
+
```python
|
71 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
72 |
+
|
73 |
+
tokenizer = AutoTokenizer.from_pretrained("Intel/misinformation-guard")
|
74 |
+
model = AutoModelForSequenceClassification.from_pretrained("Intel/misinformation-guard")
|
75 |
+
|
76 |
+
# Example usage
|
77 |
+
inputs = tokenizer("Your input text", return_tensors="pt")
|
78 |
+
outputs = model(**inputs)
|
79 |
+
```
|
80 |
+
|
81 |
+
|
82 |
+
## Join the Community
|
83 |
+
If you are interested in exploring other models, join us in the Intel and Hugging Face communities.
|
84 |
+
These models simplify the development and adoption of Generative AI solutions, while fostering innovation among developers worldwide.
|
85 |
+
If you find this project valuable, please like ❤️ it on Hugging Face and share it with your network.
|
86 |
+
Your support helps us grow the community and reach more contributors.
|
87 |
+
|
88 |
+
|
89 |
+
## Disclaimer
|
90 |
+
Misinformation Guard has been trained and validated on a limited set
|
91 |
+
of synthetically generated data. Accuracy metrics cannot be guaranteed
|
92 |
+
outside these narrow use cases, and therefore this tool should be
|
93 |
+
validated within the specific context of use for which it might be deployed.
|
94 |
+
This tool is not intended to be used to evaluate employee performance.
|
95 |
+
This tool is not sufficient to prevent harm in many contexts, and additional
|
96 |
+
tools and techniques should be employed in any sensitive use case where
|
97 |
+
misinformation may cause harm to individuals, communities, or society.
|
98 |
+
|
99 |
+
|
100 |
+
## Citation
|
101 |
+
If you use this model, please cite:
|
102 |
+
@misc{Intel_misinformation-guard_2024,
|
103 |
+
author = {Murilo Gustineli https://github.com/murilogustineli},
|
104 |
+
title = {Misinformation Guard},
|
105 |
+
year = {2024},
|
106 |
+
url = {https://huggingface.co/Intel/misinformation-guard},
|
107 |
+
}
|