Query-Dependent Prompt Evaluation and Optimization with Offline Inverse RL
Hao Sun, Alihan Hüyük, Mihaela van der Schaar
TL;DR
The paper tackles the challenge that optimal prompts for arithmetic reasoning are query-dependent, proposing a query-aware, offline approach. It introduces Prompt-OIRL, which leverages offline inverse reinforcement learning to learn a reward model from demonstrations of existing prompts, then uses a best-of-N strategy to select the most effective prompt at inference time without querying the LLM. Across GSM8K, MAWPS, and SVAMP datasets and three diverse LLMs, Prompt-OIRL demonstrates strong gains in accuracy and robustness, while dramatically reducing inference costs by avoiding repeated LLM calls. The work highlights the value of offline prompting data, provides detailed cost analyses, and suggests directions for broader offline prompt evaluation and optimization beyond arithmetic reasoning.
Abstract
In this study, we aim to enhance the arithmetic reasoning ability of Large Language Models (LLMs) through zero-shot prompt optimization. We identify a previously overlooked objective of query dependency in such optimization and elucidate two ensuing challenges that impede the successful and economical design of prompt optimization techniques. One primary issue is the absence of an effective method to evaluate prompts during inference when the golden answer is unavailable. Concurrently, learning via interactions with the LLMs to navigate the expansive natural language prompting space proves to be resource-intensive. To address this, we introduce Prompt-OIRL, which harnesses offline inverse reinforcement learning to draw insights from offline prompting demonstration data. Such data exists as by-products when diverse prompts are benchmarked on open-accessible datasets. With Prompt-OIRL, the query-dependent prompt optimization objective is achieved by first learning an offline reward model. This model can evaluate any query-prompt pairs without accessing LLMs. Subsequently, a best-of-N strategy is deployed to recommend the optimal prompt. Our experimental evaluations across various LLM scales and arithmetic reasoning datasets underscore both the efficacy and economic viability of the proposed approach.
