🕵️♂️ BERT-Base Bank Mail & Phishing Fraud Detector
This model is a fine-tuned version of bert-base-uncased optimized specifically for identifying binary classification boundaries between legitimate business communication and malicious phishing/fraudulent email templates.
Developed as a highly resilient baseline security layer, this model successfully resolves typical representation convergence bugs (NaN log updates) found in larger architectures by utilizing strict token length packing bounds and zero-division safeguards during training evaluation.
📊 Core Production Performance Metrics
The model achieved the following performance metrics on the validation dataset split ($20%$ isolated test pool) during its multi-epoch convergence sequence:
| Metric | Final Score |
|---|---|
| Accuracy | 99.22% |
| F1-Score | 99.25% |
| Precision | 99.77% |
| Recall | 98.73% |
| Final Training Loss | 0.0408 |
🛠️ Dataset & Sanitization Pipeline
The architecture was trained using automated multi-CSV pipelines derived from the consolidated phishing email data streams. The configuration features:
- Strict Deduplication: Eliminates duplicate message structures to neutralize model over-fitting loops.
- Type Enforcement: Forceful numeric mapping filters out corrupt rows or loose strings, locking target labels into strict 64-bit integer shapes.
- Optimized Context Windows: Sequences packed at a maximum length of 128 tokens maintain tight gradient calculations and high processing throughput.
🚀 Live Operational Inference Usage
To deploy this model downstream within your automated agentic or security response routing pipelines, you can load the fine-tuned parameters directly using the Hugging Face transformers framework:
import torch
import numpy as np
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_id = "sourav-paramanya/bert-base-bank-mail-fraud-detector"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
def scan_incoming_email(email_text):
inputs = tokenizer(email_text, return_tensors="pt", padding=True, truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probabilities = torch.softmax(logits, dim=1).numpy()[0]
predicted_class = np.argmax(probabilities)
labels_map = {0: "Legitimate (Safe) ✅", 1: "FRAUD / PHISHING DETECTED 🚨"}
print(f"Analysis Verdict : {labels_map[predicted_class]}")
print(f"Confidence Matrix: Safe -> {probabilities[0]:.2%}, Fraud -> {probabilities[1]:.2%}")
# Live test scenario
scan_incoming_email("URGENT: Your online business portal access is frozen. Click here to confirm identity immediate.")