atlas

Research map / Large language models / Agents, code and math

Gorilla: Large Language Model Connected with Massive APIs

NeurIPS 2024 · Large language models › Agents, code and math · approach: Execution-based code verification · 93 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Gorilla fine-tunes LLaMA-7B on self-instructed API-call data with retriever-aware training (RAT) and evaluates it on the new APIBench using AST sub-tree matching for accuracy and hallucination.

Problem

LLMs generate inaccurate or hallucinated API calls, especially across large, frequently updated sets of ML APIs with overlapping functionality and changing documentation.

Approach

Retriever-aware training appends retrieved (possibly wrong) API documentation to the prompt during fine-tuning while keeping the ground-truth API as target, teaching the model to judge retrieved docs and adapt to test-time documentation changes; AST sub-tree matching measures accuracy and hallucination.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use an Oracle retriever with Gorilla instead of no retriever (ablation)Gorilla · Torch Hubaccuracy: 59.13 -> 67.20Helped
Use an Oracle retriever with Gorilla instead of no retriever (ablation)Gorilla · HuggingFaceaccuracy: 71.68 -> 91.26Helped
Use an Oracle retriever with Gorilla instead of no retriever (ablation)Gorilla · TensorFlow Hubaccuracy: 83.79 -> 94.16Helped
Use a BM25 retriever instead of no retriever (ablation)Gorilla · Torch Hubaccuracy: 59.13 -> 37.63Hurt
Use a GPT-Index retriever instead of no retriever (ablation)Gorilla · HuggingFaceaccuracy: 71.68 -> 28.10Hurt
Use a GPT-Index retriever instead of no retriever (ablation)Gorilla · TensorFlow Hubaccuracy: 83.79 -> 52.40Hurt
Add retriever-aware training with ground-truth API documents (ablation)Gorilla · Torch Hubaccuracy: 59.13 -> 67.20Helped
Add retriever-aware training with ground-truth API documents (ablation)Gorilla · HuggingFaceaccuracy: 71.68 -> 91.26Helped
Use three-shot in-context examples instead of zero-shot prompting (ablation)GPT-3.5 · Torch Hubaccuracy: 41.93 -> 73.11Helped
Use three-shot in-context examples instead of zero-shot prompting (ablation)GPT-3.5 · Torch Hubhallucination: 10.75 -> 72.58Hurt
Replace DocPrompting with GorillaHuggingFace API calls · HuggingFaceaccuracy: 61.72 -> 71.68Helped
Replace DocPrompting with GorillaHuggingFace API calls · HuggingFacehallucination: 17.36 -> 10.95Helped

Surprising findings

Limitations

Experimental setup

Datasets: APIBench HuggingFace model cards TorchHub model cards TensorFlow Hub model cards

Benchmarks: APIBench

Metrics: AST sub-tree matching accuracy hallucination rate error rate

Baselines: GPT-4 GPT-3.5-turbo Claude LLaMA-7B DocPrompting

Builds on: self-instruct LLaMA DocPrompting Toolformer

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy