CoolFace
Modelpublic

CrabInHoney/urlbert-tiny-v6

sourceHugging Faceapache-2.0updated 14d agoView on Hugging Face
1likes374downloads
Model Card

CrabInHoney/urlbert-tiny-v6

CrabInHoney/urlbert-tiny-v6 is a lightweight URL encoder based on the ModernBERT architecture, designed for malicious URL detection, phishing classification, and URL feature extraction.

With only 2.03M parameters and a hidden dimension of 128, the model executes very fast simply due to its small footprint and compact embedding size, while remaining competitive on detection tasks.

The base model was trained via knowledge distillation of hidden representations from an ensemble of multiple teacher models, which were intentionally trained specifically for this purpose. Please note that this model is designed to process and analyze URL strings exclusively.

The repository contains the base encoder alongside 10 pre-trained classification heads trained on various public cybersecurity datasets.


Key Specifications

ParameterValue
ArchitectureModernBERT (ModernBertModel)
Parameters2,033,408 (2.03M total; 0.98M backbone, 1.05M embeddings)
Hidden Dimension128
Layers / Heads6 hidden layers / 4 attention heads
Context Window256 tokens
Vocabulary Size8,193
Model Size~7.76 MB (FP32) / 3.88 MB (FP16)
Average Tokens / URL24.8 (Truncation rate: 0.093% at max_len=256)

Benchmark Comparison

The models were evaluated on the JPxxx/url-benchmark-dataset

The benchmark contains 3M URLs with a strict 9:1 benign-to-malicious ratio. Evaluation was conducted using site-aware 5-fold cross-validation, ensuring that no second-level domain or IP address appears in more than one fold to eliminate data leakage.

RankModelBase DimAUPRC ↑AUROC ↑F1 ↑TPR @ 0.1% FPR ↑TPR @ 1% FPR ↑FPR @ 95% TPR ↓
1CrabInHoney/urlbert-tiny-v61280.97320.99280.93020.83390.93370.0173
2r3ddkahili/final-complete-malicious-url-model7680.96270.99010.91200.78550.90760.0335
3kmack/malicious-url-detection7680.96260.99030.91370.74910.91230.0294
4ealvaradob/bert-finetuned-phishing10240.94510.98580.88430.64460.86580.0544
5cybersectony/phishing-email-detection-distilbert_v2.4.17680.94260.98550.88030.66700.86000.0645
6CrabInHoney/urlbert-tiny-base-v41920.93390.98260.87160.65230.84160.0844
7CrabInHoney/urlbert-tiny-base-v31920.88710.97200.80960.48170.73720.1531
8CrabInHoney/urlbert-tiny-base-v21920.82230.95670.73810.36570.61230.2218

Feature Extraction (Embeddings)

python
from transformers import AutoModel, AutoTokenizer
import torch

REPO = "CrabInHoney/urlbert-tiny-v6"

tok = AutoTokenizer.from_pretrained(REPO)
model = AutoModel.from_pretrained(REPO)

text = "http://example.com/login-verify-account"
inputs = tok(text, return_tensors="pt")

with torch.no_grad():
    out = model(**inputs)

print(out.last_hidden_state.shape)

Output:

text
torch.Size([1, 15, 128])

Important Note on Pooling: For optimal downstream performance, it is highly recommended to use a combination of CLS + MEAN pooling (concatenating the [CLS] token representation with the mean representation of all tokens). This strategy yields the most robust and useful signal for feature extraction.


Pretrained Classification Heads

Trained classification heads are stored in the heads/ directory:

Head SubfolderSource DatasetClassesAccuracyTest Loss
phiusiil_phishing_urlPhiUSIIL Phishing URL Dataset299.86%0.0833
cybersectony_phishing_email_v2Cybersectony Phishing v2.0299.83%0.0841
ealvaradob_phishing_datasetEA Phishing Dataset299.40%0.0965
malicious_urls_4classMalicious URLs Dataset499.26%0.1556
url_65lakh65 Lakh+ Labeled URLs299.21%0.1015
phishbd_2026PhishBD_2026297.27%0.1364
phishdestroy_destroylistPhishDestroy Destroylist295.68%0.1823
kmack_phishing_urlsKMack Phishing URLs290.89%0.2514
snats_url_classifications_cleanSnats URL Classifications1758.91%1.4642
weborganizer_topic_annotationsWebOrganizer Topic Annotations2452.32%1.7157

Multi-Head Classification Example

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

REPO = "CrabInHoney/urlbert-tiny-v6"

HEADS = [
    "cybersectony_phishing_email_v2",
    "ealvaradob_phishing_dataset",
    "kmack_phishing_urls",
    "malicious_urls_4class",
    "phishbd_2026",
    "phishdestroy_destroylist",
    "phiusiil_phishing_url",
    "snats_url_classifications_clean",
    "url_65lakh",
    "weborganizer_topic_annotations",
]

tok = AutoTokenizer.from_pretrained(REPO)
text = "http://paypal-secure-login.verify-account.com"

for head in HEADS:
    model = AutoModelForSequenceClassification.from_pretrained(
        REPO, subfolder=f"heads/{head}", trust_remote_code=True
    )
    inputs = tok(text, return_tensors="pt", truncation=True, max_length=model.config.max_length)

    with torch.no_grad():
        logits = model(**inputs).logits

    probs = torch.softmax(logits, dim=-1)[0]
    pred = probs.argmax().item()
    print(f"{head:35s} -> {model.config.id2label[pred]:15s} ({probs[pred]:.3f})")

Output:

text
cybersectony_phishing_email_v2      -> phishing_url    (0.984)
ealvaradob_phishing_dataset         -> phishing        (0.985)
kmack_phishing_urls                 -> phishing        (0.984)
malicious_urls_4class               -> phishing        (0.979)
phishbd_2026                        -> phishing        (0.985)
phishdestroy_destroylist            -> malicious       (0.984)
phiusiil_phishing_url               -> phishing        (0.985)
snats_url_classifications_clean     -> legal           (0.352)
url_65lakh                          -> malicious       (0.985)
weborganizer_topic_annotations      -> Finance & Business (0.485)