Downloads · 30 days
52
18% of all-time downloads
mikaelnurminen/modernbert-large-phishing
modernbert-large-phishing is a text classification model from mikaelnurminen. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Binary classifier for phishing risk (0=benign, 1=phishing) calibrated with additional real email corpora and production stability fixes.
Downloads · 30 days
52
18% of all-time downloads
All-time downloads
295
Public
Parameters
396M
4.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors792 MB · 100%
From the Hugging Face model README
Binary classifier for phishing risk (0=benign, 1=phishing) calibrated with additional real email corpora and production stability fixes.
Two issues were impacting real uploads:
NaN probabilities with variable-length batched inference under SDPA attention (batch_size > 1).talby/spamassassin (real ham/spam emails)SetFit/enron_spam (real Enron ham/spam)puyang2025/seven-phishing-email-datasets subsets (CEAS-08, TREC-07, Assassin)hard_neg_round2) retainedfreeze_base_model: true)batch_size=1 during trainingattn_implementation='eager' in project inference/training loaders for stable batched inference in production15,585 (after dedup/split processing)1,9481,949realworld_round1 config split)0.90100.88220.86280.90260.96170.37From eval_realworld_holdout_sampled.json:
0.47:
0.77200.72920.89770.61400.03
0.7482From eval_benchmark_truncated_1024.json:
0.90140.90000.91060.88960.9602For this model family, use eager attention for batched inference to avoid NaNs:
model = AutoModelForSequenceClassification.from_pretrained(
repo_id,
attn_implementation="eager",
)
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
repo_id = "mikaelnurminen/modernbert-large-phishing"
tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
model = AutoModelForSequenceClassification.from_pretrained(
repo_id,
attn_implementation="eager",
).eval()
text = "EMAIL: Please verify your account details"
enc = tokenizer(text, return_tensors="pt", truncation=True, max_length=2048)
with torch.no_grad():
logits = model(**enc).logits
prob_phishing = torch.softmax(logits.float(), dim=-1)[0, 1].item()
label = "phishing" if prob_phishing >= 0.47 else "benign"
print({"prob_phishing": prob_phishing, "label": label})
model.safetensorsconfig.jsonresolved_config.yamltrain_metrics.jsoneval_report.jsoneval_benchmark_truncated_1024.jsondata_summary.json