TOOLVERIFIER: Generalization to New Tools via Self-Verification

Dheeraj Mekala, Jason Weston, Jack Lanchantin, Roberta Raileanu, Maria Lomeli, Jingbo Shang, Jane Dwivedi-Yu

Abstract

Large Language Models (LLMs) often struggle to generalize to unseen tools, particularly when tool descriptions are nuanced or parameters are ambiguous. This paper introduces TOOLVERIFIER, a framework that enhances tool-calling accuracy through a self-verification mechanism. By generating contrastive questions to distinguish between top candidate tools and parameters, the model significantly reduces selection errors. Evaluated on the ToolBench benchmark, TOOLVERIFIER achieves an average success rate of 89.52%, representing a 22% absolute improvement over standard two-step few-shot baselines.

Introduction

The ability of LLMs to interact with external APIs is a cornerstone of modern AI agents. However, current models frequently fail when encountering "unseen" tools—APIs not present in their training data. These failures often stem from subtle differences in tool descriptions (e.g., "Current Weather" vs. "Weather Forecast") or confusion between similar parameter values (e.g., latitude vs. longitude). The authors identify a specific gap: models often have the correct answer in their "top-2" predictions but lack the discriminative logic to pick the winner. Small errors in these initial steps tend to propagate, leading to total failure of the tool call.

Methods

TOOLVERIFIER addresses these challenges via a two-stage pipeline that decomposes the tool-calling process into selection and parameterization, each followed by a verification step.

  1. Tool Selection & Verification: The model identifies the top two candidate tools. It then generates a contrastive verification question (e.g., "Are you looking for current air quality or a future forecast?") and answers it. This answer is appended to the prompt to help the model make the final, fine-grained selection.
  2. Parameter Generation & Verification: Once a tool is chosen, the model generates potential parameter sets. It again uses a contrastive question to resolve ambiguities (e.g., "Is 22.1 the latitude or the longitude?") before finalizing the tool call.
The TOOLVERIFIER pipeline illustrating the two-step verification process for tool selection and parameter generation.

To facilitate learning this meta-skill, the authors developed ToolSelect, a synthetic training dataset of 173 tools and 555 reasoning-heavy instructions. This allows the model to learn the logic of tool selection independently of specific real-world APIs, proving that "learning to use tools" is a meta-skill that can be taught using diverse, synthetic descriptions.

Results

The framework was evaluated on the ToolBench benchmark across four diverse tasks: Weather, Cat, Home, and Booking. TOOLVERIFIER demonstrated superior performance, particularly in complex scenarios.

Performance comparison of TOOLVERIFIER against various tool-augmented LLMs and prompting baselines across ToolBench tasks.

As shown in the results, TOOLVERIFIER achieved an average success rate of 89.52%, compared to 67.62% for a standard two-step Llama-2 baseline—a 22% absolute improvement. Notably, on the "Booking" task—the most challenging in the set—it outperformed the 1-shot baseline by over 50 points (84.17% vs 34.17%).

Ablation studies confirmed that the self-verification mechanism alone contributed an 8% improvement in success rates (comparing the full model to the version without verification). Furthermore, the method proved model-agnostic; applying the verification logic to other models like NexusRaven-V2 and Qwen1.5 resulted in improvements of up to 9 points.

Conclusion

TOOLVERIFIER provides a robust mechanism for LLMs to generalize to new tools by leveraging contrastive self-verification. By forcing the model to explicitly contrast its top choices, the framework bypasses the noise of large tool libraries and focuses on nuanced documentation details. While currently focused on single-tool calls and incurring some inference overhead due to additional verification steps, it represents a significant step toward more reliable and autonomous AI agents. Future work will explore extending this framework to multi-step agentic workflows and optimizing inference speed.

Summary updated

BibTeX
@inproceedings{mekala2024toolverifier,
  author = {Dheeraj Mekala and Jason Weston and Jack Lanchantin and Roberta Raileanu and Maria Lomeli and Jingbo Shang and Jane Dwivedi-Yu},
  title = {{TOOLVERIFIER: Generalization to New Tools via Self-Verification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.289},
}
Figure