Large Language Models (LLMs) have seen an impressive wave of advances recently, with models now excelling in a variety of tasks, such as mathematical reasoning and program synthesis. However, their potential to effectively use tools via API calls remains unfulfilled. This is a challenging task even for today's state-of-the-art LLMs such as GPT-4, largely due to their inability to generate accurate input arguments and their tendency to hallucinate the wrong usage of an API call. We release Gorilla, a finetuned LLaMA-based model that surpasses the performance of GPT-4 on writing API calls. When combined with a document retriever, Gorilla demonstrates a strong capability to adapt to test-time document changes, enabling flexible user updates or version changes. It also substantially mitigates the issue of hallucination, commonly encountered when prompting LLMs directly. To evaluate the model's ability, we introduce APIBench, a comprehensive dataset consisting of HuggingFace, TorchHub, and TensorHub APIs. The successful integration of the retrieval system with Gorilla demonstrates the potential for LLMs to use tools more accurately, keep up with frequently updated documentation, and consequently increase the reliability and applicability of their outputs. Gorilla's code, model, data, and demo are available at https://gorilla.cs.berkeley.edu
翻译:大型语言模型(LLMs)近期取得了令人瞩目的进展,在数学推理、程序合成等任务中表现出色。然而,它们通过API调用有效使用工具的能力仍有待开发。即使是当前最先进的LLMs(如GPT-4),也因难以生成准确的输入参数且倾向于对API调用的错误用法产生幻觉,导致该任务极具挑战性。我们发布了Gorilla——一个基于LLaMA微调的模型,其在编写API调用方面超越了GPT-4的性能。结合文档检索器后,Gorilla展现出对测试时文档变化的强适应能力,支持灵活的模型更新或版本变更。同时,它显著缓解了直接提示LLMs时常见的幻觉问题。为评估模型能力,我们引入了APIBench——一个包含HuggingFace、TorchHub和TensorHub API的综合数据集。检索系统与Gorilla的成功集成,展示了LLMs更精准使用工具、紧跟频繁更新的文档,从而提升输出可靠性与适用性的潜力。Gorilla的代码、模型、数据和演示地址为 https://gorilla.cs.berkeley.edu。