A fine-tuned DeBERTa-v3-base model for binary email threat classification.
This model classifies email text into two categories:
The model was developed as part of an AI-based email threat detection and forensic intelligence project.
| Property | Details |
|---|---|
| Base Model | microsoft/deberta-v3-base |
| Architecture | DeBERTa-v3-base |
| Task | Binary email threat classification |
| Classification Type | Sequence classification |
| Labels | BENIGN, MALICIOUS |
| Maximum Sequence Length | 256 tokens |
| Tokenizer | DebertaV2Tokenizer |
| Framework | Hugging Face Transformers |
| Model Format | Safetensors |
| Parameters | Approximately 184.4M |
| Dataset | ForentisAI_DeBERTa_Dataset_V2 |
| Dataset Type | Synthetic |
| Training Environment | Google Colab |
This model is intended for research and development of automated email security and threat detection systems.
Potential applications include:
The model should be considered a security-analysis component rather than a standalone cybersecurity decision-maker.
The model produces one of two classifications:
The model considers the email to be non-malicious based on the patterns learned during fine-tuning.
The model considers the email to contain characteristics associated with malicious or threatening email content.
The model was fine-tuned from:
microsoft/deberta-v3-base
The fine-tuning dataset was:
ForentisAI_DeBERTa_Dataset_V2
The dataset used for this project is synthetic.
The model was fine-tuned using a Google Colab environment.
The best training checkpoint was:
/content/forentisai_deberta_v3/checkpoint-1312
The model was evaluated on 4,499 synthetic test samples.
| Metric | Score |
|---|---|
| Accuracy | 1.00 |
| Precision | 1.00 |
| Recall | 1.00 |
| F1 Score | 1.00 |
| ROC-AUC | 1.00 |
The evaluation metrics above were obtained using a synthetic test dataset.
These results therefore do not establish that the model will achieve the same performance on real-world email traffic.
Real-world emails can contain:
Further evaluation on representative real-world datasets is recommended before production deployment.
The model can be loaded using the Hugging Face Transformers library.
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="sudiptaroy07/forentisai-deberta-v3-email-threat-classifier"
)
text = """
Subject: Urgent account verification required
Your account requires immediate verification.
"""
result = classifier(text)
print(result)
Example output:
[{'label': 'malicious', 'score': 0.9999}]
The exact score will depend on the input.
You can test the fine-tuned model directly in Google Colab without downloading the model manually to your computer.
This is the easiest method if you simply want to paste an email and see whether the model classifies it as benign or malicious.
Open:
https://colab.research.google.com/
Create a new Python notebook.
Create a new code cell and run:
!pip install -q transformers torch
Wait for the installation to finish.
Create another code cell and run:
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="sudiptaroy07/forentisai-deberta-v3-email-threat-classifier"
)
print("Model loaded successfully.")
You should see:
Model loaded successfully.
The first time the model is loaded, Google Colab will download the model from Hugging Face. This may take some time because the model is large.
Create another code cell and run:
print("Paste your email below.")
print("When finished, type END on a new line.")
lines = []
while True:
line = input()
if line == "END":
break
lines.append(line)
email = "\n".join(lines)
result = classifier(email)
print("\nPrediction:")
print(result)
The notebook will then ask:
Paste your email below.
When finished, type END on a new line.
Paste the email you want to analyze.
You can include:
For example:
From: [email protected]
To: [email protected]
Subject: Urgent Account Verification
Dear Customer,
We detected unusual activity on your account.
Please verify your account immediately to prevent suspension.
Thank you,
Security Team
After pasting the email, type:
END
on a new line and press Enter.
The model will return a result similar to:
Prediction:
[{'label': 'malicious', 'score': 0.9999}]
or:
Prediction:
[{'label': 'benign', 'score': 0.9999}]
The result contains two values:
label
The predicted class:
benign
or:
malicious
score
The model's confidence score for its prediction.
For example:
[{'label': 'malicious', 'score': 0.9999}]
means the model predicted:
MALICIOUS
with a very high confidence score.
The score is the model's classification confidence, not a guarantee that the email is actually malicious.
A simple malicious-style test email:
From: [email protected]
To: [email protected]
Subject: Urgent Account Verification Required
Dear Customer,
We detected unusual activity on your account.
Your account will be permanently suspended within 24 hours unless you verify your identity immediately.
Please click the link below to confirm your account:
http://secure-account-verification.example.com
To complete the verification process, provide your username, password, and verification code.
Regards,
Account Security Team
A simple benign-style test email:
From: [email protected]
To: [email protected]
Subject: Updated Team Schedule
Hi,
The team schedule for next week has been updated.
Your shift on Wednesday has been moved from 10:00 AM to 11:00 AM. Please check the shared calendar for the complete schedule.
If you have any questions, please contact the operations team.
Regards,
Operations Team
These examples are provided only for basic testing and demonstration.
The model uses a DeBERTa tokenizer with a maximum sequence length of 256 tokens.
Longer inputs are truncated according to the tokenizer configuration.
The tokenizer uses the following special tokens:
[PAD]
[CLS]
[SEP]
[UNK]
[MASK]
The model is based on the DeBERTa architecture and uses a sequence-classification head for binary classification.
The uploaded model contains approximately:
184.4 million parameters
The Hugging Face Hub currently identifies the uploaded configuration as:
deberta-v2
while the fine-tuning project uses:
microsoft/deberta-v3-base
The repository configuration and uploaded model files determine the architecture metadata displayed by the Hugging Face Hub.
The repository contains the fine-tuned model and supporting configuration and tokenizer files.
Expected supporting files include:
model.safetensors
config.json
tokenizer.json
tokenizer_config.json
deployment_info.json
forentisai_model.json
README.md
The main fine-tuned model weights are stored in:
model.safetensors
The model configuration contains information such as:
The tokenizer files contain the information required to convert email text into the token representation expected by the model.
This model was developed as part of an AI-powered email threat detection and forensic intelligence project.
The broader system is intended to combine machine-learning-based email classification with technical email analysis and forensic intelligence.
The model represents the machine-learning classification component of that workflow.
This model has several important limitations:
This model is intended for defensive cybersecurity research and email threat detection.
Predictions should be treated as an automated security signal rather than definitive proof that an email is malicious or benign.
False positives and false negatives are possible and should be considered when integrating the model into security systems.
The model should be used responsibly and with appropriate security controls when integrated into real-world systems.
During manual testing with previously unseen, manually constructed examples, the model successfully classified several clearly benign, phishing-style, and Business Email Compromise-style examples.
One subtle phishing-style example was incorrectly classified as benign.
This demonstrates an important limitation: strong confidence on a prediction does not necessarily mean the prediction is correct.
Therefore, additional testing with diverse and representative real-world email datasets is required before considering production deployment.
The model can be integrated into a larger email-security pipeline.
A possible workflow is:
Incoming Email
↓
Email Text Extraction
↓
Text Preprocessing
↓
DeBERTa Email Threat Classifier
↓
BENIGN / MALICIOUS
↓
Additional Security Analysis
↓
Final Threat Assessment
The model can therefore act as one component within a broader email threat detection system.
Sudipta Roy
Hugging Face:
https://huggingface.co/sudiptaroy07
Hugging Face:
https://huggingface.co/sudiptaroy07/forentisai-deberta-v3-email-threat-classifier
Fine-tuned — Completed
The fine-tuned model is available in this repository together with its configuration, tokenizer, metadata, and documentation.
This model is provided for research, development, and educational purposes.
The model's predictions should not be considered definitive cybersecurity judgments. Always perform appropriate validation and additional security analysis before using model predictions in a production environment.