LLM nell'Imaginarium: Apprendimento di Strumenti attraverso Simulazione di Prove ed Errori
LLMs in the Imaginarium: Tool Learning through Simulated Trial and Error
March 7, 2024
Autori: Boshi Wang, Hao Fang, Jason Eisner, Benjamin Van Durme, Yu Su
cs.AI
Abstract
Gli strumenti sono essenziali affinché i modelli linguistici di grandi dimensioni (LLM) possano acquisire informazioni aggiornate e intraprendere azioni consequenziali in ambienti esterni. Il lavoro esistente sugli LLM potenziati da strumenti si concentra principalmente sull'ampia copertura degli strumenti e sulla flessibilità nell'aggiungere nuovi strumenti. Tuttavia, un aspetto critico che è stato sorprendentemente poco studiato è semplicemente quanto accuratamente un LLM utilizzi gli strumenti per i quali è stato addestrato. Scopriamo che gli LLM esistenti, inclusi GPT-4 e LLM open-source specificamente ottimizzati per l'uso di strumenti, raggiungono un tasso di correttezza compreso tra il 30% e il 60%, ben lontano da un utilizzo affidabile nella pratica. Proponiamo un metodo ispirato alla biologia per gli LLM potenziati da strumenti, il trial and error simulato (STE), che orchestra tre meccanismi chiave per comportamenti di successo nell'uso degli strumenti nel sistema biologico: trial and error, immaginazione e memoria. Nello specifico, STE sfrutta l'"immaginazione" di un LLM per simulare scenari plausibili per l'uso di uno strumento, dopo di che l'LLM interagisce con lo strumento per apprendere dal feedback della sua esecuzione. Sia la memoria a breve termine che quella a lungo termine vengono impiegate per migliorare rispettivamente la profondità e l'ampiezza dell'esplorazione. Esperimenti completi su ToolBench dimostrano che STE migliora sostanzialmente l'apprendimento degli strumenti per gli LLM sia in contesti di apprendimento in-context che di fine-tuning, portando un incremento del 46,7% a Mistral-Instruct-7B e consentendogli di superare GPT-4. Mostriamo inoltre un efficace apprendimento continuo degli strumenti attraverso una semplice strategia di replay delle esperienze.
English
Tools are essential for large language models (LLMs) to acquire up-to-date
information and take consequential actions in external environments. Existing
work on tool-augmented LLMs primarily focuses on the broad coverage of tools
and the flexibility of adding new tools. However, a critical aspect that has
surprisingly been understudied is simply how accurately an LLM uses tools for
which it has been trained. We find that existing LLMs, including GPT-4 and
open-source LLMs specifically fine-tuned for tool use, only reach a correctness
rate in the range of 30% to 60%, far from reliable use in practice. We propose
a biologically inspired method for tool-augmented LLMs, simulated trial and
error (STE), that orchestrates three key mechanisms for successful tool use
behaviors in the biological system: trial and error, imagination, and memory.
Specifically, STE leverages an LLM's 'imagination' to simulate plausible
scenarios for using a tool, after which the LLM interacts with the tool to
learn from its execution feedback. Both short-term and long-term memory are
employed to improve the depth and breadth of the exploration, respectively.
Comprehensive experiments on ToolBench show that STE substantially improves
tool learning for LLMs under both in-context learning and fine-tuning settings,
bringing a boost of 46.7% to Mistral-Instruct-7B and enabling it to outperform
GPT-4. We also show effective continual learning of tools via a simple
experience replay strategy.