GPT-2 Phishing Email Detection
Model Description
This model detects phishing emails using a fine-tuned GPT-2 transformer model.
- Base model:
gpt2 - Architecture: Decoder-only
- Task: Binary text classification
- Classes: Safe Email (0), Phishing Email (1)
Dataset
Dataset: Phishing Email Dataset
After cleaning, 17,537 email samples were used.
- Training: 14,029
- Validation: 1,754
- Testing: 1,754
Training
- Epochs: 2
- Learning rate: 2e-5
- Maximum sequence length: 256 tokens
- Framework: Hugging Face Transformers
- Hardware: NVIDIA Tesla T4 GPU
Test Results
| Metric | Score |
|---|---|
| Accuracy | 98.63% |
| Precision | 98.02% |
| Recall | 98.32% |
| F1-score | 98.17% |
Usage
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Aaqib099/gpt2-phishing-detection"
)
result = classifier(
"Urgent! Verify your account by clicking this link."
)
print(result)
Limitations
- Trained on a specific phishing email dataset.
- Results may differ on real-world messages.
- Input is truncated to 256 tokens during training.
- Predictions should not be treated as guaranteed security decisions.
Project
Fine-tuning and comparison of encoder-only and decoder-only transformer architectures for phishing detection.