Gorilla

Gorilla is a large language model specifically fine-tuned to generate accurate API calls and tool usage commands. Developed by UC Berkeley researchers, Gorilla addresses one of the key challenges in AI agent systems — getting LLMs to correctly invoke external tools, APIs, and functions with the right parameters.

The Problem Gorilla Solves

  • Standard LLMs often hallucinate API names, generate calls with wrong parameters, or use deprecated endpoints when asked to invoke tools.
  • API documentation changes frequently, and models trained on static data quickly become outdated.
  • Gorilla was trained to be both accurate and updatable in its API knowledge.

How Gorilla Works

  • Training Data: Fine-tuned on a large dataset of API documentation from HuggingFace Hub, PyTorch Hub, and TensorFlow Hub, covering thousands of ML model APIs.
  • Retrieval Augmentation: Gorilla uses a retriever to fetch up-to-date API documentation at inference time, reducing hallucination of outdated or incorrect calls.
  • AST Accuracy: Evaluated using Abstract Syntax Tree matching to verify that generated API calls are syntactically and semantically correct.

Key Contributions

  • APIBench: A comprehensive benchmark for evaluating LLMs on API call generation accuracy across different domains.
  • Retrieval-Aware Training: Gorilla was trained with retrieved documentation in its context, making it better at leveraging real-time API docs.
  • Reduced Hallucination: Significantly lower hallucination rates for API calls compared to GPT-4 and other general-purpose LLMs.

Impact on AI Agents

Gorilla's approach — specialized fine-tuning for tool use plus retrieval augmentation — has influenced how the industry thinks about building reliable AI agents. The principle of training models to accurately generate structured function calls is now a core capability in models like GPT-4, Claude, and Gemini through their function calling features.

Take gorilla further

Ask the copilot about this term, or have our engineers assess it against your process.