What Affects the Stability of Tool Learning? An Empirical Study on the Robustness of Tool Learning Frameworks

Chengrui Huang1∗, Zhengliang Shi2, Yuntao Wen1,
Xiuying Chen3, Peng Han1, Shen Gao122footnotemark: 2, Shuo Shang1
1 University of Electronic Science and Technology of China,
2 Shandong University, 3 Mohamed bin Zayed University of Artificial Intelligence
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected], [email protected]
The first two authors contributed equally and the order is alphabetical
Abstract

Tool learning methods have enhanced the ability of large language models (LLMs) to interact with real-world applications. Many existing works fine-tune LLMs or design prompts to enable LLMs to select appropriate tools and correctly invoke them to meet user requirements. However, it is observed in previous works that the performance of tool learning varies from tasks, datasets, training settings, and algorithms. Without understanding the impact of these factors, it can lead to inconsistent results, inefficient model deployment, and suboptimal tool utilization, ultimately hindering the practical integration and scalability of LLMs in real-world scenarios. Therefore, in this paper, we explore the impact of both internal and external factors on the performance of tool learning frameworks. Through extensive experiments on two benchmark datasets, we find several insightful conclusions for future work, including the observation that LLMs can benefit significantly from increased trial and exploration. We believe our empirical study provides a new perspective for future tool learning research.

What Affects the Stability of Tool Learning? An Empirical Study on the Robustness of Tool Learning Frameworks


Chengrui Huang1∗, Zhengliang Shi2thanks: The first two authors contributed equally and the order is alphabetical, Yuntao Wen1, Xiuying Chen3, Peng Han1, Shen Gao122footnotemark: 2, Shuo Shang1 1 University of Electronic Science and Technology of China, 2 Shandong University, 3 Mohamed bin Zayed University of Artificial Intelligence [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]


1 Introduction

Tool learning aims to augment LLMs with external tools, teaching them how to select appropriate tools, generate correct parameters and ultimately parse execution results to produce correct responses (toolw; api-bank; toolformer). By learning to use various tools, LLMs can better assist users in completing practical tasks, such as planning itineraries xie2024travelplanner, controlling physical robots wang2023voyager and accessing the Web webcpm. This capability is crucial for enhancing the interaction between LLMs and real-world applications, empowering them as agents to provide more comprehensive and useful assistance chameleon; liu2023agentbench; tian2024opportunities.

Refer to caption
Figure 1: Illustration of various factors that may affect the robustness of tool learning methods.

In the tool learning tasks, most of previous work focuses on improving the performance of LLMs in successfully solving complex tasks, including designing chain-of-thought framework chameleon, employing multi-agent algorithms shi2024learning; qiao2024autoact or tuning models on specific tool-use datasets toolalpaca, Numerous empirical studies are also conducted to evaluate the tool-use capability of LLMs, such as when to use, how to use, and which tool to use xu2023tool; huang2023metatool. Despite their progress, we find that stability, a crucial dimension to reflect the performance variation of LLMs under volatile scenarios li2023robust; gu2022robustness, is less investigated. In real-world applications, various factors can affect the performance of tool learning models, and sometimes even produce different responses to identical user queries, a.k.a., instability. For example,  ye2024rotbench show that even simple perturbations can cause models to select entirely incorrect tools or generate incorrect tool-calling parameters. These seemingly unrelated perturbations can lead to the failure of the task. Therefore, comprehensively exploring the factors related to the stability issue and quantitatively analyzing their impact becomes necessary for practical scenarios.

In this work, we provide the first empirical study on systematically analyzing the stability of tool-use models. To achieve this, we first categorize the diverse factors into two categories: internal and external factors.

