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
| 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: | |
| <paste email here> | |
| 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)) |