Text Classification
Transformers
ONNX
Safetensors
Transformers.js
English
roberta
phishing
email-security
phishing-detection
security
classification
spam
social-engineering
Eval Results (legacy)
text-embeddings-inference
Instructions to use Project-Bastion/phishing-email-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Project-Bastion/phishing-email-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Project-Bastion/phishing-email-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Project-Bastion/phishing-email-classifier") model = AutoModelForSequenceClassification.from_pretrained("Project-Bastion/phishing-email-classifier", device_map="auto") - Transformers.js
How to use Project-Bastion/phishing-email-classifier with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'Project-Bastion/phishing-email-classifier'); - Notebooks
- Google Colab
- Kaggle
v2 weights: add Enron, Ling, TREC-05/06 training data
Browse files- README.md +20 -16
- model.safetensors +1 -1
- onnx/model.onnx +1 -1
- onnx/model_quantized.onnx +1 -1
README.md
CHANGED
|
@@ -10,19 +10,19 @@ model-index:
|
|
| 10 |
results:
|
| 11 |
- task: {type: text-classification, name: Phishing email detection}
|
| 12 |
dataset: {type: ceas-08, name: CEAS_08 test split (3392 emails)}
|
| 13 |
-
metrics: [{type: auroc, value: 0.
|
| 14 |
- task: {type: text-classification, name: Phishing email detection}
|
| 15 |
dataset: {type: trec-07, name: TREC_07 test split (5235 emails)}
|
| 16 |
-
metrics: [{type: auroc, value: 0.
|
| 17 |
- task: {type: text-classification, name: Phishing email detection}
|
| 18 |
dataset: {type: llmgen-phishing, name: LLMGen-Phishing-Email-Dataset test split (676 emails)}
|
| 19 |
-
metrics: [{type: auroc, value: 0.
|
| 20 |
inference: false
|
| 21 |
---
|
| 22 |
|
| 23 |
# phishing-email-classifier
|
| 24 |
|
| 25 |
-
Flags phishing emails from their text (subject + body). An 82M-parameter DistilRoBERTa classifier that scores above the two most-downloaded open phishing-email models on CEAS-08, TREC-07, Nazario, Nigerian fraud,
|
| 26 |
|
| 27 |
**[Try it in your browser](https://huggingface.co/spaces/Project-Bastion/phishing-email-classifier-demo)**: a static page that runs the model locally (transformers.js, ONNX int8, about 86 MB, downloaded once). The email text you paste never leaves your device.
|
| 28 |
|
|
@@ -32,17 +32,21 @@ Test splits of public phishing-email benchmarks (AUROC; recall at 1% false-posit
|
|
| 32 |
|
| 33 |
| Benchmark (emails) | **phishing-email-classifier** | cybersectony/phishing-email-detection-distilbert_v2.4.1 (312k downloads) | ptouch/phishing-distilbert-cyber207 (248k downloads) |
|
| 34 |
|---|---|---|---|
|
| 35 |
-
| CEAS_08 (3,392) | **0.
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
| locuoco spam-ham-phish, phish vs ham (16,529) | **1.0000** (1.000) | 0.9686 (0.568) | 0.9457 (0.057) |
|
| 40 |
-
| LLMGen-Phishing-Email-Dataset (676) | **0.
|
| 41 |
-
|
|
| 42 |
-
| zefang-liu/phishing-email-dataset (17,236) | 0.7752 (0.356) | **0.9998** (0.998) | 0.9884 (0.866) |
|
| 43 |
|
| 44 |
-
At the default threshold (margin 0) the false-positive rate on legitimate mail is 0.
|
| 45 |
-
Corpus labels are used as published: CEAS_08 and
|
| 46 |
|
| 47 |
## Usage
|
| 48 |
|
|
@@ -66,13 +70,13 @@ The score is a logit margin (phishing minus legitimate); 0 corresponds to p = 0.
|
|
| 66 |
|
| 67 |
## Files
|
| 68 |
|
| 69 |
-
`onnx/model_quantized.onnx` (weight-only int8, 86 MB, the demo default) and `onnx/model.onnx` (fp32, 329 MB) for transformers.js / onnxruntime. fp32 gives the same decisions as PyTorch on 315 checked emails; int8 gives the same decisions with a largest margin difference of 0.
|
| 70 |
|
| 71 |
## Limits
|
| 72 |
|
| 73 |
-
*
|
| 74 |
* English email text only, first 256 tokens; it does not look at URLs, headers or attachments.
|
| 75 |
|
| 76 |
## License and credits
|
| 77 |
|
| 78 |
-
Apache-2.0. Base model: distilroberta-base (Apache-2.0). Training data: locuoco/the-biggest-spam-ham-phish-email-dataset-300000 (MIT); Dizzzy0x00/LLMGen-Phishing-Email-Dataset (Apache-2.0); the *Phishing Email Curated Datasets* of Champa, Rabbi and Zibran (2023), Zenodo, doi:10.5281/zenodo.8339691 (CC-BY-4.0), via kudzaiprichard/aura-phishing-email-corpus. zefang-liu/phishing-email-dataset (LGPL-3.0) is used for evaluation only.
|
|
|
|
| 10 |
results:
|
| 11 |
- task: {type: text-classification, name: Phishing email detection}
|
| 12 |
dataset: {type: ceas-08, name: CEAS_08 test split (3392 emails)}
|
| 13 |
+
metrics: [{type: auroc, value: 0.9999, name: AUROC}]
|
| 14 |
- task: {type: text-classification, name: Phishing email detection}
|
| 15 |
dataset: {type: trec-07, name: TREC_07 test split (5235 emails)}
|
| 16 |
+
metrics: [{type: auroc, value: 0.9996, name: AUROC}]
|
| 17 |
- task: {type: text-classification, name: Phishing email detection}
|
| 18 |
dataset: {type: llmgen-phishing, name: LLMGen-Phishing-Email-Dataset test split (676 emails)}
|
| 19 |
+
metrics: [{type: auroc, value: 0.9968, name: AUROC}]
|
| 20 |
inference: false
|
| 21 |
---
|
| 22 |
|
| 23 |
# phishing-email-classifier
|
| 24 |
|
| 25 |
+
Flags phishing emails from their text (subject + body). An 82M-parameter DistilRoBERTa classifier that scores above the two most-downloaded open phishing-email models on nine of twelve public phishing and spam corpora (CEAS-08, TREC-05/06/07, Nazario, Nigerian fraud, Enron, locuoco, LLM-written phishing) and within 0.004 AUROC of the best on the other three, with far fewer false alarms at the default threshold. Runs on CPU or in your browser with no server.
|
| 26 |
|
| 27 |
**[Try it in your browser](https://huggingface.co/spaces/Project-Bastion/phishing-email-classifier-demo)**: a static page that runs the model locally (transformers.js, ONNX int8, about 86 MB, downloaded once). The email text you paste never leaves your device.
|
| 28 |
|
|
|
|
| 32 |
|
| 33 |
| Benchmark (emails) | **phishing-email-classifier** | cybersectony/phishing-email-detection-distilbert_v2.4.1 (312k downloads) | ptouch/phishing-distilbert-cyber207 (248k downloads) |
|
| 34 |
|---|---|---|---|
|
| 35 |
+
| CEAS_08 (3,392) | **0.9999** (0.998) | 0.9847 (0.610) | 0.9669 (0.499) |
|
| 36 |
+
| TREC_05 (5,450) | **0.9995** (0.990) | 0.9856 (0.837) | 0.9553 (0.666) |
|
| 37 |
+
| TREC_06 (1,607) | **0.9990** (0.980) | 0.9860 (0.812) | 0.9445 (0.576) |
|
| 38 |
+
| TREC_07 (5,235) | **0.9996** (0.998) | 0.9630 (0.608) | 0.8906 (0.470) |
|
| 39 |
+
| Nazario (299) | **0.9995** (0.987) | 0.9317 (0.081) | 0.9079 (0.169) |
|
| 40 |
+
| Nigerian fraud (649) | **1.0000** (1.000) | 0.9897 (0.879) | 0.9940 (0.968) |
|
| 41 |
+
| SpamAssassin (565) | 0.9987 (0.963) | 0.9976 (0.951) | **0.9996** (0.982) |
|
| 42 |
+
| Enron (3,004) | **0.9997** (0.996) | 0.9995 (0.994) | 0.9914 (0.866) |
|
| 43 |
+
| Ling (284) | 0.9967 (0.957) | 0.9980 (0.978) | **1.0000** (1.000) |
|
| 44 |
| locuoco spam-ham-phish, phish vs ham (16,529) | **1.0000** (1.000) | 0.9686 (0.568) | 0.9457 (0.057) |
|
| 45 |
+
| LLMGen-Phishing-Email-Dataset (676) | **0.9968** (0.996) | 0.6948 (0.089) | 0.5147 (0.052) |
|
| 46 |
+
| zefang-liu/phishing-email-dataset (17,236) | 0.9991 (0.979) | **0.9998** (0.998) | 0.9884 (0.866) |
|
|
|
|
| 47 |
|
| 48 |
+
At the default threshold (margin 0) the false-positive rate on legitimate mail is 0.2% (CEAS_08), 0.3% (TREC_07) and 0.1% (locuoco), against 10.2%, 10.2% and 18.5% for cybersectony.
|
| 49 |
+
Corpus labels are used as published: CEAS_08, TREC_05/06/07 and Enron mark spam as phishing.
|
| 50 |
|
| 51 |
## Usage
|
| 52 |
|
|
|
|
| 70 |
|
| 71 |
## Files
|
| 72 |
|
| 73 |
+
`onnx/model_quantized.onnx` (weight-only int8, 86 MB, the demo default) and `onnx/model.onnx` (fp32, 329 MB) for transformers.js / onnxruntime. fp32 gives the same decisions as PyTorch on 315 checked emails; int8 gives the same decisions with a largest margin difference of 0.63.
|
| 74 |
|
| 75 |
## Limits
|
| 76 |
|
| 77 |
+
* Slightly behind cybersectony on zefang-liu and Ling (and behind ptouch on SpamAssassin and Ling): test on your own mail and tune the threshold before relying on it.
|
| 78 |
* English email text only, first 256 tokens; it does not look at URLs, headers or attachments.
|
| 79 |
|
| 80 |
## License and credits
|
| 81 |
|
| 82 |
+
Apache-2.0. Base model: distilroberta-base (Apache-2.0). Training data: locuoco/the-biggest-spam-ham-phish-email-dataset-300000 (MIT); Dizzzy0x00/LLMGen-Phishing-Email-Dataset (Apache-2.0); the *Phishing Email Curated Datasets* of Champa, Rabbi and Zibran (2023), Zenodo, doi:10.5281/zenodo.8339691 (CC-BY-4.0; CEAS_08, TREC_05/06/07, Nazario, Nigerian fraud, SpamAssassin, Enron, Ling), part via kudzaiprichard/aura-phishing-email-corpus. zefang-liu/phishing-email-dataset (LGPL-3.0) is used for evaluation only. Revision `v1` of this repo holds the earlier weights.
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 328492280
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b64f89597059ea389d83e53de73a4e48da0d9edcaf215f5ff1e759012b43b5f
|
| 3 |
size 328492280
|
onnx/model.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 328593806
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b784183cb3256208ec41f7fe01f6e33b7c25c0e830d80aacda9eae4b572ced49
|
| 3 |
size 328593806
|
onnx/model_quantized.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 85754432
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:78fa21917aa40db07222c9a090f36a949443db65eac70d24d31df9d112f492db
|
| 3 |
size 85754432
|