TL;DR
Hidden-state probes trained on normal ("benign") data to detect tool-use errors often fail to generalize when LLM agents face adversarial attacks like prompt injections or system overrides. In several critical scenarios, simple uncertainty metrics like token entropy significantly outperform these sophisticated internal probes, suggesting that internal model representations of "correctness" are surprisingly fragile under pressure.
What Problem Does This Paper Address?
As Large Language Model (LLM) agents move from simple chat to executing real-world actions via tools (APIs), ensuring they act correctly is paramount. Researchers often use hidden-state probes—small, efficient classifiers trained on the model's internal activations—to monitor whether a model is about to make a mistake.
However, most of these probes are trained on "benign" data—standard, non-malicious interactions. The big question this paper tackles is: Do these benign-trained probes still work when the model is being actively manipulated? If an attacker uses prompt injection to hijack an agent, can a probe trained only on normal errors still flag the resulting "incorrect" tool call?
Methods
The authors evaluated three models—Qwen2.5-7B-Instruct, Qwen2.5-14B-Instruct, and GLM-4.6V-Flash (9B)—across four scenarios: benign, prompt-injection, system-override, and tool-poisoning.
Their approach involved:
- Hidden-State Probing: They trained logistic regression classifiers on the hidden states of the last transformer layer (specifically the token immediately preceding a tool call).
- Benign-Only Training: Crucially, probes were trained only on benign, non-defended trajectories to see how well they generalize to "unseen" adversarial conditions.
- Scalar Baselines: They compared the probes against three standard uncertainty metrics:
- Mean tool-call-token entropy: How "confused" the model is about the tokens it's generating for the tool call.
- Negative mean log-probability: A measure of how "unlikely" the model finds its own output.
- Self-consistency uncertainty: Comparing multiple outputs from the same prompt at different temperatures to see if the model is consistent.
Datasets
The study utilized four suites from the AgentDojo (v1.1.1) benchmark:
- Workspace, Banking, Travel, and Slack. These suites provide realistic multi-step trajectories where agents must use tools to solve tasks, often while encountering adversarial "traps" designed to divert them from the correct path.
Key Insights and Ideas
- The Recognition-Action Gap: Previous research suggested models might "know" they are being attacked (their internal states change), but they follow the malicious instructions anyway. This paper shows that even if the state changes, a probe trained on normal errors might not recognize these "adversarial errors" as errors.
- Model Size is No Shield: Interestingly, the larger Qwen2.5-14B model's probe performed worse than the 7B version's probe under certain adversarial conditions. Increasing parameters doesn't automatically make internal "correctness" signals more robust.
- System Overrides are the "Probe Killers": The "system-override" condition (where a malicious instruction tries to countermand the original system prompt) proved most difficult for probes. In this setting, the internal representations shifted so much that the benign-trained probes became effectively useless, sometimes performing worse than random guessing.
Key Results
The quantitative results, summarized in Table I, reveal a striking trend: the hidden-state probes rarely outperformed simple scalar metrics across the board.
The most dramatic failure occurred with Qwen2.5-14B-Instruct under system-override. The hidden-state probe achieved an AUROC of only 0.431 (worse than a random coin flip of 0.5), while simple token entropy reached 0.758.
As shown in Figure 1, paired statistical tests confirmed that for the 14B model under system-override, all three scalar uncertainty metrics were significantly better than the hidden-state probe.
Limitations and Future Work
- Offline Evaluation: The study was conducted on pre-stored trajectories. Real-world deployment would need to account for the latency and computational cost of running these probes and uncertainty checks in real-time.
- Task Coverage: While AgentDojo is realistic, the number of independent task groups (96) is relatively small, which can introduce variance in cross-validation.
- Scope: The findings are specific to tool-use errors and may not generalize to other types of LLM failures, such as natural language hallucinations.
The authors conclude that we should not assume benign-trained probes are reliable safety monitors for adversarial settings. Future work should explore training probes on a more diverse set of "attacked" trajectories or developing hybrid methods that combine internal states with external uncertainty signals.
Summary updated