cbx-phishing-detector-17M

An English phishing and spam detector for email and SMS. Give it one message (subject and body, or an SMS) and it returns one label: legitimate, spam (unwanted bulk or promotional mail that does not try to deceive) or phishing_scam (a message that tries to trick the reader into giving up credentials, money or personal data, including advance-fee and prize scams). The phishing threshold is set for a chosen false-alarm rate: by default at most about 2% of legitimate messages are flagged as phishing, with 1% and 3% settings included.

It has 16.8M parameters: the Ettin encoder 17m fine-tuned on the same data. Other sizes: 68M. On a CPU (8 threads, fp32) one short text (63 tokens) takes about 4 ms and a full 512-token text about 25 ms.

Licence: Apache License, Version 2.0. Read Intended use and disclaimer before using it.

Labels

One label per text. F1 per label on Real messages (below).

Label Meaning F1
legitimate normal personal, work and transactional mail, including newsletters the reader signed up for 0.93
spam unsolicited marketing and bulk promotion, openly priced offers, unsolicited newsletters 0.63
phishing_scam credential phishing, fake invoices or deliveries, account-suspension lures, advance-fee, prize, investment and romance scams 0.80

Phishing and scams are one label. A message is phishing_scam once it tries to deceive the reader into giving up credentials, money or personal data; open promotion without deception is spam.

Quick start

pip install -r requirements.txt
python example.py
from cbx_phishing import PhishingDetector

clf = PhishingDetector(".")                  # folder with the model files; CPU or GPU
r = clf.classify("Subject: Your mailbox is almost full\n\nDear user, your mailbox has reached 98% of its quota. Incoming messages will be rejected after 24 hours. Verify your account now to keep receiving mail: http://mail-quota-update.example-portal.com/verify")
r["label"], r["scores"]                # top label and the probability of each label
clf.classify(["first text", "second text"])   # a list gives a list

