Downloads · 30 days
7
7% of all-time downloads
jsayyar04/modernbert-jailbreak-guard
modernbert-jailbreak-guard is a text classification model from jsayyar04. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This repository hosts a sequence classification model fine-tuned to act as a pre-inference security gate for Large Language Model applications. Its core task is to inspect incoming user prompts and classify them as be…
Downloads · 30 days
7
7% of all-time downloads
All-time downloads
97
Public
Parameters
150M
598 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors598 MB · 99%
From the Hugging Face model README
This repository hosts a sequence classification model fine-tuned to act as a pre-inference security gate for Large Language Model applications. Its core task is to inspect incoming user prompts and classify them as benign or jailbreak with minimal latency.
The architecture leverages answerdotai/ModernBERT-base as its core encoder backbone and attaches a sequence classification head optimized over full-parameter weight tuning on a T4 GPU.
Evaluated against an independent test split, this guardrail achieves strong metrics:
This model is intended to run as a Pre-Inference Gateway Shield. It intercepts raw string requests coming from client user interfaces before they are routed to generative backends like GPT-4, Llama 3, or Claude.
The model was fine-tuned on the balanced split of the jackhhao/jailbreak-classification dataset.
The dataset features a balanced distribution of classic adversarial templates, context-switching overrides, hypothetical roleplay scripts, and standard conversational strings.
The model was fine-tuned using the Hugging Face Trainer library on a single cloud-hosted NVIDIA Tesla T4 GPU.
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision Jailbreak | Recall Jailbreak | F1 Jailbreak | Macro F1 | True Negatives | False Positives | False Negatives | True Positives | False Negative Rate | False Positive Rate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.0587 | 1.0 | 131 | 0.0544 | 0.9847 | 0.9787 | 0.9928 | 0.9857 | 0.9847 | 120 | 3 | 1 | 138 | 0.0072 | 0.0244 |
| 0.0027 | 2.0 | 262 | 0.0306 | 0.9885 | 0.9857 | 0.9928 | 0.9892 | 0.9885 | 121 | 2 | 1 | 138 | 0.0072 | 0.0163 |
| 0.0001 | 3.0 | 393 | 0.0265 | 0.9924 | 0.9928 | 0.9928 | 0.9928 | 0.9923 | 122 | 1 | 1 | 138 | 0.0072 | 0.0081 |
| 0.0000 | 4.0 | 524 | 0.0266 | 0.9962 | 1.0 | 0.9928 | 0.9964 | 0.9962 | 123 | 0 | 1 | 138 | 0.0072 | 0.0 |