Text Generation
Transformers
Safetensors
PEFT
English
qwen3
lora
qwen
phishing
email-security
cybersecurity
conversational
text-generation-inference
4-bit precision
Instructions to use rudycaz/qwen3-4b-phishing-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rudycaz/qwen3-4b-phishing-detection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rudycaz/qwen3-4b-phishing-detection") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rudycaz/qwen3-4b-phishing-detection") model = AutoModelForCausalLM.from_pretrained("rudycaz/qwen3-4b-phishing-detection", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use rudycaz/qwen3-4b-phishing-detection with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rudycaz/qwen3-4b-phishing-detection with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rudycaz/qwen3-4b-phishing-detection" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rudycaz/qwen3-4b-phishing-detection", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rudycaz/qwen3-4b-phishing-detection
- SGLang
How to use rudycaz/qwen3-4b-phishing-detection with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "rudycaz/qwen3-4b-phishing-detection" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rudycaz/qwen3-4b-phishing-detection", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "rudycaz/qwen3-4b-phishing-detection" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rudycaz/qwen3-4b-phishing-detection", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rudycaz/qwen3-4b-phishing-detection with Docker Model Runner:
docker model run hf.co/rudycaz/qwen3-4b-phishing-detection
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,31 +1,78 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
library_name: mlx
|
| 4 |
tags:
|
| 5 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
pipeline_tag: text-generation
|
| 7 |
---
|
| 8 |
|
| 9 |
-
#
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
from mlx_lm import load, generate
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
| 25 |
-
messages = [{"role": "user", "content": prompt}]
|
| 26 |
-
prompt = tokenizer.apply_chat_template(
|
| 27 |
-
messages, add_generation_prompt=True, return_dict=False,
|
| 28 |
-
)
|
| 29 |
|
| 30 |
-
|
| 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))
|