The internal factors indicate uncertainties during the development of tool-use models from the developers’ perspective. As shown in Figure 1, we consider the decoding temperature, the maximum inference steps, and the selection of different foundation LLMs. Given the numerous works that guide LLMs to automatically use external tools react; yang2023mm; toolllm, we also analyze the impact of different tool-use frameworks on the model’s performance. Exploring these internal factors will help enhance the performance of the framework during development. Different from the internal factors, external factors primarily involve diverse prompt engineering when interacting with established tool-use models, which are beyond the control of developers once the models are deployed. Specifically, these factors includes different styles of user queries, customized system prompts for tool-use models, and the candidate toolset used to solve a query. For a holistic investigation, we change the candidate toolset by reordering it or expanding its scale, respectively. Investigating these external factors will help developers understand the stability in user-facing scenarios, thereby improving the overall user experience.

To quantitatively validate the impact of the aforementioned internal and external factors on the tool learning process, we conduct extensive experiments on the most commonly used ToolBench toolllm dataset. We employ several commonly used metrics to measure the performance from multiple perspectives and derive a series of interesting findings. We highlight the following:

  • Existing tool-use workflow exhibits obvious instability towards various internal and external factors. Even the state-of-the-art methods still exhibit instability with inessential perturbations.

  • Among the internal factors, the proper hyper-parameter settings may boost the LLMs to generate diverse solutions. However, it also leads to instability.

  • Among the external factors, the LLMs are sensitive to the change of candidate toolset (i.e., order or scale) and the system prompts.

  • The advanced tool selection algorithms (i.e., tree-based search) can improve the accuracy, but they may suffer from accumulated hallucination with less stability, as well as substantial inference costs.

2 Related work

Tool learning with LLMs.

Tool learning aims to augment LLMs with real-world tools, extending their utility and empowering them as agents to automatically solve practical tasks toolw; toolalpaca; shi2023towards; gao2024confucius. Pioneering work like Toolformer (toolformer) and ToolkenGPT toolkengpt teaches LLMs to utilize tools by training on specific tool-use datasets patil2023gorilla; wang2024executable. Recent work leverages the inherent in-context learning capability of LLMs to master various tools, where the demonstration and usage are taken as the prompt (yang2023mm; shi2024chain; guo2024large). Despite the progress of recent tool-use models in successfully solving complex tasks, their stability is less investigated. In this work, we provide a comprehensive empirical study on the stability of them across diverse scenarios.

Evaluation of tool-use LLMs.

In tool learning tasks, previous work primarily evaluates the success rate of LLMs in completing tasks, such as Success Rate gpt4tools; restgpt and Win Rate toolllm. Recently, the ToolSword ye2024toolsword has also proposed to unveil safely-related issues of LLMs during the tool learning process. However, stability, a crucial dimension related to practical applications wang2023robustness, has been less investigated. Although some work, like RotBench ye2024rotbench, proposes evaluating the robustness of tool-use LLMs, they only consider the different types of noise injected into original candidate toolsets. To the best of our knowledge, a thorough stability evaluation of tool-use LLMs remains under-explored. In our work, we fill this gap by providing a systematic evaluation of the stability of tool-use LLMs, and quantitatively analyzing their drawbacks under different settings.

3 Experimental Settings

3.1 Dataset

We conduct experiments on the subset of widely-used ToolBench toolllm benchmark, including I1-instruction and I1-tools. Each dataset contains 200 tasks involving various real-world applications, which evaluates tool-use models under practical scenarios. The detailed statistics can be found in Table 1.

The original ToolBench only provides a task-solving trajectory of GPT-3.5 as an evaluation reference, which includes both ground truth and irrelevant tools. However, commonly used evaluation metrics (§ 3.2) require computing the overlap between model-selected tools and the ground truth. Therefore, we repurpose ToolBench to support our evaluation. For each task, we extract the tools used in the original solution. Next, we invite three well-educated experts with relevant research backgrounds to manually select the correct tools for solving the task. Several strategies are employed to ensure the quality of this process, which can be found in Appendix LABEL:sec:app:repurpose.

# Dataset # Amount # Category # APIs # Avg. APIs
I1-inst. 200 36 995 5.34
I1-tool 200 33 548 4.79
Table 1: Statistics of the experimental datasets such as the count of task and tool category. The Avg. APIs indicates the average of the candidate toolset per task.
Refer to caption
Figure 2: The default tool-use framework in our work. The LLM is guided to iteratively decide which tool to use (Thought), execute the selected tool (Action), and incorporate the execution results into context (Observation) for the next iteration prediction.

