Pick the Right Tools for the Right Job: Researchers designed HYSET, a technique to call collections of tools that work together

When an LLM agent can choose among thousands of tools, picking the right ones for a given task is difficult.

Share
Diagram shows HYSET system: query embedding, tool-set interaction, scoring, and reward modules.

When an LLM agent can choose among thousands of tools, picking the right ones for a given task is difficult. Researchers built a system to find the best combination of tools for any job.

What’s new: Xinyi Hong at Shanghai Jiao Tong University and colleagues at Hong Kong Polytechnic University proposed HYSET, a method that constructs candidate tool sets, scores them, and chooses the best set for a given task. Previous approaches treated each tool as an independent item, rather than a set of tools suited to work well together.

Key insight: Imagine a model that receives the query, “I am flying from Chicago to Tokyo for five days next month. Find round-trip flights, book a hotel near Shinjuku, check the weather for those dates, and convert my 2,000 USD budget into yen.” How should it select the tools it needs? If it were to list the most relevant tools, the list may be topped by numerous flight APIs, while tools relevant to other parts of the task (say, a weather tool) are far down the list. The utility of a flight API, or any other tool, depends not only on its relevance to the task but also on what other tools are available.

How it works: HYSET is a small, trainable scoring model that takes as input an embedding of a query from a frozen encoder (Qwen2.5-1.5B) and outputs a list of tools for an agent. The authors trained HYSET on ToolBench, which contains roughly 14,000 tools and 200,000 instructions that describe tasks. HYSET learned, given a library of tools description of a task, to construct candidate tool sets and score each set.

  • The system scored tool sets as the sum of two terms. (i) The first term summed scores of pairwise compatibility between tools in the set. Each tool had a learned vector, and a pair’s compatibility score came from multiplying the first tool's vector by a learned matrix, then by the second tool’s vector. (ii) The second term measured how well the entire set related to the query. It estimated the relevance of each tool based on cross-attention and averaged the estimates.
  • During training, for each query, the authors constructed a candidate pool of tool sets that contained ToolBench’s ground-truth set alongside several incorrect sets. They drew the incorrect sets from three sources: random subsets of the tool library, correct sets for other queries in the same batch, and sets formed by swapping out one or two tools in the ground-truth set. Training adjusted the scoring model’s trainable parameters so the score ranked the correct set above the incorrect ones.
  • A second loss term encouraged the model to give higher scores to sets that led the agent to complete the task successfully.
  • At inference, given a query, the system retrieved a short list: the top 15 tools by query-tool match plus the five tools with the strongest pairwise compatibility to that group. It reranked all subsets of the short list using the learned scoring function and chose the top-ranked set.

Results: On ToolBench, HYSET achieved better performance than all baselines in both retrieving effective tools and completing tasks.

  • Considering the percentage of ground-truth tools in the top five retrieved tools, HYSET (88.6 percent Recall@5) outperformed the next-best method, ToolGen (81.4 percent Recall@5).
  • Using the tool set HYSET chose for a given task, the agent resolved 69.9 percent of tasks, according to human evaluators. Using the tool set selected by the strongest baseline, ToolLLaMA-Retriever, which scores each tool independently, the agent resolved 61.8 percent.

Why it matters: HYSET increased both (i) the completeness of retrieved tool sets, meaning the chosen set covered every tool required to complete a given task, and (ii) end-to-end task success, meaning the agent completed the task at hand with that set. It did so without modifying the underlying agent, offering a practical path for improving agents that have access to large tool libraries.

We’re thinking: If the authors had trained on the ground-truth tool sets directly, the resulting model may have ignored other sets that worked equally well. By factoring in task completion, the model learned to rank highly any set of tools that worked.

Read more