Skip to main content

Security

Detectors that identify adversarial inputs such as prompt injections, jailbreak attempts, and encoded/obfuscated payloads.

prompt-injection-deberta-v3-base

DeBERTa v3 model for prompt injection detection.

prompt-injection-deberta-finetuned-11122024

Vijil-finetuned DeBERTa model for prompt injection detection.

prompt-injection-mbert

Vijil ModernBERT model for prompt injection detection. Supports up to 8,192 tokens natively, so sliding windows only activate for very long inputs.

prompt-injection-mbert-safeguard

API-only prompt injection detection backed by an OpenAI-compatible chat completions endpoint. Defaults to GPT-OSS-Safeguard-20B on Groq (~200ms, high accuracy), but base_url, model, and api_key_name can be overridden to point at any OpenAI-style deployment (local vLLM, Together, Fireworks, OpenAI itself, etc). No ModernBERT loaded. Oversize inputs are truncated (not chunked) to max_input_chars before being sent and the default Groq model’s ~130K token context window makes truncation a rare safety net.
Note on max_tokens: gpt-oss-safeguard-20b is a reasoning model that consumes part of its token budget on internal reasoning before emitting any assistant content. Setting max_tokens too low (e.g. 8) causes the response to hit finish_reason=length with an empty content field, which the Detector silently classifies as safe. Keep this generous.
  • Class: PImbertSafeguard
  • Requires: the env var named by api_key_name (defaults to GROQ_API_KEY)

prompt-injection-mbert-hybrid

Two-stage Detector: ModernBERT classifies first, and low-confidence predictions are escalated to GPT-OSS-Safeguard-20B. ~5ms average latency, near-100% accuracy, API cost only on uncertain examples. Accepts all parameters from both prompt-injection-mbert and prompt-injection-mbert-safeguard. If GROQ_API_KEY is not set, the hybrid mode silently falls back to fast-only classification instead of failing.

security-promptguard

Meta Prompt Guard model for jailbreak and prompt injection detection.

security-llm

LLM-based security classification via LiteLLM.
  • Class: LlmSecurity

security-embeddings

Jailbreak detection via embedding similarity against a known-jailbreak corpus.

jb-length-per-perplexity

Perplexity-based heuristic that flags jailbreaks by their length-to-perplexity ratio.
  • Class: LengthPerPerplexityModel

jb-prefix-suffix-perplexity

Perplexity-based heuristic that analyses the prefix and suffix of inputs separately.
  • Class: PrefixSuffixPerplexityModel

encoding-heuristics

Rule-based Detector for encoded or obfuscated payloads (base64, ROT13, hex, URL encoding, Unicode tricks, etc.). Default threshold_map:
  • Class: EncodingHeuristicsDetector

Moderation

Detectors for toxic, harmful, or otherwise inappropriate content.

moderation-deberta

DeBERTa model for toxicity scoring. The 208-token context window means the sliding window activates for most non-trivial inputs.

moderation-mbert

Vijil ModernBERT model for toxic content detection. Supports up to 8,192 tokens natively.

moderation-mbert-safeguard

API-only toxicity / moderation detection backed by an OpenAI-compatible chat completions endpoint. Defaults to GPT-OSS-Safeguard-20B on Groq (~200ms, high accuracy), but base_url, model, and api_key_name can be overridden to point at any OpenAI-style deployment (local vLLM, Together, Fireworks, OpenAI itself, …). No ModernBERT loaded. Oversize inputs are truncated (not chunked) to max_input_chars before being sent — the default Groq model’s ~130K token context window makes truncation a rare safety net.
Note on max_tokens: gpt-oss-safeguard-20b is a reasoning model that consumes part of its token budget on internal reasoning before emitting any assistant content. Setting max_tokens too low (e.g. 8) causes the response to hit finish_reason=length with an empty content field, which the Detector silently classifies as safe. Keep this generous.
  • Class: ModerationMbertSafeguard
  • Requires: the env var named by api_key_name (defaults to GROQ_API_KEY)

moderation-mbert-hybrid

Two-stage Detector: ModernBERT classifies first, and low-confidence predictions are escalated to GPT-OSS-Safeguard-20B. ~5ms average latency, near-100% accuracy, API cost only on uncertain examples. Accepts all parameters from both moderation-mbert and moderation-mbert-safeguard. If GROQ_API_KEY is not set, the hybrid mode silently falls back to fast-only classification instead of failing.

moderations-oai-api

OpenAI Moderation API with per-category score thresholds. Supported categories: hate, hate/threatening, self-harm, sexual, sexual/minors, violence, violence/graphic, harassment, harassment/threatening, illegal, illicit, self-harm/intent, self-harm/instructions, sexual/instructions.
  • Class: OpenAIModerations
  • Requires: OPENAI_API_KEY environment variable

moderation-perspective-api

Google Perspective API for toxicity and other attributes. Available attributes: TOXICITY, SEVERE_TOXICITY, IDENTITY_ATTACK, INSULT, PROFANITY, THREAT.
  • Class: PerspectiveAPI
  • Requires: PERSPECTIVE_API_KEY environment variable

moderation-prompt-engineering

LLM-based moderation classification via LiteLLM.
  • Class: LlmModerations

