Source-linked AI summary
LLM Agents Already Know When to Call Tools -- Even Without Reasoning
Chung-En Sun, Linbo Liu, Ge Yan, Zimo Wang, Tsui-Wei Weng
TL;DR
Existing tool-use benchmarks assume every task requires a tool, leaving tool-necessity decisions systematically understudied despite unnecessary calls wasting API fees and latency. The paper builds When2Tool and uses a linear probe on hidden states to prefill responses according to predicted tool necessity. Probe&Prefill yields a strictly better accuracy–efficiency tradeoff than Prompt-only and Reason-then-Act baselines, reducing API calls by 20–56% on the Search-o1 agentic benchmark.
Problem
Existing tool-use benchmarks assume every task requires a tool, leaving tool-necessity decisions systematically understudied despite unnecessary calls wasting API fees and latency.
Method
The paper builds When2Tool and uses a linear probe on hidden states to prefill responses according to predicted tool necessity.
Results
Probe&Prefill yields a strictly better accuracy–efficiency tradeoff than Prompt-only and Reason-then-Act baselines, reducing API calls by 20–56% on the Search-o1 agentic benchmark.
Takeaways & Limitations
Tool necessity is reliably encoded in hidden states, and lightweight training-free steering can improve the accuracy–efficiency tradeoff of tool-augmented agents.
Abstract
from arXiv · showhide
Tool-augmented LLM agents tend to call tools indiscriminately, even when the model can answer directly. Each unnecessary call wastes API fees and latency, yet no existing benchmark systematically studies when a tool call is actually needed. We propose When2Tool, a benchmark of 18 environments (15 single-hop, 3 multi-hop) spanning three categories of tool necessity -- computational scale, knowledge boundaries, and execution reliability -- each with controlled difficulty levels that create a clear decision boundary between tool-necessary and tool-unnecessary tasks. We evaluate two families of training-free baselines: Prompt-only (varying the prompt to discourage unnecessary calls) and Reason-then-Act (requiring the model to reason about tool necessity before acting). Both provide limited control: Prompt-only suppresses necessary calls alongside unnecessary ones, and Reason-then-Act still incurs a disproportionate accuracy cost on hard tasks. To understand why these baselines fail, we probe the models' hidden states and find that tool necessity is linearly decodable from the pre-generation representation with AUROC 0.89--0.96 across six models, substantially exceeding the model's own verbalized reasoning. This reveals that models already know when tools are needed, but fail to act on this knowledge during generation. Building on this finding, we propose Probe&Prefill, which uses a lightweight linear probe to read the hidden-state signal and prefills the model's response with a steering sentence. Across all models tested, Probe&Prefill reduces tool calls by 48% with only 1.7% accuracy loss, while the best baseline at comparable accuracy only reduces 6% of tool calls, or achieves a similar tool call reduction but incurs a 5$\times$ higher accuracy loss. Our code is available at https://github.com/Trustworthy-ML-Lab/when2tool
1 Introduction
WHEN2TOOL studies whether LLM agents can decide when tool calls are necessary in realistic API-like interactions, and PROBE&PREFILL uses hidden-state signals to steer that decision. The method improves the tradeoff between tool-call reduction and accuracy, including on agentic search.
- WHEN2TOOL: WHEN2TOOL contains 18 environments—15 single-hop and 3 multi-hop—across three tool-necessity categories with controlled difficulty levels.Its interactions require correctly formatted tool arguments and parsing and matching tool responses, mirroring real API use.
- Failure Analysis: Hidden-state probes achieve AUROC above 0.9 across models, indicating that models internally encode whether a tool call is needed.The signal is extracted from the hidden state at the last input token and predicted with a simple linear classifier.
- PROBE&PREFILL: PROBE&PREFILL uses a linear probe over hidden states to prefill a steering sentence that guides whether the model calls a tool, achieving better tradeoffs.The probe predicts tool necessity from the last input-token representation, while inference-time prefilling directs subsequent generation toward using or avoiding a tool.
- Failure Analysis: Prompt-only and Reason-then-Act baselines offer limited, coarse control, with hard tasks paying a disproportionate accuracy cost for each saved call.The benchmark includes 1,080 training tasks and 2,700 test tasks for evaluating these tool-call decisions.
- Results: 20–56% fewer API calls are achieved on the Search-o1 agentic benchmark [Li et al., 2025a].This demonstrates that the proposed method generalizes beyond the WHEN2TOOL benchmark to real-world agentic search.
- Results: 6% tool-call reduction is obtained by the best baselines at comparable accuracy, while similar reductions incur 5× more accuracy loss.These comparisons show that existing baselines provide substantially less efficient control over tool-call decisions.
2 WHEN2TOOL: A Benchmark for Tool-Call Decisions
WHEN2TOOL is a controlled benchmark for deciding whether tool use is necessary rather than assuming every task requires a tool. It spans computational scale, knowledge boundaries, and execution reliability across controlled difficulty levels, including single- and multi-hop tasks.
- The benchmark contains 18 environments—15 single-hop and 3 multi-hop—covering computational scale, knowledge boundaries, and execution reliability.Each category includes five single-hop and one multi-hop environment.
- Its three categories test whether models can compute at scale, know required facts, or execute sequential procedures reliably.The benchmark distinguishes computational feasibility, factual knowledge availability, and faithful step-by-step execution.
- Three difficulty levels target overcalling on easy tasks, calibrated decisions at the medium boundary, and recognizing tool necessity on hard tasks.Difficulty assignments are empirically validated by forcing models to answer all tasks without tools (Table 6, Appendix A).
- The dataset comprises 1,080 training tasks and 2,700 test tasks across the 18 environments.The single-hop environments contribute 900 training and 2,250 test tasks, while multi-hop environments contribute 180 training and 450 test tasks.
- WHEN2TOOL is the first benchmark to evaluate tool-call decisions with controlled difficulty, multi-hop tasks, and zero API cost.
3 Failure Analysis: The Limits of Prompting and Explicit Reasoning
Prompt-only and Reason-then-Act methods fail to selectively reduce unnecessary tool calls: discouraging use also suppresses needed calls, while explicit reasoning only partially improves the tradeoff at added cost. Across models, prompt-level control remains coarse and unreliable, motivating investigation of whether models internally know tool necessity but fail to act on it.
- 3.2 Key findings: Together, these findings show that prompt-level control is limited, coarse, and unreliable across models, raising whether models know tool necessity internally but fail to act on it.This motivates the hidden-state investigation in the next section.
- 3.1 Experimental setup: The study evaluates six models—Qwen3-1.7B/4B/14B/32B and Llama-3.1-8B/3.3-70B—with each experiment repeated three times using different random seeds.Reported results are means across the three runs.
- 3.1 Experimental setup: Prompt-only spans Force, Default, Necessary, Sparse, and No Tool modes, while Reason-then-Act adds a necessity-assessment step before acting under each mode.The reasoning instruction asks the model to decide whether it can answer directly or needs a tool.
- 3.2 Key findings: Models make 2,100–4,400 default tool calls across 2,250 single-hop tasks, exceeding one call per task and demonstrating systematic tool overuse.Even easy tasks trigger 864 calls for Qwen3-1.7B and 1,482 for Llama-3.3-70B.
- 3.2 Key findings: Prompt engineering reduces tool calls indiscriminately, including on hard tasks where tools are genuinely needed, causing a disproportionate accuracy cost per saved call.The accuracy-cost metric ∆Acc −∆TC quantifies accuracy lost for each eliminated call; hard tasks pay more than easy tasks.
- 3.2 Key findings: Reason-then-Act improves the accuracy cost per saved call on easy tasks, but still suppresses necessary hard-task calls and incurs substantial accuracy loss.For Qwen3-14B easy tasks, the cost improves from −14.9 to −6.6, while hard tasks still incur −34.7.
- 3.2 Key findings: Reasoning adds generation overhead and its effectiveness depends on the model, limiting the reliability of its partial improvement.Figure 2 shows a closer upper-right position on easy tasks but negative efficiency on hard tasks.
- 3.2 Key findings: Neither baseline provides smooth accuracy–tool-call control: each prompt mode yields a fixed operating point, and several modes are nearly indistinguishable.This prevents users from setting a tool-call budget and maximizing accuracy under it.
4 Probing Analysis: Decoding Implicit Tool Necessity
Tool necessity is consistently encoded in pre-generation hidden states and can be linearly decoded across six models, even when generation fails to express that knowledge. This hidden signal motivates steering model outputs to improve tool-call decisions.
- Setup: A logistic-regression probe predicts binary tool necessity from concatenated hidden states collected in a single forward pass.Labels mark successful tool-free answers as tool-unnecessary and failures as tool-necessary; features use the last-token hidden state across all layers.
- The signal exists even when generation fails: AUROC above 0.9 on Llama models shows that tool-necessity information remains encoded even when generation fails to express it.Reason-then-Act reduces tool calling on Llama-3.1-8B and Llama-3.3-70B, yet the probe still detects the signal.
- Tool necessity is linearly decodable: AUROC 0.89–0.96 across six models shows that tool necessity is linearly decodable from pre-generation hidden states across model families and sizes.All probes achieve high AUROC, with larger models reaching 0.95+ and strong performance across difficulty levels; medium tasks are most challenging.
- Implications: The decoded hidden-state signal motivates injecting a short steering sentence to translate implicit tool-necessity knowledge into improved tool-call decisions.The following section uses this signal to directly steer model tool-call behavior.
5 PROBE&PREFILL: Turning Hidden Knowledge into Better Decisions
PROBE&PREFILL converts a linearly decodable hidden-state signal into tool-use decisions by predicting necessity and prefilling a steering sentence, without fine-tuning or reasoning overhead. It improves the accuracy–tool-call tradeoff over Prompt-only and Reason-then-Act by adaptively skipping easy calls while preserving difficult ones.
- Method: The method prepends a prediction-dependent steering sentence, after which the model can either answer directly or call a tool.Soft prefill allows the model to override the suggestion, whereas hard prefill forces direct-answer or tool-call output formats; hard prefill restores full tradeoff control on Llama models.
- Method: At inference time, a linear probe maps all-layer last-token hidden states to a probability p, and threshold τ controls whether the model skips or makes a tool call.Lower τ skips more calls but risks missing necessary ones; higher τ preserves more calls and accuracy, providing a single efficiency–accuracy control knob.
- Results: PROBE&PREFILL achieves a better accuracy–tool-call tradeoff than Prompt-only and Reason-then-Act across evaluated models, without additional reasoning tokens.It is strictly better than Prompt-only on Qwen models and outperforms Reason-then-Act in most cases; on Llama models, reasoning can nearly eliminate tool calls while causing large accuracy losses.
- Results: PROBE&PREFILL adaptively skips easy tool calls while preserving hard ones, achieving the lowest accuracy cost per saved call across difficult tasks.Table 4 reports accuracy cost per saved call averaged across six models with τ=0.5, while baselines incur strongly negative costs.
- Additional experiments: Additional experiments test robustness across multi-hop tasks, held-out environments, and probe and inference design choices.On three multi-hop environments, the method reduces tool calls by up to 75% on Qwen models while maintaining or improving accuracy; the probe also generalizes within categories to held-out environments.
6 Related Work
Prior work benchmarks tool use, reduces unnecessary calls through training and optimization, and probes or steers hidden representations to control LLM behavior. When2Tool is positioned within these three research directions.
- Agentic Tool-use benchmarks: Tool-use benchmarks evaluate external-data question answering, API selection, tool invocation, API-call generation, and function calling across diverse settings.Examples include ToolQA [Zhuang et al., 2023], API-Bank [Li et al., 2023b], Toolformer [Schick et al., 2023], ToolLLM [Qin et al., 2023], Gorilla [Patil et al., 2024], and BFCL.
- Efficient tool calling: Recent efficiency methods reduce unnecessary calls by fine-tuning confidence-based invocation or jointly optimizing agent instructions and tool descriptions via verbalized feedback.Xu et al. [2025] report approximately 50% fewer calls, while Wu et al. [2025] report reductions of up to 70%; Yang et al. [2026] survey efficiency across memory, tool learning, and planning.
- Probing and controlling LLM behavior: Linear probing shows that hidden states encode linguistic, factual, truthfulness, and self-knowledge properties, motivating activation-based methods for steering model behavior.Relevant approaches include activation addition and representation engineering [Zou et al., 2023].
7 Conclusion · H Additional baseline: Compare PROBE&PREFILL with Supervised Fine-Tuning (SFT) 34
The work shows that LLM agents encode reliable tool-necessity signals in hidden states but often fail to use them during generation. A linear probe with response prefilling improves the accuracy–efficiency tradeoff over Prompt-only and Reason-then-Act while remaining lightweight and training-free.
- 7 Conclusion: Probe-based response prefilling extracts hidden-state signals about tool necessity and achieves a strictly better accuracy–efficiency tradeoff than Prompt-only and Reason-then-Act.The benchmark, probing analysis, and method together support lightweight, training-free intervention.
A Benchmark environment details … A.7 Difficulty validation
WHEN2TOOL is a lightweight, deterministic, offline benchmark spanning 15 single-hop and 3 multi-hop environments across computational scale, knowledge boundaries, and execution tracking. Its easy, medium, and hard levels produce a validated tool-necessity boundary, with no-tool accuracy falling from 69.4% to 54.4% to 15.5%.
- A Benchmark environment details; A.1 Design principles; A.3 Category A: Computational scale; A.4 Category B: Knowledge boundary; A.5 Category C: Execution tracking: Across 15 single-hop environments, task generators specify real-world motivation, available tools, answer formats, and controlled difficulty levels spanning computational scale, knowledge boundaries, and execution reliability.The environment suite is designed to be easily extensible by adding generators with fixed random seeds.
- A.1 Design principles; A.2 Evaluation framework: The benchmark is zero-cost, fully offline, deterministic, locally extensible, and uses short tasks with exact-form answers verified without LLM judging.Tasks use fixed random seeds, and experiments are run three times with different random seeds while reporting mean and standard deviation.
- A.2 Evaluation framework: The evaluation reports exact-answer accuracy and total tool calls by model, difficulty, and environment to measure the trade-off between correctness and adaptive tool usage.Accuracy supports numeric tolerance, case-insensitive string matching, and equivalent representations, while tool-call counts reveal indiscriminate versus targeted reductions.
- A.3 Category A: Computational scale; A.3.1 CalculatorEnv; A.3.2 StatisticsEnv; A.3.3 CountingEnv; A.3.4 MatrixEnv; A.3.5 PrimeEnv: Computational-scale environments vary operand magnitude, dataset size, combinatorial growth, matrix dimension, and integer size to distinguish mentally feasible calculations from tool-requiring ones.Calculator, statistics, counting, matrix, and prime tasks progress from small or simple instances to large arithmetic, correlations, determinants, combinations, and factorizations.
- A.4 Category B: Knowledge boundary; A.4.1 RetrieverEnv; A.4.2 HistoricalYearEnv; A.4.3 GameRuleEnv; A.4.4 HashEnv; A.4.5 DecodingEnv: Knowledge-boundary environments test whether models know facts, dates, game rules, hashes, or encodings, progressing from familiar items to obscure or synthetic cases unavailable from pretraining.RetrieverEnv uniquely requires search_corpus followed by read_doc, while other environments provide specialized lookup, hashing, or decoding tools.
- A.5 Category C: Execution tracking; A.5.1 ListManipulationEnv; A.5.2 DateTimeEnv; A.5.3 CodeExecutorEnv; A.5.4 ScheduleEnv; A.5.5 RegexMatchEnv: Execution-tracking environments test reliable sequential processing through list transformations, date arithmetic, code execution, schedule reasoning, and regex matching as task complexity increases.Hard instances involve 2D list axes, leap years, recursion or dynamic programming, many overlapping meetings, or complex regex backtracking.
- A.6 Multi-hop environments; A.6.1 ChainedCalculatorEnv (Category A); A.6.2 ChainedRetrieverEnv (Category B); A.6.3 ChainedCodeExecutorEnv (Category C): The three multi-hop environments chain three dependent operations, requiring a separate tool-necessity decision at each hop while preserving the corresponding single-hop difficulty progression.ChainedCalculatorEnv, ChainedRetrieverEnv, and ChainedCodeExecutorEnv instantiate x → y → z dependencies for arithmetic, knowledge retrieval, and code execution.
- A.7 Difficulty validation: 69.4%, 54.4%, and 15.5% are the average no-tool accuracies for easy, medium, and hard tasks across all 18 environments, validating the intended difficulty boundary.Table 6 covers 1,080 training and 2,700 test tasks across six models.
B Detailed single-hop results
This section reports complete per-model results for 15 single-hop environments, including accuracy and tool calls across six models, prompting modes, reasoning settings, and probe thresholds. It also details how probe thresholds trade off accuracy and tool-call reduction.
- Accuracy cost per saved call: Table 7 breaks down accuracy cost per saved call by model for Sparse, Sparse + Reason-then-Act, and Probe&Prefill at τ=0.5, relative to Default Prompt-only.More negative values indicate that each saved call is more costly, and bold entries mark the best per model in each column.
- Full single-hop results: Table 8 reports accuracy and total tool calls for six models across the 2,250-task single-hop test set and all evaluated prompt, reasoning, and probe settings.The reported models are Qwen3-1.7B, Qwen3-4B, Qwen3-14B, Qwen3-32B, Llama-8B, and Llama-70B.
- Full single-hop results: At τ=.5, probe results include 88.3±.2% accuracy and 2,128±18 tool calls for Qwen3-1.7B, versus 92.4±.2% and 1,227±5 for Qwen3-14B.These values are reported in the per-threshold results across the six evaluated models.
- Full single-hop results: Increasing the probe threshold from τ=.1 to τ=.9 reduces Qwen3-1.7B tool calls from 2,512±16 to 293±15 while accuracy falls from 88.8±.2% to 47.9±.5%.The same threshold sweep reports model-specific accuracy and tool-call tradeoffs for all six models.
C Multi-hop evaluation … E.3 Layer selection
Across chained tasks, PROBE&PREFILL improves the accuracy–tool-efficiency tradeoff over baselines, while probe signals generalize across environments and remain effective under prefill, temperature, and layer-selection ablations.
- C Multi-hop evaluation: The multi-hop evaluation covers three environments requiring three dependent tool calls, using 180 training tasks and 450 test tasks.Probe quality remains high, with AUROC 0.84–0.97 across models; Qwen3-4B reaches 0.966, while Llama-3.3-70B reaches 0.804.
- C Multi-hop evaluation: On Qwen3-4B, the probe reaches 85.3% accuracy with 75% fewer tool calls, versus 83.9% accuracy and 63% fewer calls for the best baseline.On Qwen3-32B, it reduces calls by 55%, compared with 20% for the best baseline.
- C Multi-hop evaluation: Reason-then-Act helps Qwen3-1.7B multi-hop planning, reaching 60.6% accuracy versus 41.3% for Sparse Prompt-only, but collapses to near-zero calls on Llama models.The full comparison reports mean±std over 3 runs across 450 test tasks.
- D Out-of-distribution generalization: OOD probes trained on three of five within-category environments achieve comparable accuracy–efficiency tradeoffs to in-distribution probes across all models.This supports generalization beyond the training environments rather than reliance on environment-specific shortcuts.
- E.1 Soft vs. hard prefill: Soft prefill generally yields higher Qwen accuracy than hard prefill at matched tool-call levels, whereas hard prefill is better for Llama-3.1-8B at low thresholds, 79.9% versus 69.2%.Soft prefill allows the model to override the steering sentence, while hard prefill forces the output format.
- E.2 Temperature scaling: Temperature scaling changes probe controllability: T=1.0 provides a wider operating range, T=3.0 offers finer middle-range control, and T=2.0 balances performance across models.The temperature choice does not qualitatively change PROBE&PREFILL’s advantage over prompt baselines.
- E.3 Layer selection: All-layer concatenation performs best, while single-layer probes remain competitive and middle-layer probes slightly outperform last-layer probes on most models.These results indicate that tool-necessity information is distributed across the network, emerging early and persisting through later layers.
E.4 Data efficiency · E.5 Regularization strength · F Inference overhead
Probe&Prefill remains effective with minimal supervision, is robust to regularization choices, and adds negligible inference latency. Across these evaluations, the probe signal is easy to extract and operationally inexpensive.
- E.4 Data efficiency: 90 labeled examples (10%) yield probe AUROC above 0.81 on all tested models, while gains diminish beyond 50% training data.The probe was retrained using 10%, 25%, 50%, 75%, and 100% of the 900-example training set.
- E.4 Data efficiency: Probe AUROC improves steadily as training data increases, but the marginal improvement diminishes after the 50% fraction.This pattern indicates that the necessity signal can be extracted with minimal supervision.
- E.5 Regularization strength: Probe performance remains stable across λ=10 to 10000, with declines only at λ=1 and λ=100000.The default λ=10000 is near-optimal across all models.
- F Inference overhead: The probe adds only hidden-state extraction and a linear-probe computation beyond the standard generation pipeline.The linear probe consists of standardization, a dot product, and a sigmoid.
- F Inference overhead: The prefill forward pass incurs no additional cost because it already builds the KV cache before autoregressive generation.Probe&Prefill reads the hidden state from this existing forward pass rather than running another forward pass.
- F Inference overhead: Under 0.7 ms of additional latency across all six models makes Probe&Prefill less than 1% overhead at inference.This is compared with 10–100 ms for a typical prefill forward pass and 5–50 ms per generated token.
G Generalization to agentic search (Search-o1 benchmarks)
PROBE&PREFILL generalizes to six Search-o1 open-domain QA benchmarks spanning single-hop, two-hop, and complex multi-hop reasoning. On four of six datasets, it matches or exceeds baseline accuracy while reducing search calls more, and its transferred probe achieves AUROC 0.67–0.80.
- Evaluation scope: The evaluation covers NQ, TriviaQA, HotpotQA, 2WikiMultihopQA, Bamboogle, and MuSiQue, spanning single-hop factual QA, two-hop reasoning, and complex multi-hop reasoning.All evaluations use Qwen3-4B-Instruct.
- Setup: The setup uses five Prompt-only modes, five Reason-then-Act modes, and PROBE&PREFILL with a threshold sweep, training probes on 50/50 dataset splits.The probes train in seconds on CPU.
- Results: On 4 of 6 datasets, PROBE&PREFILL achieves comparable or better accuracy while reducing search calls more than the best Prompt-only or Reason-then-Act baseline.Table 18 compares each dataset’s best baseline with the best PROBE&PREFILL operating point; on TriviaQA, accuracy is 69.2% versus 68.8%, with 20% versus 16% fewer searches.
- Probe quality: A WHEN2TOOL-trained probe transfers to Search-o1 QA with AUROC 0.67–0.80 without retraining, indicating partial transfer of the tool-necessity signal.The comparison also includes in-domain probes trained on 250 examples per dataset, with training completed in seconds.
H Additional baseline: Compare PROBE&PREFILL with Supervised Fine-Tuning (SFT)
Compared with full-parameter SFT, PROBE&PREFILL achieves larger tool-call reductions without modifying weights, while SFT improves accuracy but does not reliably learn the tool-call decision boundary. PROBE&PREFILL also requires seconds of CPU training and supports a smooth accuracy–efficiency tradeoff via threshold τ.
- Comparison: SFT requires full fine-tuning on multiple GPUs for hours, while PROBE&PREFILL trains a linear probe in seconds on CPU without modifying model weights.The comparison is therefore inherently asymmetric in computational cost and intervention level.
- Training setup: SFT uses 900 single-hop training tasks with binary tool-necessity labels and trains full model parameters for two epochs at learning rate 10−5 across four GPUs.Experiments evaluate Qwen3-1.7B, Qwen3-4B-Instruct, and Llama-3.1-8B while masking nonassistant tokens.
- Results: 21–38% tool-call reductions are achieved by PROBE&PREFILL at τ=0.5, whereas SFT reduces calls only on Qwen3-1.7B (−18%) and increases them on Qwen3-4B and Llama-3.1-8B.SFT improves accuracy by 2–3% across all three models, while PROBE&PREFILL produces larger tool-call reductions without weight modification.
- Discussion: Across model sizes from 1.7B to 70B, PROBE&PREFILL works consistently and offers a smooth accuracy–efficiency tradeoff controlled by threshold τ.The results characterize it as an effective, nearly zero-cost alternative to substantially more expensive SFT.