EcoAssistant: Utilizzare l'Assistente LLM in Modo Più Economico e Preciso
EcoAssistant: Using LLM Assistant More Affordably and Accurately
October 3, 2023
Autori: Jieyu Zhang, Ranjay Krishna, Ahmed H. Awadallah, Chi Wang
cs.AI
Abstract
Oggi, gli utenti utilizzano i grandi modelli linguistici (LLM) come assistenti per rispondere a query che richiedono conoscenze esterne; chiedono informazioni sul meteo in una città specifica, sui prezzi delle azioni e persino sulla posizione di luoghi specifici nel loro quartiere. Queste query richiedono che l'LLM produca codice che invochi API esterne per rispondere alla domanda dell'utente, ma raramente gli LLM producono codice corretto al primo tentativo, necessitando di una raffinazione iterativa del codice in base ai risultati dell'esecuzione. Inoltre, utilizzare assistenti basati su LLM per gestire volumi elevati di query può essere costoso. In questo lavoro, presentiamo un framework, EcoAssistant, che consente agli LLM di rispondere a query guidate dal codice in modo più economico e accurato. EcoAssistant è composto da tre componenti. Innanzitutto, permette agli assistenti LLM di interagire con un esecutore di codice automatico per raffinare iterativamente il codice o produrre risposte basate sui risultati dell'esecuzione. In secondo luogo, utilizziamo una gerarchia di assistenti LLM, che tenta di rispondere alla query con LLM più deboli e meno costosi prima di ricorrere a LLM più potenti e costosi. Terzo, recuperiamo soluzioni da query passate riuscite come dimostrazioni in contesto per aiutare le query successive. Empiricamente, dimostriamo che EcoAssistant offre vantaggi distintivi in termini di economicità e accuratezza, superando GPT-4 di 10 punti percentuali nel tasso di successo con meno del 50% del costo di GPT-4.
English
Today, users ask Large language models (LLMs) as assistants to answer queries
that require external knowledge; they ask about the weather in a specific city,
about stock prices, and even about where specific locations are within their
neighborhood. These queries require the LLM to produce code that invokes
external APIs to answer the user's question, yet LLMs rarely produce correct
code on the first try, requiring iterative code refinement upon execution
results. In addition, using LLM assistants to support high query volumes can be
expensive. In this work, we contribute a framework, EcoAssistant, that enables
LLMs to answer code-driven queries more affordably and accurately. EcoAssistant
contains three components. First, it allows the LLM assistants to converse with
an automatic code executor to iteratively refine code or to produce answers
based on the execution results. Second, we use a hierarchy of LLM assistants,
which attempts to answer the query with weaker, cheaper LLMs before backing off
to stronger, expensive ones. Third, we retrieve solutions from past successful
queries as in-context demonstrations to help subsequent queries. Empirically,
we show that EcoAssistant offers distinct advantages for affordability and
accuracy, surpassing GPT-4 by 10 points of success rate with less than 50% of
GPT-4's cost.