CoolFace
Modelpublic

Akash-Sakala/bert-phishing-classifier_student

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes7downloads
Model Card

DistilBERT Phishing Site Classifier (Student)

A 4-layer DistilBERT trained via knowledge distillation from a fine-tuned BERT teacher (Akash-Sakala/bert-phishing-classifier_teacher) for binary phishing site URL classification.

Model Details

PropertyValue
Base modeldistilbert/distilbert-base-uncased
ArchitectureDistilBertForSequenceClassification
Layers4 (distilled from 12-layer BERT teacher)
Attention heads8
TaskBinary classification (phishing / benign)
Parameters~52M

Training — Distillation Setup

HyperparameterValue
Temperature3.0
Alpha (KL weight)0.6
Hard label weight0.4
Learning rate2e-5
Batch size64
Epochs4
Warmup steps10% of total steps
Weight decay0.01
OptimizerAdamW
SchedulerLinear with warmup
Mixed precisionfp16 (torch.amp)

Loss Function

Combined KL divergence (soft targets) + Cross-Entropy (hard labels):

loss = alpha KL(student_soft || teacher_soft) T^2 + (1 - alpha) * CrossEntropy(student, labels)

Test Set Results

ModelAccuracyPrecisionRecallF1
BERT Teacher0.89710.91360.87630.8945
DistilBERT Student0.96010.97100.94830.9595

The student outperforms the teacher across all metrics while being smaller and faster.

Dataset

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

tokenizer = AutoTokenizer.from_pretrained('Akash-Sakala/bert-phishing-classifier_student')
model = AutoModelForSequenceClassification.from_pretrained('Akash-Sakala/bert-phishing-classifier_student')

url = 'http://suspicious-login.verify-account.com/secure'
inputs = tokenizer(url, return_tensors='pt', truncation=True, padding='max_length')

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

pred = torch.argmax(logits, dim=1).item()
print('Phishing' if pred == 1 else 'Benign')

Teacher Model

Akash-Sakala/bert-phishing-classifier_teacher