[논문 리뷰] Gorilla: Large Language Model Connected with Massive APIs
요약: Gorilla는 수많은 ML API를 호출하기 위해 검색을 활용하도록 미세조정된 LLaMA-7B 모델로, API 호출 정확도와 환각 감소 측면에서 GPT-4보다 우수하며, 검색기-인식 학습을 통해 테스트 시 API 변경에 적응합니다.
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
연구 동기 및 목표
- LLM이 미세조정과 검색을 통해 크고 변경되는 API 공간을 활용하도록 활성화하는 것을 목표로 한다.
- APIBench를 생성하고 사용하여 API-call 정확도와 환각을 벤치마크한다.
- 검색기 인식 학습 파이프라인을 개발하여 API 문서 업데이트에 적응한다.
- 제약 조건과 복수의 검색기가 API 호출 품질과 신뢰성에 미치는 영향을 평가한다.
제안 방법
- TorchHub, TensorHub, 및 HuggingFace 모델 허브에서 1,645개의 API 호출을 수집하고 각 API당 10개의 지시–API 쌍을 생성하여 APIBench를 구성한다.
- 지시 학습으로 LLaMA-7B 기본 모델을 미세조정하여 API 호출 생성에 특화시킨다.
- 훈련 및 추론에 문서 검색기를 도입하여 프롬프트에 최신 API 문서를 제공한다(검색기-인식 학습).
- 생성된 API 호출의 기능적 정확성을 검증하고 환각을 식별하기 위해 AST 기반 하위 트리 매칭으로 API 호출 정확도를 평가한다.
- 제로샷(검색기 없음) 및 검색(검색된 API 문서 사용) 두 가지 추론 모드를 지원한다.
- API 사용의 제약(예: 정확도, 매개변수 수)을 분석하여 API를 선택할 때의 트레이드오프를 연구한다.
![Figure 1: Examples of API calls . Example API calls generated by GPT-4 [ 29 ] , Claude [ 3 ] , and Gorilla for the given prompt. In this example, GPT-4 presents a model that doesn’t exist, and Claude picks an incorrect library. In contrast, our Gorilla model can identify the task correctly and sugge](https://ar5iv.labs.arxiv.org/html/2305.15334/assets/x1.png)
실험 결과
연구 질문
- RQ1대규모의 중첩되고 변화하는 API 공간에 직면했을 때, 자연어 프롬프트로부터 정확하고 실행 가능한 API 호출을 생성하는 LLM의 정확도는 얼마나 되는가?
- RQ2미세조정/추론에 검색기를 추가하면 API 호출 정확도가 향상되고 환각이 감소하는가, 특히 테스트 시점의 문서 변화 하에서?
- RQ3모델이 API 사용 제약을 추론하고 주어진 요구사항을 만족하는 API를 선택할 수 있는가?
- RQ4Gorilla가 여러 API 허브에서 API 호출 작업에 대해 기존의 최첨단 LLM(GPT-4, Claude 등)과 비교하여 어떤 성능 차이를 보이는가?
주요 결과
- Gorilla는 TorchHub와 HuggingFace에서 API 기능 정확도 및 환각 감소에서 GPT-4를 크게 능가하며; TensorFlow Hub에서는 GPT-4와 대등한 성능을 보인다.
- 가볍게 미세조정된 Gorilla는 제로샷에서 최첨단 성능을 달성했으며, 평가된 데이터 세트에서 GPT-4보다 약 20.43% 우수하고 ChatGPT보다 10.75% 우수하다.
- 검색기 인식 학습은 테스트 시점의 API 문서 변화에 대한 적응성을 향상시키고, 비검색 baselines에 비해 환각을 감소시키나, 비최적 검색기는 때때로 성능에 해를 끼칠 수 있다.
- 그라운드-트루스 검색기를 사용한 미세조정은 검색기 없이 학습한 경우에 비해 ~TorchHub에서 ~12.37%, HuggingFace에서 ~23.46%의 큰 이점을 가져다준다.
- 연구는 Gorilla가 API 제약(예: 필요한 정확도 및 매개변수 한도)을 이해하고 적용하며, 문서 업데이트에 재훈련 없이도 적응할 수 있음을 보여준다.

이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.