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.030.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.jsonHave the files? Publish a torrent.
Publish a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo mikaelnurminen/modernbert-large-phishing ./model-folderanswerdotai/ModernBERT-large