# Gorilla

Gorilla is an API-calling large language model developed by the Berkeley AI Research lab, designed to generate accurate function calls for machine learning and other APIs.

Gorilla is a [large-language-model](https://www.wikiprompt.org/wiki/large-language-model) developed by the [berkeley-ai-research](https://www.wikiprompt.org/wiki/berkeley-ai-research) lab at the University of California, Berkeley. It is specifically designed to generate accurate API calls, translating natural language instructions into executable function invocations. The model was introduced in a 2023 research paper and has been positioned as a tool to improve the reliability of AI systems that interact with external software services.

The core innovation of Gorilla lies in its training methodology and its focus on the domain of API usage. Unlike general-purpose language models that may hallucinate or produce syntactically incorrect code, Gorilla is fine-tuned on a large corpus of API documentation and corresponding call examples. This allows it to understand the structure and parameters of thousands of different APIs, from cloud services to machine learning libraries.

## Training and Architecture

Gorilla is built upon an underlying [transformer](https://www.wikiprompt.org/wiki/transformer) architecture, similar to other contemporary large language models. The initial version was fine-tuned from the LLaMA-7B model, a foundational model released by Meta. The training process involved a technique called Retrieval-Augmented Fine-Tuning (RAFT), which combines standard fine-tuning with a retrieval mechanism. During training, the model is presented with API documentation snippets alongside user queries and the correct API call. This approach teaches the model to generate calls that are grounded in the provided documentation, reducing the likelihood of inventing non-existent functions or parameters.

The training data was curated from a diverse set of sources, including documentation for [amazon-web-services](https://www.wikiprompt.org/wiki/amazon-web-services), [azure](https://www.wikiprompt.org/wiki/azure), and [google-cloud](https://www.wikiprompt.org/wiki/google-cloud) services, as well as popular machine learning frameworks. This extensive coverage enables Gorilla to handle a wide range of tasks, from simple data storage operations to complex model deployment workflows.

## Capabilities and Benchmarks

Gorilla is evaluated on the APIBench benchmark, a dataset created by the researchers to measure the accuracy of API call generation. In these evaluations, Gorilla demonstrated a significant improvement over existing models, including [openai](https://www.wikiprompt.org/wiki/openai)'s GPT-4, in terms of both the correctness of the generated calls and the reduction of hallucination errors. The model is capable of selecting the correct API from a large set of candidates, understanding the required arguments, and producing syntactically valid code in languages such as Python.

One of the key features of Gorilla is its ability to adapt to updates in API documentation. By using retrieval at inference time, the model can incorporate the latest documentation into its responses, making it more robust to changes in the underlying services. This is particularly important in the fast-evolving landscape of cloud computing and [machine-learning](https://www.wikiprompt.org/wiki/machine-learning) tools.

## Applications and Impact

The primary application of Gorilla is in the field of [generative-ai](https://www.wikiprompt.org/wiki/generative-ai) agents that need to interact with external tools and services. It can serve as a backend for virtual assistants, automated workflow systems, and code generation tools. By providing a reliable interface between natural language and programmatic APIs, Gorilla helps bridge the gap between human intent and machine execution.

The release of Gorilla has influenced subsequent research in the area of API-aware language models. Its approach of combining retrieval with fine-tuning has been adopted and extended by other research groups. The model is also notable for its open-source nature, with the code and model weights made publicly available, allowing other researchers to build upon the work.

## Limitations and Future Directions

Despite its strengths, Gorilla has limitations. Its performance is dependent on the quality and coverage of the API documentation used during training. For niche or poorly documented APIs, the model may still produce incorrect calls. Additionally, like all large language models, Gorilla can be sensitive to the phrasing of the input prompt, and may require careful prompt engineering to achieve optimal results.

Future research directions include expanding the model to support more programming languages and API domains, improving its ability to handle multi-step API interactions, and integrating it more deeply with reinforcement learning from human feedback ([rlaif](https://www.wikiprompt.org/wiki/rlaif)) to further refine its outputs. The Berkeley team continues to iterate on the model, with subsequent versions aiming to enhance its accuracy and efficiency.

---
Source: https://www.wikiprompt.org/wiki/gorilla
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-12T22:20:42.08757+00:00
