Manuscript Offprint

arXiv:2609.30906

ToolSearcher: Optimizing Tool Selection at Scale via Reinforcement Learning

Zhenlong Dai, Xujie Song, Zitong Wang, Tong Niu, Jian liu, Weiqiang Wang, Xiu Tang, Sai Wu, Chang Yao, Jingyuan Chen

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

Zhenlong Dai

Zhejiang University

zhenlongdai@zju.edu.cn

Zitong Wang

Ant Group

yesi.wzt@antgroup.com

Xujie Song

Zhejiang University

songxujie@zju.edu.cn

Tong Niu

Ant Group

niutong.niu@antgroup.com

Jian Liu ∗^{*}

Ant Group

rex.lj@antgroup.com

Weiqiang Wang

Ant Group

weiqiang.wwq@antgroup.com

Xiu Tang

Zhejiang University

tangxiu@zju.edu.cn

Sai Wu

Zhejiang University

wusai@zju.edu.cn

Chang Yao

Zhejiang University

changy@zju.edu.cn

Jingyuan Chen ∗^{*}

Zhejiang University

jingyuanchen@zju.edu.cn

Abstract

Large language models (LLMs) excel at natural language processing but struggle to interact with external environments. Tool learning provides a promising way to extend LLMs into actionable agents, where tool selection is a critical prerequisite for successful tool use. Existing work often assumes a small or predefined set of tools, leaving large-scale tool selection underexplored. Real-world repositories contain a vast and diverse array of tools, making it difficult for LLMs to effectively search, distinguish, and compose tools under context-length constraints. We identify large-scale tool selection as a new challenge for agentic reinforcement learning, highlighting that existing RL methods for knowledge-based question answering are inadequate for selecting tools while considering compatibility. To address this challenge, we propose ToolSearcher, a novel RL framework for effective multi-turn search and fine-grained optimization in large-scale tool selection. Specifically, we introduce category-constrained tool discrimination to improve the model's ability to distinguish functionally similar tools, event-level search modeling to explicitly optimize the discovery of target tools during multi-turn search, and trajectory-aligned credit allocation to provide fine-grained reward signals for different stages of the search-selection process. Extensive experiments on large-scale tool selection benchmarks demonstrate that ToolSearcher consistently outperforms a set of strong baselines in challenging settings involving iterative search and complex tool composition. The code and the dataset are available at https://github.com/zhenlongDai/ToolSearcher.

∗^{*}Co-corresponding authors.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

1 Introduction

Large language models (LLMs) have recently demonstrated remarkable capabilities in natural language processing (NLP) tasks [17]. Despite their impressive performance, pretrained LLMs often struggle to actively perceive and interact with external environments, as their abilities are intrinsically constrained by NL interaction. Given the essential role of tools in enabling LLMs to interact with external environments and to act as user agents for solving real-world tasks, tool learning has attracted increasing attention [44]. The typical process of tool learning comprises three key stages: tool selection, tool calling, and response generation [29]. Existing studies mainly focus on tool calling (e.g., specifying function parameters, tool execution), while overlooking a crucial yet underexplored issue of tool selection: how to effectively search and select appropriate candidate tools from a large-scale and diverse tool repository according to specific task requirements.

Recent studies [27, 43, 36] typically assume a predefined or small set of candidate tools, which creates a substantial gap between these settings and real-world scenarios. Statistics from mainstream software and model ecosystems (e.g., PyPI, npm, and HuggingFace) show that both the number and functional diversity of available tools are already massive [54, 10]. Due to context-length limitations, it is impractical to provide LLMs with documentation for all tools, making the search a necessary step for effectively using existing tool resources. Moreover, large-scale tool repositories further exacerbate both functional and semantic similarities among tools. On one hand, many tools have similar semantics but differ in functionality. On the other hand, some tools offer similar functionality but have different interface designs (i.e., input constraints and output information). Under this background, tool selection is inherently a complex process involving planning, search, and decision-making, requiring the coordination of multiple capabilities.

LLMs remain limited in autonomously organizing the capabilities required for tool selection. Current research [32, 41] utilizes search engines as part of the reasoning process, allowing LLMs to conduct multi-turn searches. Given the difficulty of collecting high-quality annotated trajectories and improving the model's adaptability to dynamic search environments [4, 2], they optimize via agentic reinforcement learning (RL) [13, 39]. However, these methods are designed for knowledge-intensive questions that rely on iterative information supplementation, making them unsuitable for tool selection tasks that require reasoning about tool composability. For tool selection, each search step needs to plan around a hypothesized tool chain and consider the composition of tools, then adjust the plan based on the search results. Based on the above analysis, applying RL to tool selection in large-scale scenarios mainly faces two key challenges: (1) How to effectively perform multi-turn search over a large-scale tool repository. Tool selection requires the model to search relevant tools, distinguish between functionally or semantically similar candidates, and reason about interface compatibility over multiple search steps. However, existing RL-based methods do not explicitly model the tool search process. (2) Tool selection involves multiple capabilities, making joint learning and reward design difficult. RL methods typically rely on trajectory-level rewards that assign the same value to a trajectory, leading to sparse supervision and making it difficult to optimize fine-grained behaviors throughout the multi-turn process.

To tackle the above challenges, we propose a novel RL approach named ToolSearcher, which is designed to enable effective multi-turn search and fine-grained optimization for large-scale tool selection. To differentiate between functionally similar tools, we propose category-constrained tool discrimination, which creates a highly constrained challenge environment designed to enhance LLMs' ability to understand and distinguish tool functionalities. To explicitly model the tool search process, we propose event-level search modeling, which optimizes semantic search by concentrating on events that discover previously unsearched target tools, thereby enhancing the LLM's ability to plan and search for compatible tool compositions. To facilitate the joint learning of multiple capabilities in tool selection, we design trajectory-aligned credit allocation, a fine-grained reward mechanism that assigns objective and quantifiable credit based on each sample's progression within the search-selection trajectory. Unlike outcome-only rewards, this method evaluates samples at different stages, providing matched feedback that accurately reflects their progress for tool selection.

Our contributions are summarized as follows:

• We identify large-scale tool selection as a novel challenge for agentic RL and demonstrate that existing RL methods designed for knowledge-oriented search are unsuited to multi-turn tool search and reasoning about tool composability.

• We propose ToolSearcher, a novel RL framework that explicitly models the multi-turn search process over large-scale tool repositories and provides fine-grained optimization signals for the diverse capabilities involved in tool selection.

• We conduct extensive experiments on large-scale tool selection benchmarks, where ToolSearcher consistently outperforms other baselines in challenging scenarios requiring iterative search and complex tool composition.

References (82)