An email-handling LLM might follow a malicious message that asks it to write malware and send it to other contacts. Context-aware filtering checks prompts and generated outputs for unsafe requests, unauthorized actions, or sensitive data leakage. section 6.3.6
A practical filtering strategy combines several defenses:
- Search for dangerous keywords or use a second LLM to validate inputs and outputs. section 6.3.6
- Sanitize and validate incoming text, monitor for bypasses, and update models regularly. section 6.3.6
- Support language-specific safeguards; denying unsupported languages improves containment but reduces usability. section 6.3.6
A layered defense
A system can reject a suspicious prompt, inspect the response for leaked secrets such as a confidential recipe, and rely on monitoring when an attacker evades both checks. A trained model may additionally refuse with “Sorry, but I can’t assist with that.” section 6.3.6
