Downloads · 30 days
30
22% of all-time downloads
ilkayO/modernbert-phishing-detector
modernbert-phishing-detector is a text classification model from ilkayO. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
[](https://github.com/ilkay-onay/malurl-BERT-detect-ai-service) [](https://colab.research.google.com/github/ilkay-onay/malurl-BERT-detect-ai-service/blob/main/colabdemo.ipynb)
Downloads · 30 days
30
22% of all-time downloads
All-time downloads
135
Public
Parameters
150M
299 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors299 MB · 99%
From the Hugging Face model README
This is a fine-tuned ModernBERT-base (149M Parameters) model designed for high-performance detection of phishing and malicious URLs. It has been strictly trained using real-world generalization techniques (Global Deduplication, URL Sanitization, and Domain-Based Group Splitting) to prevent structural overfitting and data leakage.
You can use this model directly with the transformers library.
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch.nn.functional as F
# Load Model
model_id = "[KULLANICI_ADIN]/modernbert-phishing-detector"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
url = "https://secure-login-verify.suspicious-domain.tk/login"
# Tokenize
inputs = tokenizer(url, return_tensors="pt", truncation=True, max_length=256, padding=True)
# Predict
with torch.no_grad():
outputs = model(**inputs)
probs = F.softmax(outputs.logits, dim=-1)
phish_prob = probs[0][1].item()
print(f"Phishing Probability: {phish_prob * 100:.2f}%")
# Output > 60% indicates SUSPICIOUS, > 85% indicates PHISHING
Training a phishing detector is notorious for dataset biases. Early iterations (Phase 1) on standard datasets yielded a 100% F1-Score but failed drastically (46% accuracy) on Out-of-Distribution (OOD) testing because the model memorized domain names instead of malicious morphological patterns.
To solve this, we applied:
http, www) and preserved 'malicious' labels in case of conflicts to increase the safety margin.GroupShuffleSplit ensuring that sub-URLs of a specific domain exist only in either the training or the testing set, preventing data leakage.Unlike deceptive 99% accuracy models, this model provides scientifically honest generalization, analyzing subdirectory depth, character entropy, and suspicious keyword sequences.
answerdotai/ModernBERT-basetorch.compile), Flash Attention 2 & UnpaddingThis project is licensed under the Apache 2.0 License.