← All models

prompt-injection detection · text · WASM · ~739 MB

Prompt-injection detection (LLM guardrail)

The built text classifiers judge sentiment or toxicity. This one judges intent against an LLM: is a prompt a normal request, or an attempt to hijack the model — "ignore your instructions", jailbreaks, system-prompt extraction, role-play escapes? It's the input filter you put in front of an LLM app to catch adversarial prompts before they reach the model. Type a prompt or try an example. Runs entirely on your device.

At a glance

Modeldeberta-v3-base-prompt-injection-v2 — a deberta-v3 classifier
Task / pipelinetext-classification — SAFE vs INJECTION — via transformers.js
Inputa user prompt (the text you'd send to an LLM)
Outputa probability for SAFE vs INJECTION (softmax over the two classes)
Quantizationfp32 ONNX — runs on the plain WASM backend, no WebGPU needed
Download~739 MB, cached after first load (auto-inits on return)
LicenseApache-2.0 (ProtectAI)
Web APIsWebAssembly, Web Workers — all Baseline widely available

Screen a prompt

A guardrail, not a fix

Injection detection is a filter: it flags prompts that try to override an application's instructions, so you can block or review them before they reach your LLM. It's a classifier, so it can miss novel attacks or occasionally over-flag an unusual-but-benign prompt — the confidence score shows how sure it is. Running it locally means user prompts never leave the device to be screened.

Use-case ladder

Basics: Prompt Injection Scanner

Compare benign vs adversarial presets with live SAFE/INJECTION probability bars, a confidence gauge, and a block-threshold slider.

Practical: Client-Side AI Firewall

Scan untrusted user input plus retrieved RAG chunks independently off-main-thread, quarantine poisoned chunks, and build a sanitized payload.

Wild: Red-Team Jailbreak Sandbox

Try to smuggle a covert instruction past the local DeBERTa guard across three difficulty tiers with perturbation diffs and trigger-word ablation.

Multi-model: Two-Stage Privacy & Safety Gate

Chain DeBERTa-v3 prompt-injection screening with BERT NER PII redaction for a combined Cleared/Quarantined verdict and per-stage timings.