--- base_model: Qwen/Qwen3-4B tags: - transformers - peft - lora - qwen - phishing - email-security - cybersecurity language: - en pipeline_tag: text-generation --- # qwen3-4b-phishing-detection 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**. > Depending on what you uploaded, this repo is either: > - **Adapter-only (LoRA/QLoRA)**: requires the base model + this adapter, or > - **Merged/fused model**: can be loaded directly without separately applying an adapter. ## Base model - `Qwen/Qwen3-4B` (use the exact base model you fine-tuned from) ## Dataset This model was fine-tuned using the following dataset: - **Naser Abdullah Alam — “Phishing Email Dataset” (Kaggle)** https://www.kaggle.com/datasets/naserabdullahalam/phishing-email-dataset ## Intended behavior Given an email, the intended output is exactly one label: - `PHISHING` - `LEGIT` Recommended prompt format: ```text You are a security assistant. Classify the following email as PHISHING or LEGIT. EMAIL: Answer with exactly one word: PHISHING or LEGIT. pip install -U torch transformers peft accelerate bitsandbytes safetensors import torch from transformers import AutoTokenizer, AutoModelForCausalLM MODEL_ID = "rudycaz/qwen3-4b-phishing-detection" # this repo tok = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( MODEL_ID, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True, ) email_text = """Subject: Verify your account Body: Please click the link below to verify... """ prompt = ( "You are a security assistant. Classify the following email as PHISHING or LEGIT.\n\n" f"EMAIL:\n{email_text}\n\n" "Answer with exactly one word: PHISHING or LEGIT." ) inputs = tok(prompt, return_tensors="pt").to(model.device) out = model.generate(**inputs, max_new_tokens=4) print(tok.decode(out[0], skip_special_tokens=True))