arXiv(opens in a new tab)cs.AISep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.00967

CoBRA: Learning Tool-Use Boundaries via Counterfactual Margins

Wenhao Zou, Xianglong Liu, Wendong Bi, Hanjie Wang, Simin Zhao, Gong Zhi

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

Abstract

As large language models increasingly act through external tools, deciding when to call a tool has become a central problem alongside deciding how to use it. Unnecessary tool calls introduce latency, cost, retrieval noise, and error propagation, while missed calls hurt knowledge-intensive queries or questions requiring up-to-date evidence. Existing methods typically trigger tools from absolute query or generation signals, such as difficulty, confidence, or final task reward, and therefore lack an explicit estimate of the instance-level marginal benefit of tool use. We propose CoBRA, a counterfactual boundary-learning framework for tool-augmented language models. CoBRA first constructs internal and external experts from the same base model, collects paired trajectories, and estimates the reward margin between answering with and without tools. This margin partitions data into internal-favored, external-favored, and ambiguous cases. CoBRA then uses clear-margin samples for Boundary-Aware Cold-Start SFT, followed by MARS-RL with reference-split rollouts and counterfactual marginal advantages to optimize boundary decisions. Experiments with retrieval as the main tool on Qwen3-4B show that CoBRA improves tool-use efficiency and boundary-sensitive answer accuracy while maintaining strong performance on tool-dependent out-of-distribution questions.

1 Introduction

Large language models (LLMs) are increasingly used as agents that can call external tools such as search engines, retrievers, calculators, and APIs. Tool use extends parametric knowledge with fresh or specialized evidence. Early reasoning-and-acting and API-use training frameworks demon-

Figure

Figure 1: Sample proportions of counterfactual margin categories from dual-expert paired rollouts on three in-domain benchmarks. TriviaQA and 2WikiMultiHop exhibit opposite polarities: the former is more external-favored, while the latter is more internal-favored.

strate that models can interleave language generation with external actions (Yao et al., 2022; Schick et al., 2023). Large-scale tool benchmarks and API-oriented agents further broaden this setting to tool selection, argument generation, and orchestration over large tool collections (Qin et al., 2024; Patil et al., 2024; Huang et al., 2024; Du et al., 2024; Zhang et al., 2025a; Zou et al., 2025; Su et al., 2025). Recent agent benchmarks also show that external interaction is becoming central to realistic web, software, and tool-user environments (Liu et al., 2024a; Zhou et al., 2024; Yao et al., 2024; Xie et al., 2024; Jimenez et al., 2024). These efforts clarify how tools can be invoked and used; however, tool access also introduces a complementary routing problem: for each query, the agent must decide when external interaction is worth its cost.

This decision is not merely a binary capability question. Unnecessary calls increase latency, token/API cost, and vulnerability to retrieval noise; they may also cause error propagation when irrelevant evidence overrides correct internal knowledge. Conversely, under-calling tools hurts freshness and knowledge-intensive reasoning. Existing adaptive

∗^{*}Corresponding authors.

retrieval methods address this problem by conditioning retrieval on uncertainty or self-reflection signals (Jiang et al., 2023; Asai et al., 2024). Other approaches use predicted complexity, knowledge-boundary estimates, or real-time information needs to decide when retrieval should be activated (Jeong et al., 2024; Su et al., 2024; Wang et al., 2025b; Lin et al., 2025). Robust and corrective variants further incorporate retrieval quality, correction, or note-taking signals to mitigate noisy evidence (Yan et al., 2024; Yu et al., 2024a). These signals are useful but incomplete: a hard query is not necessarily one that benefits from tools, and a confident model can still be wrong on stale or long-tail facts.

Figure 1 makes this issue concrete. After branch-specific SFT, we run paired rollouts from two experts derived from the same base model: an internal expert that answers without tools and an external expert that uses retrieval. We score both trajectories with the same utility function and classify the query by the resulting margin: internal-favored, external-favored, or ambiguous. The three benchmarks show very different compositions. TriviaQA contains many more external-favored samples, while 2WikiMultiHop is strongly internal-favored; HotpotQA has the largest ambiguous region. This suggests that coarse benchmark identity alone cannot explain the instance-level benefit of tool use.

We argue that tool routing should be framed as an instance-level counterfactual decision: would calling the tool improve the expected utility of solving this query, compared with answering from internal knowledge alone? This view shifts the target from modeling query difficulty to modeling marginal tool benefit. It also exposes a boundary region where neither branch is clearly dominant. Such boundary cases are where standard supervised routers and outcome-only reinforcement learning can overfit spurious features or collapse toward a single strategy; Sections 4.3 and 4.4 evaluate this behavior empirically.

We propose CoBRA, a counterfactual boundary-learning framework for tool-augmented language models. CoBRA first constructs two experts from the same base model: an internal expert that answers without tools, and an external expert that must use the tool and integrate its result. Running both experts on the same query gives a paired counterfactual estimate of the marginal utility of tool use. We use this signal to partition data into internal-favored, external-favored, and ambiguous subsets, rather than treating all queries as equally informative for routing.

Based on this partition, CoBRA trains the agent in two stages. First, Boundary-Aware Cold-Start SFT uses only clear-margin examples to teach the model the basic routing prior while avoiding noisy supervision on ambiguous cases. Second, MARS-RL (Marginal Advantage from Reference-Split Rollouts) optimizes boundary behavior by forcing internal and external rollouts for the same query and injecting their reward difference as a symmetric marginal advantage. This design preserves within-branch exploration while directly rewarding the policy for choosing the branch with higher counterfactual utility.

Our contributions are:

  • We propose CoBRA, a counterfactual boundary-aware framework that routes tool use by instance-level marginal utility, improving answer quality while avoiding unnecessary tool calls.

  • We introduce Counterfactual Boundary Discovery, which uses paired internal/external expert trajectories to identify where tools help, hurt, or remain ambiguous, providing a direct signal for boundary-aware routing.

  • We develop Boundary-Aware Policy Optimization, combining clear-margin cold-start SFT with MARS-RL to optimize the internal-external boundary through reference-split rollouts and counterfactual marginal advantages.

  • We demonstrate significant gains on Qwen3-4B across in-domain, out-of-domain, and boundary-focused benchmarks, and further validate CoBRA on real industrial-scale music-domain data, where it improves quality while reducing tool use.

References (54)