python example.py prints (texts invented; any errors are the model's own):

phishing_scam 1.00  Subject: Your mailbox is almost full Dear user, your mailbox has reached 98% of its quota. Incoming messages will be rejected after 24 hours. Verify your account now to keep receiving mail: http://mail-quota-update.example-portal.com/verify
legitimate 1.00  Subject: Re: Thursday planning meeting Hi Priya, thanks for sending the draft. Can we move the meeting to 3 pm? I'll bring the budget numbers. Best, Tom
spam      1.00  Subject: 40% off all garden furniture this weekend Spring sale! Save 40% on chairs, tables and parasols until Sunday. Free delivery on orders over $99. Shop now at gardenhouse-deals.example.com. Unsubscribe here.
phishing_scam 0.99  Your parcel could not be delivered. Pay the $1.99 redelivery fee within 12 hours: https://parcel-redeliver.example.top/pay
legitimate 1.00  Hey, are we still on for dinner tonight? I can pick you up at 7.

Input

  • One English message. For email, pass "Subject: <subject>\n\n<body>"; for SMS, the text. Links can stay in the text. The model reads at most 512 tokens; longer text is cut ("truncated": True).
  • Training text replaces personal details with placeholders such as [NAME], [EMAIL] and [PHONE]; real names and addresses work too.
  • The label comes from a threshold rule in cbx_config.json (decision): phishing_scam if its score reaches the phishing threshold, else spam if its score reaches the spam threshold, else legitimate. Three named settings are included (operating_points): 1%, 2% (default) and 3%. Choose one with PhishingDetector(".", operating_point="1%") or clf.use_operating_point("3%").

Evaluation

Real messages: 6,349 real messages never used in training or for any choice: Enron mail (legitimate), the SpamAssassin public corpus (legitimate, spam and phishing), Jose Nazario's phishing corpus (2025 and any campaign touching 2025) and the UCI SMS Spam Collection test split. Macro F1 is the mean F1 over the 3 labels, at the default 2% setting.

Generated hard cases: 600 generated messages written to be hard (legitimate security notices, refund and delivery mails, and well-written phishing), held out from training.

Model Real messages (macro F1) Generated hard cases (macro F1)
68M (same family) 0.819 1.000
this model (17M) 0.785 0.999

Operating points (Real messages). Each point is a threshold rule tuned on validation to keep the stated false-positive rate. Each cell: recall / precision of the target label, then the false-positive rate measured on this test set:

Model 1% 2% 3%
68M (same family) 0.83 / 0.87 / 1.6% 0.87 / 0.84 / 2.5% 0.89 / 0.80 / 3.5%
this model (17M) 0.69 / 0.91 / 0.8% 0.75 / 0.85 / 1.8% 0.78 / 0.81 / 2.8%
cybersectony/phishing-email-detection-distilbert_v2.4.1 (2 classes, no spam) 0.30 / 0.42 / 0.9% 0.42 / 0.47 / 1.6% 0.54 / 0.50 / 2.9%

Recall and precision are for phishing_scam against everything else (spam counts as not phishing); the last number is the share of legitimate messages labelled phishing_scam. The thresholds were set on a separate validation set of real messages (other Enron and SpamAssassin mailboxes, Nazario and UCI rows), so the measured rate on this test set can land a little above or below the target. cybersectony was scored by us on the same test set, with its phishing threshold tuned on the same validation set in the same way; it has no spam class, and it may have seen older Nazario phishing in its own training.

By channel (this model, accuracy): email 0.87 (5839 texts), SMS 0.96 (510 texts)

Training data

About 50,000 messages. Real: the UCI SMS Spam Collection train split (labels from the dataset, with phishing among the spam relabelled by Claude Haiku 5.5 under our label guide). Generated: English emails, SMS and chat messages for all three labels, written by LLMs from scenario lists, from outlines of real email, and (for phishing) as variants of Jose Nazario's phishing emails, then kept only when a second LLM, not told the intended label, agreed with it. No Nazario email itself is in the training set; Nazario rows are used for validation, testing and as seeds for the generated variants. Enron and SpamAssassin text is never used for training; only short outlines (message type and length, extracted on our own machines) from the non-test Enron mailboxes guided some generated emails. Thresholds were tuned on the real validation set.

Dataset Languages Licence Used for
SMS Spam Collection, Almeida and Gómez Hidalgo (UCI Machine Learning Repository) en CC BY 4.0 training and testing
Phishing corpus, Jose Nazario en CC BY 4.0 validation, testing, and seeds for generated phishing variants (not training)
Enron Email Dataset (CMU) en no licence stated; testing only, not redistributed testing
Enron Email Dataset (CMU), separate mailboxes en no licence stated; not redistributed validation (threshold tuning); outlines (message type and length only) for generated email
SpamAssassin public corpus (Apache SpamAssassin project) en not stated; testing only, not redistributed testing
SpamAssassin public corpus, separate mailboxes en not stated; validation only, not redistributed validation (threshold tuning), not training

Limitations

  • Newsletters. Newsletters and mailing-list digests the reader signed up for are often labelled spam; from the text alone they look like unsolicited bulk mail. Spam recall on the real test set is lower than phishing recall for this reason.
  • Not a complete defence. At the default setting this model catches 75% of the real test phishing, so some phishing gets through, and some legitimate mail is flagged. Use it alongside sender authentication (SPF, DKIM, DMARC), link and attachment scanning and user reporting.
  • Text only. It does not see headers, sender reputation, the real link targets, attachments or images; a phishing message that is only an image or an attachment will not be caught.
  • English only, and mostly business and consumer mail. Expect lower accuracy on other languages, on very short or very long messages, and on new phishing styles.
  • Old test mail. Part of the real test set (Enron, SpamAssassin) is from the early 2000s; the phishing test set is from 2025.

Intended use and disclaimer

Intended use: flagging likely phishing and spam in email and SMS for filtering, triage, or warning users, with people able to review and correct. Not intended as the only control against phishing, or for decisions about individual people. The model makes mistakes (see Limitations). It is provided "as is", without warranties of any kind; Cobuild Tech Private Limited is not liable for its use. You are responsible for checking that it suits your data and for complying with the laws that apply to your use, including privacy law when you process other people's messages.

Downloads last month
11
Safetensors
Model size
16.8M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for CobuildX-AI/cbx-phishing-detector-17M

Finetuned
(62)
this model

Collection including CobuildX-AI/cbx-phishing-detector-17M