Manuscript Offprint

arXiv:2610.25540

Auditing Tool Traces in Agentic LLMs: Source Localization and Counterfactual Dependence Testing

Junhao Liu, Tianxiao Li, Yongxian Wu, Ziheng Duan, Ren Li, Jing Zhang, Martin Renqiang Min

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Agentic LLMs increasingly support scientific prediction by grounding decisions in external evidence. In biology, they promise accurate, interpretable predictions for important problems by integrating complex experimental and computational evidence. However, serialized tool results can contain hidden label shortcuts, such as dataset identifiers or template artifacts, that create apparent success without biological reasoning. To address this risk, we introduce a two-stage audit. Stage 1, Per-Tool TF-IDF Decomposition (PT2D), localizes label-predictive patterns to individual tool results while avoiding signal dilution in the concatenated tool trace. Stage 2, Token-Class Redaction, counterfactually tests whether the frozen LLM depends on the localized shortcut. We apply this audit to TCR–pMHC binding, where tool augmentation substantially outperforms a no-evidence baseline. At face value, this suggests that the LLM has learned to use scientific evidence. The audit overturns this interpretation: PT2D localizes the strongest signal to identifiers in one tool result, and redacting them reduces performance to chance. These findings show how hidden label shortcuts can masquerade as scientific reasoning or discovery, motivating source-level audits before benchmark gains are trusted.

1 Introduction

Large language models (LLMs) are increasingly coupled to external evidence in scientific workflows. General paradigms include tool use [Schick et al., 2023, Yao et al., 2023], retrieval-augmented generation [Lewis et al., 2020], and agentic pipelines that chain multiple tools and return their results to the model [Shen et al., 2023]; domain systems have instantiated these ideas with genomics databases and chemistry tools [Jin et al., 2024, Bran et al., 2024]. We use tool trace to denote the ordered collection of serialized tool results supplied to the LLM. In scientific workflows, these results are intended to serve as external evidence for prediction, but the resulting tool trace remains distinct from a reasoning trace generated by the LLM itself.

The appeal of this setup in biomedical settings is straightforward. Parametric knowledge can be incomplete or stale, and LLMs remain prone to hallucination [Lewis et al., 2020, Jin et al., 2024, Bran et al., 2024]. Injecting structured evidence from databases, simulators, or analytical tools at inference time therefore appears to give the model a chance to reason from retrieved facts rather than unsupported recall, while keeping predictions auditable against an explicit tool trace.

However, evidence-augmented pipelines introduce an evaluation failure mode that ordinary benchmark checks may miss [Kapoor and Narayanan, 2023, Lapuschkin et al., 2019]. Serialized tool results may contain hidden label shortcuts that correlate with labels without carrying the intended scientific semantics. Such shortcuts [Geirhos et al., 2020] can arise from entry identifiers, version strings, file paths, duplicated fields, template artifacts, or other textual patterns introduced by deposition,

40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: Agentic AI for Biological Discovery (AgenticLS).

Figure

Figure 1: PT2D localizes Tool 3 as the strongest cross-split carrier.

Figure

Figure 2: Adding real (A) or synthetic (B) tool results dilutes Tool 3's cross-split signal.

annotation, sampling, or serialization. They may survive semantic data splits because their generating process need not follow scientific grouping. Screening only the concatenated tool trace can also miss a pattern confined to one component because heterogeneous results dilute it. Thus, apparently rigorous performance may reflect shortcut exploitation rather than evidence-grounded reasoning.

To address hidden label shortcuts in tool traces, we introduce a two-stage audit that separates source localization from behavioral verification. First, Per-Tool TF-IDF Decomposition (PT2D) analyzes each tool result independently to localize label-predictive patterns that may be hidden when heterogeneous results are concatenated into a full tool trace. This design is motivated by the dilution effect: unrelated components can obscure a shortcut confined to one tool. Second, Token-Class Redaction removes the localized shortcut class from all prompt-bearing fields and reevaluates the same frozen LLM, counterfactually testing whether its predictions depend on that shortcut rather than the intended scientific evidence. We further validate the motivation for per-tool decomposition by quantifying dilution through real tool-subset sweeps and synthetic label-independent additions.

In our TCR–pMHC case study using peptide-disjoint splits from prior benchmarks [Slone et al., 2025, Abeer et al., 2026], a Qwen3-4B model [Qwen Team, 2025] fine-tuned on five-tool traces substantially outperforms a no-evidence baseline, seemingly indicating evidence-grounded generalization. The audit overturns this interpretation: PT2D localizes the strongest transferable signal to PDB identifiers in one tool result, and identifier redaction collapses performance to chance while peptide redaction leaves it unchanged. Real-tool and label-independent synthetic dilution sweeps further explain why full-trace screening misses this shortcut. Together, these findings motivate source-level provenance analysis and counterfactual verification before tool-augmented gains are interpreted as scientific reasoning or discovery.

References (19)