Grandi Modelli Linguistici come Ottimizzatori
Large Language Models as Optimizers
September 7, 2023
Autori: Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V. Le, Denny Zhou, Xinyun Chen
cs.AI
Abstract
L'ottimizzazione è onnipresente. Sebbene gli algoritmi basati sulle derivate siano stati strumenti potenti per vari problemi, l'assenza di gradiente pone sfide in molte applicazioni del mondo reale. In questo lavoro, proponiamo l'Ottimizzazione tramite PROmpting (OPRO), un approccio semplice ed efficace per sfruttare i grandi modelli linguistici (LLM) come ottimizzatori, dove il compito di ottimizzazione è descritto in linguaggio naturale. In ogni passo di ottimizzazione, l'LLM genera nuove soluzioni dal prompt che contiene le soluzioni precedentemente generate con i loro valori, poi le nuove soluzioni vengono valutate e aggiunte al prompt per il passo di ottimizzazione successivo. Mostriamo prima OPRO su problemi di regressione lineare e del commesso viaggiatore, per poi passare all'ottimizzazione dei prompt, dove l'obiettivo è trovare istruzioni che massimizzino l'accuratezza del compito. Con una varietà di LLM, dimostriamo che i migliori prompt ottimizzati da OPRO superano i prompt progettati da esseri umani fino all'8% su GSM8K e fino al 50% sui task di Big-Bench Hard.
English
Optimization is ubiquitous. While derivative-based algorithms have been
powerful tools for various problems, the absence of gradient imposes challenges
on many real-world applications. In this work, we propose Optimization by
PROmpting (OPRO), a simple and effective approach to leverage large language
models (LLMs) as optimizers, where the optimization task is described in
natural language. In each optimization step, the LLM generates new solutions
from the prompt that contains previously generated solutions with their values,
then the new solutions are evaluated and added to the prompt for the next
optimization step. We first showcase OPRO on linear regression and traveling
salesman problems, then move on to prompt optimization where the goal is to
find instructions that maximize the task accuracy. With a variety of LLMs, we
demonstrate that the best prompts optimized by OPRO outperform human-designed
prompts by up to 8% on GSM8K, and by up to 50% on Big-Bench Hard tasks.