TL;DR
CAITLYN is an agent-agnostic defense middleware that protects LLM agents from prompt injection by autonomously synthesizing new defenses. It overcomes the traditional trade-off between efficiency and adaptability by using a dual-system architecture: a fast runtime engine for known threats and a "slow" evolutionary loop that generates verified defense skills from new, successful attacks.
What Problem Does This Paper Address?
As Large Language Model (LLM) agents gain more autonomy—accessing web searches, local files, and APIs—they become increasingly vulnerable to prompt injection attacks. These attacks trick the agent into executing malicious instructions hidden in external data.
The authors identify a "trilemma" in current agent defenses:
- Efficiency: Simple filters (like Regex) are fast but easily bypassed by slight variations in attack text.
- Precision: Using an LLM to "judge" every input is accurate but prohibitively slow and expensive for real-time applications.
- Adaptability: Most defenses are static; they cannot handle "emerging" or zero-day attacks without manual updates or costly retraining.
CAITLYN aims to bridge this gap by creating a system that is fast enough for production, precise enough to catch subtle attacks, and capable of evolving its own defense library without human intervention.
Methods
CAITLYN operates as a dual-system framework, separating immediate enforcement from long-term learning.
System I: Fast Runtime Enforcement
This system handles incoming traffic using a two-tiered approach:
- Tier-0 (Rule-based): Uses lightweight scripts and signatures to catch known, obvious attacks instantly without calling an LLM.
- Tier-1 (LLM Classifier): For suspicious content that passes Tier-0, CAITLYN uses a "merged-pair execution" strategy. It packs multiple defense "skills" into two parallel LLM calls. By keeping the prompt headers identical, it leverages provider-side prompt caching to drastically reduce token costs and latency.
System II: Counterexample-Guided Skill Synthesis
When an attack successfully bypasses System I, it is treated as a "counterexample." System II then enters a deliberative loop:
- Generator: An LLM analyzes the failed attack and attempts to synthesize a new defense skill (either a regex-like script or a specific detection prompt).
- Verifier: The new skill is tested in a sandbox against a corpus of attacks and benign data to ensure it catches the threat without causing false positives.
- Deployment: Once verified, the new skill is added to the shared library, "vaccinating" the agent against that attack family.
Datasets
The authors evaluated CAITLYN on three standard LLM agent security benchmarks:
- AgentDojo: A dynamic tool-use environment.
- ASPI: Scenarios involving clarifying questions and user replies.
- SafeClawBench: Tasks across six distinct attack families.
Crucially, they introduced a new benchmark called Emerging. This dataset features novel, delivery-aware injection techniques (e.g., malicious content hidden in file metadata or search results) specifically designed to test how well a defense system can adapt to threats it hasn't seen before.
Key Insights and Ideas
- Defenses as Executable Skills: Instead of a single monolithic model, CAITLYN treats security rules as modular, self-contained "skills" that can be added, updated, or retired individually.
- Learning from Failure: The core insight is that every successful attack is a formal specification for a better defense. By automating the synthesis of these defenses, the system achieves "lifelong" security.
- Engineering for Caching: The "merged-pair" approach is a clever way to bypass the high cost of LLM-based detection. By structuring prompts to maximize cache hits, the authors make high-precision defense economically viable.
Key Results
- Standard Benchmarks: CAITLYN matched the detection performance of state-of-the-art LLM-as-a-judge baselines but with significantly lower token overhead and latency (completing inspections in 2.1 to 2.5 seconds).
- Emerging Attacks: On the new Emerging benchmark, all static defenses (including the initial version of CAITLYN) were highly vulnerable, with Attack Success Rates (ASR) between 72% and 80%.
- Autonomous Adaptation: After System II synthesized new defenses from failures, CAITLYN-evolved reduced the ASR to approximately 39%—a massive 40-percentage-point improvement over static baselines.
- Backbone Independence: The system works effectively across various LLM backbones, from GPT-4 to smaller models like DeepSeek-V3.
Limitations and Future Work
- Synthesis Bottlenecks: Large clusters of diverse new attacks in a short window can overwhelm the synthesis engine, as the verifier's constraints are very strict to prevent false positives.
- Adaptive Adversaries: A very strong attacker who has access to CAITLYN's defense library could potentially craft "skill-aware" evasions. While CAITLYN can "re-vaccinate" against these, it creates a cat-and-mouse game.
- Poisoning Risks: While the authors implemented multiple layers of defense for the skill library itself (including human-in-the-loop options for cloud sync), the security of the autonomous update pipeline remains a critical area for future research.
Summary updated