rudycaz commited on
Commit
7149d3e
·
verified ·
1 Parent(s): 810c150

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -19
README.md CHANGED
@@ -1,31 +1,78 @@
1
  ---
2
- language: en
3
- library_name: mlx
4
  tags:
5
- - mlx
 
 
 
 
 
 
 
 
6
  pipeline_tag: text-generation
7
  ---
8
 
9
- # rudycaz/qwen3-4b-phishing-detection
10
 
11
- ## Use with mlx
12
 
13
- ```bash
14
- pip install mlx-lm
15
- ```
16
 
17
- ```python
18
- from mlx_lm import load, generate
19
 
20
- model, tokenizer = load("rudycaz/qwen3-4b-phishing-detection")
21
 
22
- prompt = "hello"
23
 
24
- if tokenizer.chat_template is not None:
25
- messages = [{"role": "user", "content": prompt}]
26
- prompt = tokenizer.apply_chat_template(
27
- messages, add_generation_prompt=True, return_dict=False,
28
- )
29
 
30
- response = generate(model, tokenizer, prompt=prompt, verbose=True)
31
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model: Qwen/Qwen3-4B
 
3
  tags:
4
+ - transformers
5
+ - peft
6
+ - lora
7
+ - qwen
8
+ - phishing
9
+ - email-security
10
+ - cybersecurity
11
+ language:
12
+ - en
13
  pipeline_tag: text-generation
14
  ---
15
 
16
+ # qwen3-4b-phishing-detection
17
 
18
+ This repository contains a phishing-focused model derived from **Qwen3-4B**. It is intended to support defensive workflows by labeling email content as **PHISHING** or **LEGIT**.
19
 
20
+ > Depending on what you uploaded, this repo is either:
21
+ > - **Adapter-only (LoRA/QLoRA)**: requires the base model + this adapter, or
22
+ > - **Merged/fused model**: can be loaded directly without separately applying an adapter.
23
 
24
+ ## Base model
 
25
 
26
+ - `Qwen/Qwen3-4B` (use the exact base model you fine-tuned from)
27
 
28
+ ## Dataset
29
 
30
+ This model was fine-tuned using the following dataset:
 
 
 
 
31
 
32
+ - **Naser Abdullah Alam “Phishing Email Dataset” (Kaggle)**
33
+ https://www.kaggle.com/datasets/naserabdullahalam/phishing-email-dataset
34
+
35
+ ## Intended behavior
36
+
37
+ Given an email, the intended output is exactly one label:
38
+ - `PHISHING`
39
+ - `LEGIT`
40
+
41
+ Recommended prompt format:
42
+
43
+ ```text
44
+ You are a security assistant. Classify the following email as PHISHING or LEGIT.
45
+
46
+ EMAIL:
47
+ <paste email here>
48
+
49
+ Answer with exactly one word: PHISHING or LEGIT.
50
+
51
+ pip install -U torch transformers peft accelerate bitsandbytes safetensors
52
+
53
+ import torch
54
+ from transformers import AutoTokenizer, AutoModelForCausalLM
55
+
56
+ MODEL_ID = "rudycaz/qwen3-4b-phishing-detection" # this repo
57
+
58
+ tok = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
59
+ model = AutoModelForCausalLM.from_pretrained(
60
+ MODEL_ID,
61
+ device_map="auto",
62
+ torch_dtype=torch.bfloat16,
63
+ trust_remote_code=True,
64
+ )
65
+
66
+ email_text = """Subject: Verify your account
67
+ Body: Please click the link below to verify...
68
+ """
69
+
70
+ prompt = (
71
+ "You are a security assistant. Classify the following email as PHISHING or LEGIT.\n\n"
72
+ f"EMAIL:\n{email_text}\n\n"
73
+ "Answer with exactly one word: PHISHING or LEGIT."
74
+ )
75
+
76
+ inputs = tok(prompt, return_tensors="pt").to(model.device)
77
+ out = model.generate(**inputs, max_new_tokens=4)
78
+ print(tok.decode(out[0], skip_special_tokens=True))