Dravya Patell commited on
Commit
00a949b
·
verified ·
1 Parent(s): f648485

Upload fine-tuned phishing detector

Browse files
Files changed (5) hide show
  1. README.md +41 -0
  2. config.json +37 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +17 -0
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: en
4
+ library_name: transformers
5
+ pipeline_tag: text-classification
6
+ base_model: distilroberta-base
7
+ datasets:
8
+ - zefang-liu/phishing-email-dataset
9
+ tags:
10
+ - phishing
11
+ - email
12
+ - cybersecurity
13
+ ---
14
+
15
+ # Phishing Email Detector (DistilRoBERTa)
16
+
17
+ `distilroberta-base` fine-tuned to classify an email body as **safe** or **phishing**.
18
+
19
+ - Code & notebook: https://github.com/dravyaaa/phishing-email-detector
20
+ - Live demo: https://huggingface.co/spaces/dravaya/phishing-email-detector-demo
21
+
22
+ ## Test-set results (1,751 held-out emails)
23
+
24
+ | Model | Accuracy | F1 (phishing) |
25
+ |---|---|---|
26
+ | TF-IDF + Logistic Regression (baseline) | 98.91% | 0.9854 |
27
+ | **This model** | 98.63% | 0.9816 |
28
+
29
+ ## Usage
30
+
31
+ ```python
32
+ from transformers import pipeline
33
+ clf = pipeline("text-classification", model="dravaya/phishing-email-detector", truncation=True, max_length=256)
34
+ clf("Your account has been suspended. Verify your identity at http://secure-login-update.com")
35
+ ```
36
+
37
+ ## Limitations
38
+
39
+ The training data mixes Enron corporate mail and mid-2000s spam, so part of what the model learns is the
40
+ *source and era* of an email rather than phishing intent. Expect lower accuracy on modern phishing.
41
+ Inputs are truncated to 256 tokens. Research/learning project, not a production filter.
config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "RobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": 2,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "safe",
16
+ "1": "phishing"
17
+ },
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 3072,
20
+ "is_decoder": false,
21
+ "label2id": {
22
+ "phishing": 1,
23
+ "safe": 0
24
+ },
25
+ "layer_norm_eps": 1e-05,
26
+ "max_position_embeddings": 514,
27
+ "model_type": "roberta",
28
+ "num_attention_heads": 12,
29
+ "num_hidden_layers": 6,
30
+ "pad_token_id": 1,
31
+ "problem_type": "single_label_classification",
32
+ "tie_word_embeddings": true,
33
+ "transformers_version": "5.22.1",
34
+ "type_vocab_size": 1,
35
+ "use_cache": false,
36
+ "vocab_size": 50265
37
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f160f31ae5860ff74cd28181376a392d939793a107b00b2d785216a60e20858
3
+ size 328492280
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "cls_token": "<s>",
6
+ "eos_token": "</s>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "mask_token": "<mask>",
11
+ "model_max_length": 512,
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "tokenizer_class": "RobertaTokenizer",
15
+ "trim_offsets": true,
16
+ "unk_token": "<unk>"
17
+ }