SentinelXAI: DistilBERT for Phishing & Code-Mixed Smishing Detection

SentinelXAI is a fine-tuned transformer model for continual, explainable, and robust phishing detection across English, Bengali (bn), Banglish, and code-mixed mobile-financial-service (MFS) smishing lures (bKash, Nagad, DBBL Nexus).

This model repository contains the fine-tuned DistilBERT classifier trained across sequential temporal experience streams evaluated under the Replay Continual Learning strategy (Avalanche framework).

Model Overview

  • Base Architecture: distilbert-base-uncased
  • Task: Binary Sequence Classification (0: LEGITIMATE / HAM, 1: PHISHING / SPAM)
  • Primary Languages: English (en), Bengali (bn), Banglish, and Code-Mixed
  • Paper: SentinelXAI: A Continual & Explainable Approach to Phishing Detection

Performance Metrics

Evaluation Metric Score (%) Notes
Replay Strategy Accuracy 95.84% ± 0.28% 5-step continual learning benchmark
Test Set Accuracy 95.20% ± 0.31% Held-out 1,122 chronological test records
Test F1-Score 94.80% ± 0.29% Macro F1 on test split
Backward Transfer (BWT) -0.0125 Minimal catastrophic forgetting
Evasion Robustness (Combined) 88.60% Homoglyph + Zero-width-space + Benign padding

How to Use

1. Direct Inference via Hugging Face Transformers

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_name = "4xrhd/sentinelxai-distilbert"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

text = "URGENT: Your account access has been restricted. Verify at http://secure-login.com"

inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
    logits = model(**inputs).logits
    probs = torch.softmax(logits, dim=-1)[0]
    pred_class = torch.argmax(logits, dim=-1).item()

label = "PHISHING / SPAM" if pred_class == 1 else "LEGITIMATE / HAM"
print(f"Prediction: {label} (Confidence: {probs[pred_class]*100:.2f}%)")

2. Integrated Gradients XAI Attributions (Captum)

from captum.attr import LayerIntegratedGradients

# Compute token-level attributions on embedding layer
def custom_forward(input_ids):
    return model(input_ids=input_ids).logits

lig = LayerIntegratedGradients(custom_forward, model.distilbert.embeddings)
inputs = tokenizer(text, return_tensors="pt")
attributions, delta = lig.attribute(inputs["input_ids"], target=1, return_convergence_delta=True)

# Token risk scores
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
scores = attributions.sum(dim=-1).squeeze(0).tolist()
for tok, score in zip(tokens, scores):
    print(f"{tok:<15} : {score:+.4f}")

Dataset & Training Data

Trained on the SentinelXAI Unified Dataset (5,610 records chronologically split across 2021-01-01 to 2023-06-18) combining:

  • Nazario Phishing Email Corpus
  • PhishTank Threat Feed
  • CEAS 2008 Legitimate Email Baseline
  • UCI SMS Spam Collection
  • Banglish & Code-Mixed MFS Smishing Lures (bKash, Nagad, DBBL)

Available on Kaggle: azhar4xrhd/sentinelxai-dataset.

Citation & Reference

@article{sentinelxai2026,
  title={SentinelXAI: A Continual & Explainable Approach to Phishing Detection},
  author={Team Recursion},
  journal={IEEE Conference Proceedings},
  year={2026}
}
Downloads last month
4
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support