Overview
RAXE uses a dual-layer detection system to identify threats in LLM prompts and responses:- L1 (Rule-Based): Fast regex pattern matching (~1ms)
- 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
- ~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:trueif 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 attacksjailbreak- Bypassing safety guidelinesdata_exfiltration- Stealing sensitive dataagent_goal_hijack- Redirecting agent objectivestool_or_command_abuse- Misusing tools/commandsprivilege_escalation- Gaining elevated accessmemory_poisoning- Corrupting agent contextinter_agent_attack- Multi-agent system attacksrag_or_context_attack- RAG/retrieval manipulationencoding_or_obfuscation_attack- Encoding-based evasionhuman_trust_exploit- Social engineeringrogue_behavior- Unintended agent actionstoxic_or_policy_violating_content- Harmful outputother_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.