Input Guardrails
Input guardrails analyze user prompts before they reach AI models. They check for: PII and sensitive data, prompt injection attempts, prohibited topics, and policy violations. Input guardrails can block, redact, or modify prompts in real-time.
Output Guardrails
Output guardrails screen AI responses before delivery to users. They verify: response appropriateness, factual grounding, brand compliance, and content safety. Output guardrails prevent harmful or off-policy content from reaching end users.
Semantic vs Rule-Based
Rule-based guardrails use pattern matching (regex, keyword lists) for fast, predictable detection. Semantic guardrails use AI to understand meaning and intent, catching sophisticated attempts that rules miss. Best practice is using both in a dual-layer architecture.
Performance Considerations
Guardrail latency impacts user experience. Rule-based checks add 1-5ms. Semantic analysis adds 50-200ms. Optimize by running rule-based checks first (blocking obvious violations instantly) and semantic checks concurrently with model inference.
.png)