NesTools: A Dataset for Evaluating Nested Tool Learning Abilities of Large Language Models

Han Han, Tong Zhu, Xiang Zhang, MengSong Wu, Xiong Hao, Wenliang Chen

TL;DR

This paper introduces NESTOOLS, a novel dataset and benchmark designed to evaluate the complex nested tool-learning capabilities of Large Language Models (LLMs). The research highlights that while LLMs are improving, they still struggle with deeply nested tool calls, indicating a significant gap in current LLM performance for real-world applications requiring multi-step reasoning.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown remarkable progress in understanding and reasoning, leading to their integration into real-world systems through "tool learning." This involves LLMs calling external APIs to perform tasks. A crucial aspect of tool learning is the ability to handle nested tool calls, where the output of one tool serves as the input for another. This creates complex execution chains. However, existing benchmarks for evaluating LLM tool learning are insufficient for assessing these nested capabilities. They either ignore nested calls, contain only a small number of them, or suffer from low quality and repetitive patterns. This lack of comprehensive evaluation hinders the development of LLMs that can effectively handle intricate, multi-step tasks.

Methods

The authors developed NESTOOLS using an automatic data generation pipeline. This pipeline involves:

  1. Tool & Instance Generation: Leveraging GPT-3.5 and GPT-4, they generated realistic Python functions (tools) and corresponding function call chains. They employed a specific template for nested calls to improve clarity and accommodate complex nesting. The process drew from a large corpus of domains to ensure diversity.
  2. Query Generation: Raw queries were initially generated and then refined by LLMs to incorporate necessary parameters and align with the tool call logic, making them more representative of real-world user requests.
  3. Data Review & Refinement: A rigorous multi-stage review process, including automated checks (format, AST) and manual annotation by human experts, was implemented to ensure high data quality and consistency.

Datasets

  • NESTOOLS: The primary contribution is the NESTOOLS dataset itself. It comprises a large-scale, high-quality collection of nested tool-calling instances across various domains. The dataset is designed to specifically evaluate the nested tool-learning abilities of LLMs.
  • Seal-Tools: Used as a reference for domain diversity during the generation of NESTOOLS.

NESTOOLS differentiates itself from existing benchmarks like T-Eval, API-Bank, ToolBench, and UltraTool by focusing specifically on nested tool calls and offering a more comprehensive evaluation framework.

Key Insights and Ideas

  • Nested Tool Learning is Challenging: The experiments reveal that even advanced LLMs struggle with nested tool calls, with performance degrading as nesting depth increases. This highlights a critical area for improvement.
  • Model Size Matters, But Not Exclusively: While larger models generally perform better, the LLaMA3.1 series showed surprising strength in selection and order metrics, even for smaller versions, suggesting architectural or training advantages in specific aspects.
  • Parameter Filling is a Weakness: LLMs, particularly the LLaMA3.1 series, exhibit a notable disadvantage in parameter filling, often generating incorrect JSON output types, even when the core information is correct. This points to potential issues with JSON format alignment in their training.
  • Query Structure Impacts Performance: The robustness analysis suggests that conjunctions in queries, while seemingly minor, can significantly aid LLMs in understanding the order of tool calls. Removing them can degrade performance, especially for the "Order" metric.
  • Error Analysis Reveals Specific Weaknesses: The error analysis identified common issues like tool selection confusion, tool omission, redundant tool calls, hallucinations, and generation format errors. For parameter errors, LLaMA3.1-8B often mispredicts parameter types, while Qwen2-7B struggles more with identifying nested parameters as non-nested.

Key Results

  • LLaMA3.1-405B Outperforms GPT-40: In the main results, LLaMA3.1-405B achieved the best overall performance on NESTOOLS, slightly surpassing GPT-40, indicating that open-weight models are becoming highly competitive.
  • Performance Degradation with Nesting Depth: As nesting depth increases, LLM performance generally decreases, illustrating the difficulty of the task.
  • Format Accuracy and Tree Pass Rate: Proprietary models like GPT-40 and Claude-3.5 showed high format accuracy (100%), with Claude-3.5 achieving the best Tree pass rate (26.8%). Among open-weight models, Qwen2-72B achieved the highest format accuracy (98.6%) and the best Tree pass rate (20.4%).
  • Robustness: Masking parameter types had a minor impact, but removing query conjunctions significantly affected performance, especially the order metric.

Limitations and Future Work

  • Simulated Tools: The tools used in NESTOOLS are simulated representations and not executable. While they accurately describe tool functions, they don't fully replicate real-world execution environments. The authors plan to design real execution interfaces for future work.
  • Missing Preceding Tools: The current dataset focuses on complex nested calls but doesn't extensively cover scenarios where LLMs need to infer or generate missing preceding tools.
  • Further Exploration: The authors suggest future work could explore more complex scenarios, design real execution interfaces, and further investigate the robustness of LLMs in tool calling.

Summary updated

BibTeX
@inproceedings{han2025nestools,
  author = {Han Han and Tong Zhu and Xiang Zhang and MengSong Wu and Xiong Hao and Wenliang Chen},
  title = {{NesTools: A Dataset for Evaluating Nested Tool Learning Abilities of Large Language Models}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2025},
}
Figure