Prompt Guard 86M

Providermeta-llama
Categorytext-classification
Licensellama3.1
Downloads4.5M
Stars0

Overview

Prompt Guard 86M is a lightweight, specialized classifier designed to secure LLM pipelines by detecting prompt injections and jailbreak attempts. Unlike general-purpose models, this 86M-parameter model is optimized for low-latency inference, making it an ideal first-pass filter before requests hit your primary generative model. It categorizes inputs into 'safe' or 'unsafe' based on adversarial patterns, allowing developers to implement programmatic guards without sacrificing system performance. It integrates easily into existing middleware or API gateways, providing a critical layer of defense against malicious user inputs that seek to bypass system instructions.

Highlights

  • Low-latency classification for real-time prompt filtering
  • Efficient 86M parameter size reduces infrastructure overhead
  • Detects prompt injections and adversarial jailbreak attempts
  • Seamless integration into LLM orchestration pipelines
  • Optimized for high-throughput security screening

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("meta-llama/Prompt-Guard-86M")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Prompt-Guard-86M")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download meta-llama/Prompt-Guard-86M

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download meta-llama/Prompt-Guard-86M config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('meta-llama/Prompt-Guard-86M')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/meta-llama/Prompt-Guard-86M

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/meta-llama/Prompt-Guard-86M

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('meta-llama/Prompt-Guard-86M')
tokenizer = AutoTokenizer.from_pretrained('meta-llama/Prompt-Guard-86M')
Join our Telegram