Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,154 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- nyu-mll/glue
|
5 |
+
- google-research-datasets/paws-x
|
6 |
+
- tasksource/pit
|
7 |
+
- AlekseyKorshuk/quora-question-pairs
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
metrics:
|
11 |
+
- accuracy
|
12 |
+
- f1
|
13 |
+
base_model:
|
14 |
+
- google-bert/bert-base-cased
|
15 |
+
library_name: transformers
|
16 |
+
---
|
17 |
+
|
18 |
+
# Model Card for Fine-Tuned BERT for Paraphrase Detection
|
19 |
+
|
20 |
+
### Model Description
|
21 |
+
This is a fine-tuned version of **BERT-base** for **paraphrase detection**, trained on four benchmark datasets: **MRPC, QQP, PAWS-X, and PIT**. The model is designed for applications such as **duplicate content detection, question answering, and semantic similarity analysis**. It offers strong recall capabilities, making it effective in identifying paraphrases even in complex sentence structures.
|
22 |
+
|
23 |
+
- **Developed by:** Viswadarshan R R
|
24 |
+
- **Model Type:** Transformer-based Sentence Pair Classifier
|
25 |
+
- **Language:** English
|
26 |
+
- **Finetuned from:** `bert-base-cased`
|
27 |
+
|
28 |
+
### Model Sources
|
29 |
+
|
30 |
+
- **Repository:** [Hugging Face Model Hub](https://huggingface.co/viswadarshan06/pd-bert/)
|
31 |
+
- **Research Paper:** _Comparative Insights into Modern Architectures for Paraphrase Detection_ (Accepted at ICCIDS 2025)
|
32 |
+
- **Demo:** (To be added upon deployment)
|
33 |
+
|
34 |
+
## Uses
|
35 |
+
|
36 |
+
### Direct Use
|
37 |
+
- Identifying **duplicate questions** in customer support and FAQs.
|
38 |
+
- Improving **semantic search** in retrieval-based systems.
|
39 |
+
- Enhancing **document deduplication** and text similarity applications.
|
40 |
+
|
41 |
+
### Downstream Use
|
42 |
+
This model can be further fine-tuned on domain-specific paraphrase datasets for industries such as **healthcare, legal, and finance**.
|
43 |
+
|
44 |
+
### Out-of-Scope Use
|
45 |
+
- The model is **monolingual** and trained only on **English datasets**, requiring additional fine-tuning for multilingual tasks.
|
46 |
+
- May struggle with **idiomatic expressions** or complex figurative language.
|
47 |
+
|
48 |
+
## Bias, Risks, and Limitations
|
49 |
+
|
50 |
+
### Known Limitations
|
51 |
+
- **Higher recall but lower precision**: The model tends to over-identify paraphrases, leading to increased false positives.
|
52 |
+
- **Contextual ambiguity**: May misinterpret sentences that require deep contextual reasoning.
|
53 |
+
|
54 |
+
### Recommendations
|
55 |
+
Users can mitigate the **false positive rate** by applying post-processing techniques or confidence threshold tuning.
|
56 |
+
|
57 |
+
## How to Get Started with the Model
|
58 |
+
|
59 |
+
To use the model, install **transformers** and load the fine-tuned model as follows:
|
60 |
+
|
61 |
+
```python
|
62 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
63 |
+
|
64 |
+
# Load the tokenizer and model
|
65 |
+
model_path = "viswadarshan06/pd-bert"
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
67 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
68 |
+
|
69 |
+
# Encode sentence pairs
|
70 |
+
inputs = tokenizer("The car is fast.", "The vehicle moves quickly.", return_tensors="pt", padding=True, truncation=True)
|
71 |
+
|
72 |
+
# Get predictions
|
73 |
+
outputs = model(**inputs)
|
74 |
+
logits = outputs.logits
|
75 |
+
predicted_class = logits.argmax().item()
|
76 |
+
print("Paraphrase" if predicted_class == 1 else "Not a Paraphrase")
|
77 |
+
```
|
78 |
+
|
79 |
+
## Training Details
|
80 |
+
|
81 |
+
This model was trained using a combination of four datasets:
|
82 |
+
|
83 |
+
- **MRPC**: News-based paraphrases.
|
84 |
+
- **QQP**: Duplicate question detection.
|
85 |
+
- **PAWS-X**: Adversarial paraphrases for robustness testing.
|
86 |
+
- **PIT**: Short-text paraphrase dataset.
|
87 |
+
|
88 |
+
### Training Procedure
|
89 |
+
|
90 |
+
- **Tokenizer**: BERT Tokenizer
|
91 |
+
- **Batch Size**: 16
|
92 |
+
- **Optimizer**: AdamW
|
93 |
+
- **Loss Function**: Cross-entropy
|
94 |
+
|
95 |
+
#### Training Hyperparameters
|
96 |
+
- **Learning Rate**: 2e-5
|
97 |
+
- **Sequence Length**:
|
98 |
+
- MRPC: 256
|
99 |
+
- QQP: 336
|
100 |
+
- PIT: 64
|
101 |
+
- PAWS-X: 256
|
102 |
+
|
103 |
+
#### Speeds, Sizes, Times
|
104 |
+
|
105 |
+
- **GPU Used**: NVIDIA A100
|
106 |
+
- **Total Training Time**: ~6 hours
|
107 |
+
- **Compute Units Used**: 80
|
108 |
+
|
109 |
+
### Testing Data, Factors & Metrics
|
110 |
+
|
111 |
+
#### Testing Data
|
112 |
+
The model was tested on combined test sets and evaluated using:
|
113 |
+
- Accuracy
|
114 |
+
- Precision
|
115 |
+
- Recall
|
116 |
+
- F1-Score
|
117 |
+
- Runtime
|
118 |
+
|
119 |
+
### Results
|
120 |
+
|
121 |
+
## **BERT Model Evaluation Metrics**
|
122 |
+
| Model | Dataset | Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) | Runtime (sec) |
|
123 |
+
|---------|------------|-------------|--------------|------------|-------------|---------------|
|
124 |
+
| BERT | MRPC Validation | 88.24 | 88.37 | 95.34 | 91.72 | 1.41 |
|
125 |
+
| BERT | MRPC Test | 84.87 | 85.84 | 92.50 | 89.04 | 5.77 |
|
126 |
+
| BERT | QQP Validation | 87.92 | 81.44 | 86.86 | 84.06 | 43.24 |
|
127 |
+
| BERT | QQP Test | 88.14 | 82.49 | 86.56 | 84.47 | 43.51 |
|
128 |
+
| BERT | PAWS-X Validation | 91.90 | 87.57 | 94.67 | 90.98 | 6.73 |
|
129 |
+
| BERT | PAWS-X Test | 92.60 | 88.69 | 95.92 | 92.16 | 6.82 |
|
130 |
+
| BERT | PIT Validation | 77.38 | 72.41 | 58.57 | 64.76 | 4.34 |
|
131 |
+
| BERT | PIT Test | 86.16 | 64.11 | 76.57 | 69.79 | 0.98 |
|
132 |
+
|
133 |
+
### Summary
|
134 |
+
This **BERT-based Paraphrase Detection Model** demonstrates strong **recall capabilities**, making it highly effective at **identifying paraphrases** across varied linguistic structures. While it tends to overpredict paraphrases, it remains a **strong baseline** for **semantic similarity tasks** and can be fine-tuned further for **domain-specific applications**.
|
135 |
+
|
136 |
+
### **Citation**
|
137 |
+
|
138 |
+
If you use this model, please cite:
|
139 |
+
|
140 |
+
```bibtex
|
141 |
+
@inproceedings{viswadarshan2025paraphrase,
|
142 |
+
title={Comparative Insights into Modern Architectures for Paraphrase Detection},
|
143 |
+
author={Viswadarshan R R, Viswaa Selvam S, Felcia Lilian J, Mahalakshmi S},
|
144 |
+
booktitle={International Conference on Computational Intelligence, Data Science, and Security (ICCIDS)},
|
145 |
+
year={2025},
|
146 |
+
publisher={IFIP AICT Series by Springer}
|
147 |
+
}
|
148 |
+
```
|
149 |
+
|
150 |
+
## Model Card Contact
|
151 |
+
|
152 |
+
📧 Email: [email protected]
|
153 |
+
|
154 |
+
🔗 GitHub: [Viswadarshan R R](https://github.com/viswadarshan-024)
|