ChatPaper.aiChatPaper

AgentWatcher: Монитор инъекций в промпты на основе правил

AgentWatcher: A Rule-based Prompt Injection Monitor

April 1, 2026
Авторы: Yanting Wang, Wei Zou, Runpeng Geng, Jinyuan Jia
cs.AI

Аннотация

Крупные языковые модели (LLM) и их приложения, такие как агенты, крайне уязвимы к атакам внедрением в промпты (prompt injection). Современные методы обнаружения внедрения в промпты имеют следующие ограничения: (1) их эффективность значительно снижается с увеличением длины контекста и (2) им не хватает явных правил, определяющих, что constitutes внедрение в промпт, из-за чего решения об обнаружении являются неявными, непрозрачными и трудными для интерпретации. В данной работе мы предлагаем систему AgentWatcher для решения двух указанных проблем. Для преодоления первого ограничения AgentWatcher относит выходные данные LLM (например, действие агента) к небольшому набору причинно-влиятельных сегментов контекста. Сосредоточив обнаружение на относительно коротком тексте, AgentWatcher остается масштабируемым для длинных контекстов. Для решения второй проблемы мы определяем набор правил, специфицирующих, что является, а что не является внедрением в промпт, и используем мониторинговую LLM для логического вывода на основе этих правил и атрибутированного текста, что делает решения по обнаружению более объяснимыми. Мы провели всестороннюю оценку на бенчмарках для агентов, использующих инструменты, и наборах данных для понимания длинных контекстов. Результаты экспериментов показывают, что AgentWatcher эффективно обнаруживает внедрение в промпты и сохраняет функциональность при отсутствии атак. Код доступен по адресу https://github.com/wang-yanting/AgentWatcher.
English
Large language models (LLMs) and their applications, such as agents, are highly vulnerable to prompt injection attacks. State-of-the-art prompt injection detection methods have the following limitations: (1) their effectiveness degrades significantly as context length increases, and (2) they lack explicit rules that define what constitutes prompt injection, causing detection decisions to be implicit, opaque, and difficult to reason about. In this work, we propose AgentWatcher to address the above two limitations. To address the first limitation, AgentWatcher attributes the LLM's output (e.g., the action of an agent) to a small set of causally influential context segments. By focusing detection on a relatively short text, AgentWatcher can be scalable to long contexts. To address the second limitation, we define a set of rules specifying what does and does not constitute a prompt injection, and use a monitor LLM to reason over these rules based on the attributed text, making the detection decisions more explainable. We conduct a comprehensive evaluation on tool-use agent benchmarks and long-context understanding datasets. The experimental results demonstrate that AgentWatcher can effectively detect prompt injection and maintain utility without attacks. The code is available at https://github.com/wang-yanting/AgentWatcher.
PDF01April 3, 2026