Prompt Engineering per un Prompt Engineer
Prompt Engineering a Prompt Engineer
November 9, 2023
Autori: Qinyuan Ye, Maxamed Axmed, Reid Pryzant, Fereshte Khani
cs.AI
Abstract
L'ingegneria dei prompt è un compito impegnativo ma cruciale per ottimizzare le prestazioni dei grandi modelli linguistici (LLM). Richiede un ragionamento complesso per analizzare gli errori del modello, ipotizzare cosa manchi o sia fuorviante nel prompt corrente e comunicare il compito con chiarezza. Sebbene lavori recenti indichino che gli LLM possano essere meta-promptati per eseguire automaticamente l'ingegneria dei prompt, il loro potenziale potrebbe non essere pienamente sfruttato a causa della mancanza di una guida sufficiente per elicitare capacità di ragionamento complesso negli LLM nel meta-prompt. In questo lavoro, investigiamo il problema dell'"ingegneria dei prompt per un ingegnere dei prompt" – costruire un meta-prompt che guidi in modo più efficace gli LLM a eseguire automaticamente l'ingegneria dei prompt. Introduciamo e analizziamo componenti chiave, come un modello di ragionamento passo-passo e una specificazione del contesto, che portano a prestazioni migliorate. Inoltre, ispirati da concetti comuni di ottimizzazione come dimensione del batch, dimensione del passo e momento, introduciamo le loro controparti verbalizzate nel meta-prompt e ne investigiamo gli effetti. Il nostro metodo finale, denominato PE2, trova un prompt che supera "pensiamo passo dopo passo" del 6,3% sul dataset MultiArith e del 3,1% sul dataset GSM8K. Per dimostrarne la versatilità, applichiamo PE2 al benchmark Instruction Induction, a una serie di task controfattuali e a un lungo prompt industriale del mondo reale. In questi contesti, PE2 raggiunge prestazioni solide e supera le precedenti baseline di ingegneria automatica dei prompt. Inoltre, mostriamo che PE2 apporta modifiche significative e mirate ai prompt, corregge prompt errati o incompleti e presenta capacità non banali di ragionamento controfattuale.
English
Prompt engineering is a challenging yet crucial task for optimizing the
performance of large language models (LLMs). It requires complex reasoning to
examine the model's errors, hypothesize what is missing or misleading in the
current prompt, and communicate the task with clarity. While recent works
indicate that LLMs can be meta-prompted to perform automatic prompt
engineering, their potentials may not be fully untapped due to the lack of
sufficient guidance to elicit complex reasoning capabilities in LLMs in the
meta-prompt. In this work, we investigate the problem of "prompt engineering a
prompt engineer" -- constructing a meta-prompt that more effectively guides
LLMs to perform automatic prompt engineering. We introduce and analyze key
components, such as a step-by-step reasoning template and context
specification, which lead to improved performance. In addition, inspired by
common optimization concepts such as batch size, step size and momentum, we
introduce their verbalized counterparts to the meta-prompt and investigate
their effects. Our final method, named PE2, finds a prompt that outperforms
"let's think step by step" by 6.3% on the MultiArith dataset and 3.1% on the
GSM8K dataset. To demonstrate its versatility, we apply PE2 to the Instruction
Induction benchmark, a suite of counterfactual tasks, and a lengthy, real-world
industrial prompt. In these settings, PE2 achieves strong performance and
outperforms prior automatic prompt engineering baselines. Further, we show that
PE2 makes meaningful and targeted prompt edits, amends erroneous or incomplete
prompts, and presents non-trivial counterfactual reasoning abilities.