3.2 Evaluation Metrics

Following previous work ye2024rotbench; restgpt, we use the Success Rate and T-test as evaluation metrics. We also consider the Give Up Rate, Invalid Selection Rate as metrics for a comprehensive evaluation.

Success Rate (Success%).

This metric intuitively evaluates the capability of tool-use LLMs in correctly selecting tools and generating corresponding arguments for execution. It calculates the proportion of tasks that the model can complete successfully within limited inference steps. The success rate is 1 if and only if all the required tools are used to solve a task.

T-test.

To analyze the stability of tool-use LLM towards diverse factors, we use a two-tailed paired t-test student1908probable following previous work ye2024rotbench. This metric calculates the statistical significance of the model’s performance difference between vanilla and changed experimental conditions. The significance level α𝛼\alphaitalic_α is set to 0.050.050.050.05. Results are marked with if they are statistically significance are observed; otherwise, they are marked with .

Invalid Selection Rate (Invalid%).

We use the Invalid Selection Rate to compute the percentage of instances where the LLM selecting non-existent tool, i.e., generating incorrect tool names. It reflects the ability of the model in tool selection, a crucial phase in the overall tool-use workflow, especially when the candidate toolset is large-scale.

Give Up Rate (Give up%).

This metric computes the percentage of tasks that LLMs give up answering after trial and error. In practical scenarios, the model may fail to provide a correct solution for a complex task due to their limited ability. Therefore, it is crucial to build a confident model that is aware of its limitations, referred to as its capability boundary ren2023investigating; yin2024benchmarking, allowing it to adaptively and faithfully inform users of incomplete tasks rather than giving incorrect answers.

Refer to caption
Figure 3: The overall framework of our work, which benchmarks tool-use models under various scenarios to investigate the internal and external factors that potentially affect their stability.

3.3 Tool Learning Framework

For a fair evaluation, we employ the widely adopted ReAct (react) method as a unified framework to enable LLMs to interact with tools across different experimental setups. In the ReAct framework, the LLM is guided to iteratively perform Thought, Action, and Observation steps. As shown in Figure 3, the Thought is to generate tool-use planning in the nature language while the Action is to select an appropriate tool and formulate corresponding parameters. The Observation step is to incorporate the execution results of tools in the current context. To explore the stability of LLMs in different tool-use frameworks, we compare the ReAct method with another framework, i.e., ToolLLM toolllm, which augments LLMs with a Depth First Search-based Decision Tree (DFSDT) to select relevant tools for solving tasks (§ LABEL:sec:frame).

3.4 Implementation Details

For the closed-source models, e.g., GPT-3.5, we mainly enable them to utilize tools through OpenAI’s function-call format111https://platform.openai/function-call. For the open-source models, we use the prompt from toolllm. We also analyze the impact of different tool-use prompts in § LABEL:sec:system. All the prompts in our work can be found in Appendix LABEL:sec:app:instruction.

4 Analysis of Internal Factors

We first investigate the influence of internal factors, which indicate the uncertainties in develo** a tool-use models, such as the selection of foundation LLMs and decoding temperature.

Model Success%\uparrow Give up% Invalid%\downarrow gpt-3.5-turbo-16k 54.00% 29.50% 1.48% gpt-3.5-turbo-0125 55.50% 36.50% 1.45% gpt-3.5-turbo-1106 48.00% 50.50% 0.88% gpt-4o 58.00% 38.00% 0.54% deepseek-chat 40.50% 34.00% 0.56% llama-3-70b 8.00% 4.50% 42.16% llama-3-8b 3.50% 2.00% 28.56% mixtral-8x7b-inst. 12.00% 14.00% 41.66% mixtral-8x22b 25.00% 19.00% 10.76%

Table 2: The results with different foundation models on I1-instruction dataset of ToolBench toolllm.