Text Classification
Transformers
security
llm-guardrails
prompt-injection
jailbreak-detection

Nano-Guard Classifier v1

itsVentie/nano-guard-classifier-v1 is a binary sequence classification model fine-tuned for real-time prompt injection and jailbreak attack identification in LLM pipelines.

Source Code & Engine Integration: itsVentie/nano-guard on GitHub

Model Details

  • Base Architecture: answerdotai/ModernBERT-base
  • Task: Binary Sequence Classification (0: SAFE, 1: ATTACK)
  • Max Sequence Length: 256 tokens
  • Optimization Objective: Low-latency CPU inference via ONNX Runtime / ort.

Evaluation Results

Evaluated on test splits of itsVentie/llm-red-teaming-corpus and itsVentie/rag-prompt-injection-bench.

Metric Value
Accuracy 0.982
Precision 0.978
Recall 0.985
F1 Score 0.981

Usage

PyTorch / Transformers

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_id = "itsVentie/nano-guard-classifier-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

inputs = tokenizer("System prompt override instruction", return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
    outputs = model(**inputs)
    probabilities = torch.softmax(outputs.logits, dim=-1)

risk_score = probabilities[0][1].item()
print(f"Attack Probability: {risk_score:.4f}")
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for itsVentie/nano-guard-classifier-v1

Finetuned
(1388)
this model

Datasets used to train itsVentie/nano-guard-classifier-v1