ChatPaper.aiChatPaper

ToolLLM: Het mogelijk maken voor grote taalmodellen om meer dan 16.000 real-world API's te beheersen

ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs

July 31, 2023
Auteurs: Yujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru Tang, Bill Qian, Sihan Zhao, Runchu Tian, Ruobing Xie, Jie Zhou, Mark Gerstein, Dahai Li, Zhiyuan Liu, Maosong Sun
cs.AI

Samenvatting

Ondanks de vooruitgang van open-source grote taalmodellen (LLMs) en hun varianten, zoals LLaMA en Vicuna, blijven ze aanzienlijk beperkt in het uitvoeren van hogere-niveautaken, zoals het volgen van menselijke instructies om externe tools (API's) te gebruiken. Dit komt doordat de huidige instructie-afstemming zich voornamelijk richt op basistaaltaken in plaats van het domein van toolgebruik. Dit staat in contrast met state-of-the-art (SOTA) LLMs, zoals ChatGPT, die uitstekende toolgebruikscapaciteiten hebben getoond, maar helaas closed source zijn. Om toolgebruikscapaciteiten binnen open-source LLMs te faciliteren, introduceren we ToolLLM, een algemeen framework voor toolgebruik dat bestaat uit dataconstructie, modeltraining en evaluatie. We presenteren eerst ToolBench, een instructie-afstemdingsdataset voor toolgebruik, die automatisch wordt gecreëerd met behulp van ChatGPT. Specifiek verzamelen we 16.464 real-world RESTful API's uit 49 categorieën van RapidAPI Hub, waarna we ChatGPT aanzetten om diverse menselijke instructies te genereren die deze API's betrekken, zowel voor enkelvoudige als meervoudige toolsituaties. Vervolgens gebruiken we ChatGPT om een geldig oplossingstraject (keten van API-aanroepen) voor elke instructie te zoeken. Om het zoekproces efficiënter te maken, ontwikkelen we een nieuw depth-first search-based decision tree (DFSDT), waarmee LLMs meerdere redeneersporen kunnen evalueren en de zoekruimte kunnen uitbreiden. We tonen aan dat DFSDT de plannings- en redeneercapaciteiten van LLMs aanzienlijk verbetert. Voor een efficiënte evaluatie van toolgebruik ontwikkelen we een automatische evaluator: ToolEval. We fine-tunen LLaMA op ToolBench en verkrijgen ToolLLaMA. Onze ToolEval laat zien dat ToolLLaMA een opmerkelijke vaardigheid vertoont om complexe instructies uit te voeren en zich aan te passen aan onbekende API's, en een vergelijkbare prestaties vertoont als ChatGPT. Om de pijplijn praktischer te maken, ontwerpen we een neurale API-retriever om geschikte API's voor elke instructie aan te bevelen, waardoor handmatige API-selectie overbodig wordt.
English
Despite the advancements of open-source large language models (LLMs) and their variants, e.g., LLaMA and Vicuna, they remain significantly limited in performing higher-level tasks, such as following human instructions to use external tools (APIs). This is because current instruction tuning largely focuses on basic language tasks instead of the tool-use domain. This is in contrast to state-of-the-art (SOTA) LLMs, e.g., ChatGPT, which have demonstrated excellent tool-use capabilities but are unfortunately closed source. To facilitate tool-use capabilities within open-source LLMs, we introduce ToolLLM, a general tool-use framework of data construction, model training and evaluation. We first present ToolBench, an instruction-tuning dataset for tool use, which is created automatically using ChatGPT. Specifically, we collect 16,464 real-world RESTful APIs spanning 49 categories from RapidAPI Hub, then prompt ChatGPT to generate diverse human instructions involving these APIs, covering both single-tool and multi-tool scenarios. Finally, we use ChatGPT to search for a valid solution path (chain of API calls) for each instruction. To make the searching process more efficient, we develop a novel depth-first search-based decision tree (DFSDT), enabling LLMs to evaluate multiple reasoning traces and expand the search space. We show that DFSDT significantly enhances the planning and reasoning capabilities of LLMs. For efficient tool-use assessment, we develop an automatic evaluator: ToolEval. We fine-tune LLaMA on ToolBench and obtain ToolLLaMA. Our ToolEval reveals that ToolLLaMA demonstrates a remarkable ability to execute complex instructions and generalize to unseen APIs, and exhibits comparable performance to ChatGPT. To make the pipeline more practical, we devise a neural API retriever to recommend appropriate APIs for each instruction, negating the need for manual API selection.
PDF1015February 7, 2026