Do Benign-Trained Hidden-State Probes Detect Tool Errors Under Adversarial Conditions?

Bibek Bhandari, Kshitij LingtheparXiv 2026 · arXiv

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.

Table I: AUROC and AP for each detector. Note the sharp drop for the Qwen 14B probe under system override.

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.

Fig. 1. Paired detector differences. Positive values favor the hidden-state probe; negative values favor the scalar comparator. The figure shows family-wise max-|t| simultaneous bootstrap intervals and Holm-adjusted paired cluster-swap permutation results. Asterisks indicate comparisons that remain significant after Holm correction (pHolm < 0.05). Entropy denotes mean tool-call-token entropy.

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

Abstract

Although hidden-state probes efficiently monitor model operation, it remains unclear whether probes trained on benign tool use remain useful for detecting incorrect actions under adversarial conditions. In this research, we assess this problem from the perspective of operational tool-action correct- ness. we use four AgentDojo suites, four conditions, and three models: Qwen2.5-7B-Instruct, Qwen2.5-14B-Instruct, and GLM- 4.6V-Flash (9B). We perform a five-fold, task-grouped out-of-fold (OOF) evaluation for each model. We train step-specific logistic- regression probes only on benign and non-defended trajectories and evaluate them on held-out trajectories for benign, prompt- injection, system-override, and tool-poisoning conditions. We compare our hidden-state probe to mean tool-call-token entropy, negative mean tool-call-token log-probability, and self-consistency uncertainty. The paired tests highlight six significant differences after Holm correction. All of the tests involve Qwen2.5-14B- Instruct under the system-override condition, with all three scalar uncertainty metrics obtaining higher area under the receiver operating characteristic curve (AUROC) and average precision (AP) than the hidden-state probe. These results suggest that benign-trained hidden-state probes should not be assumed to reliably detect operational tool-action errors under adversarial conditions.
BibTeX
@misc{bhandari2026do,
  author = {Bibek Bhandari and Kshitij Lingthep},
  title = {{Do Benign-Trained Hidden-State Probes Detect Tool Errors Under Adversarial Conditions?}},
  year = {2026},
  eprint = {2611.11172},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.11172},
}
Figure