Skip to main content

Overview

RAXE uses a dual-layer detection system to identify threats in LLM prompts and responses:
  1. L1 (Rule-Based): Fast regex pattern matching (~1ms)
  2. L2 (ML-Based): Neural classifier for novel attacks (~3ms)

L1: Rule-Based Detection

The first layer uses 514 curated regex patterns organized into 7 L1 threat families (plus 4 agentic families). Characteristics:
  • Sub-millisecond latency
  • High precision (95%+) on known patterns
  • Zero false positives on benign prompts
  • No external dependencies

L2: ML-Based Detection

The second layer uses a CPU-friendly ONNX classifier to catch:
  • Obfuscated attacks (l33t speak, Unicode tricks)
  • Novel attack patterns
  • Semantic attacks that don’t match regex
Characteristics:
  • ~3ms latency (CPU-only, no GPU needed)
  • Catches attacks L1 misses
  • Trained on real-world attack data
  • Updates via model downloads

Token Limits

L2 uses a HuggingFace tokenizer (sentence-transformers/all-mpnet-base-v2) with a maximum length of 512 tokens. Inputs longer than 512 tokens are automatically truncated. Token count and truncation status are tracked in telemetry for monitoring:
  • token_count: Number of tokens after tokenization (max 512)
  • tokens_truncated: true if input exceeded 512 tokens
For most prompts, 512 tokens is sufficient. If you frequently encounter truncation, consider chunking long inputs before scanning.

L2 Classification Heads

The ML model uses 5 specialized classification heads:

L2 Voting Engine

The ML model uses a BinaryFirstEngine voting system where the binary head (threat vs safe) is the primary decision maker, and other heads provide classification metadata.

Decision Zones

Uncategorized Threats

When the binary head detects a threat but the family classifier predicts “benign” with low confidence (< 0.60), RAXE displays “Uncategorized Threat”. This indicates a novel attack pattern that doesn’t fit known threat families.

Voting Presets

Severity Mapping

The L2 model outputs 3 severity classes (none, moderate, severe), but the API uses 5 levels for consistency with L1 rules. L2 confidence scores are mapped to severity using thresholds: When combining L1 and L2 results, the highest severity wins.

L2 Threat Families

The L2 model classifies threats into 14 families:
  • prompt_injection - Instruction override attacks
  • jailbreak - Bypassing safety guidelines
  • data_exfiltration - Stealing sensitive data
  • agent_goal_hijack - Redirecting agent objectives
  • tool_or_command_abuse - Misusing tools/commands
  • privilege_escalation - Gaining elevated access
  • memory_poisoning - Corrupting agent context
  • inter_agent_attack - Multi-agent system attacks
  • rag_or_context_attack - RAG/retrieval manipulation
  • encoding_or_obfuscation_attack - Encoding-based evasion
  • human_trust_exploit - Social engineering
  • rogue_behavior - Unintended agent actions
  • toxic_or_policy_violating_content - Harmful output
  • other_security - Other security concerns
The classifier also outputs benign when no threat is detected. This is a classification result, not a threat family. L2 families differ from L1 rule families. L1 uses 7 families (PI, JB, PII, CMD, ENC, HC, RAG) while L2 uses 14 semantic threat categories trained on attack data.

Detection Flow

Combining Results

When both layers detect threats, RAXE merges results:

Enabling/Disabling Layers

Performance Comparison