moderation-flashtext

Keyword ban-list Detector using FlashText for fast matching.
  • Class: KWBanList

stereotype-eeoc-fast

Vijil ModernBERT classifier for stereotypes and harmful generalizations about EEOC protected classes (Race/Color, Sex/Gender/Sexual Orientation, Religion, National Origin, Age 40+, Disability). Distilled from GPT-OSS-Safeguard-20B against a custom EEOC discrimination policy. Self-hosted, < 5ms latency, F1=0.923, zero API cost. Detects stereotyping within a single prompt or response. Does not detect counterfactual bias (whether varying only the protected class in a prompt produces different outputs) — that requires comparing pairs of prompt-response outputs and is out of scope. When given a DomePayload with both prompt and response, the Detector reconstructs the training format (prompt [SEP] response). When only text is set, it is treated as the prompt half with an empty response. Inputs longer than max_length are split into multiple [SEP]-centered chunks; any chunk flagged flags the whole input, and the max score wins.

stereotype-eeoc-safeguard

API-only EEOC stereotype detection backed by an OpenAI-compatible chat completions endpoint. Defaults to GPT-OSS-Safeguard-20B on Groq (~200ms, ~100% accuracy), but base_url, model, and api_key_name can be overridden to point at any OpenAI-style deployment (local vLLM, Together, Fireworks, OpenAI itself, …). No ModernBERT loaded. Oversize inputs are truncated (not chunked) to max_input_chars before being sent and the default Groq model’s ~130K token context window makes truncation a rare safety net.
max_tokens: gpt-oss-safeguard-20b is a reasoning model that consumes part of its token budget on internal reasoning before emitting any assistant content. Setting max_tokens too low (e.g. 8) causes the response to hit finish_reason=length with an empty content field, which the Detector silently classifies as safe. Keep this generous.
  • Class: StereotypeEEOCSafeguard
  • Requires: the env var named by api_key_name (defaults to GROQ_API_KEY)

stereotype-eeoc-hybrid

Two-stage Detector: ModernBERT classifies first, and low-confidence predictions are escalated to GPT-OSS-Safeguard-20B. ~5ms average latency, near-100% accuracy, API cost only on uncertain examples. Accepts all parameters from both stereotype-eeoc-fast and stereotype-eeoc-safeguard. If GROQ_API_KEY is not set, the hybrid mode silently falls back to fast-only classification instead of failing.
  • Class: StereotypeEEOCHybrid
  • Model: Vijil/stereotype-eeoc-Detector
  • Requires: the env var named by api_key_name (defaults to GROQ_API_KEY); optional — falls back to fast-only if absent

Privacy

Detectors for personally identifiable information (PII) and secrets.

privacy-presidio

Microsoft Presidio-based PII detection and redaction.
  • Class: PresidioDetector

detect-secrets

Pattern-based secret and credential detection (API keys, tokens, etc.). Includes 25 Detector plugins: ArtifactoryDetector, AWSKeyDetector, AzureStorageKeyDetector, BasicAuthDetector, CloudantDetector, DiscordBotTokenDetector, GitHubTokenDetector, GitLabTokenDetector, IbmCloudIamDetector, IbmCosHmacDetector, IPPublicDetector, JwtTokenDetector, KeywordDetector, MailchimpDetector, NpmDetector, OpenAIDetector, PrivateKeyDetector, PypiTokenDetector, SendGridDetector, SlackDetector, SoftlayerDetector, SquareOAuthDetector, StripeDetector, TelegramBotTokenDetector, TwilioKeyDetector.
  • Class: SecretDetector

Integrity

Detectors for hallucinations and factual accuracy. These typically require a reference context to compare against.

hhem-hallucination

Vectara HHEM model for hallucination detection by comparing output against a reference context.

fact-check-roberta

RoBERTa model for detecting factual contradictions between output and context.

hallucination-llm

LLM-based hallucination detection with reference context.
  • Class: LlmHallucination

fact-check-llm

LLM-based fact-checking with reference context.
  • Class: LlmFactcheck

Generic

Flexible Detectors that can be customised for arbitrary use cases.

generic-llm

Custom LLM-based detection with user-provided system prompts and trigger words.
  • Class: GenericLLMDetector

policy-gpt-oss-safeguard

Policy-based content classification using GPT-OSS-Safeguard.
  • Class: PolicyGptOssSafeguard

Sliding Window Behaviour

HuggingFace-based Detectors (DeBERTa, ModernBERT, PromptGuard) use a sliding window to handle inputs longer than their max_length. Key points:
  • Fast path: inputs that fit in a single window are processed unchanged.
  • Overlap: window_stride < usable window size creates overlapping windows, ensuring content at boundaries is not missed.
  • Aggregation: any window flagged as unsafe causes the entire input to be flagged (any-positive strategy). For score-based Detectors, the maximum score across windows is reported.
  • Batch processing: detect_batch() flattens all chunks from all inputs into a single pipeline call, then re-aggregates results per input.
The window_stride parameter is configurable per Detector via TOML or dict config.

Configuration

Parameters are passed under the method name in your Guard configuration:

TOML

Python dict

Last modified on April 28, 2026