[Paper Review] TEMPERA: Test-Time Prompting via Reinforcement Learning
TEMPERA proposes a reinforcement learning-based method for test-time prompt editing in large language models, enabling dynamic, query-specific prompt optimization by flexibly modifying instructions, few-shot exemplars, and verbalizers. It achieves state-of-the-art performance across multiple NLP tasks and 4x higher sample efficiency than standard fine-tuning, with significant improvements over prompt tuning and discrete prompt optimization methods.
Careful prompt design is critical to the use of large language models in zero-shot or few-shot learning. As a consequence, there is a growing interest in automated methods to design optimal prompts. In this work, we propose Test-time Prompt Editing using Reinforcement learning (TEMPERA). In contrast to prior prompt generation methods, TEMPERA can efficiently leverage prior knowledge, is adaptive to different queries and provides an interpretable prompt for every query. To achieve this, we design a novel action space that allows flexible editing of the initial prompts covering a wide set of commonly-used components like instructions, few-shot exemplars, and verbalizers. The proposed method achieves significant gains compared with recent SoTA approaches like prompt tuning, AutoPrompt, and RLPrompt, across a variety of tasks including sentiment analysis, topic classification, natural language inference, and reading comprehension. Our method achieves 5.33x on average improvement in sample efficiency when compared to the traditional fine-tuning methods.
Motivation & Objective
- To address the sensitivity of large language models to prompt design by enabling dynamic, query-dependent prompt optimization at test time.
- To improve sample efficiency in few-shot learning by replacing or augmenting traditional fine-tuning with adaptive prompt editing.
- To balance interpretability, flexibility, and feasibility in prompt optimization by using a structured editing action space.
- To incorporate human prior knowledge into prompt optimization through a learnable editing process starting from a manually designed initial prompt.
- To achieve state-of-the-art performance on diverse NLP benchmarks, including GLUE and SuperGLUE, with minimal hyperparameter tuning.
Proposed method
- Formulates discrete prompt optimization as a reinforcement learning problem where the agent edits an initial prompt using a predefined action space.
- Designs a novel action space that supports editing instructions, in-context exemplars, and verbalizers using natural language operations such as replacement, insertion, and deletion.
- Uses a score difference between consecutive prompts before and after editing as the primary reward signal, with reward normalization to stabilize training.
- Employs an attention-based policy network that attends over candidate edits and design choices to improve exploration and policy learning.
- Integrates human prior knowledge by initializing the prompt with a manually crafted version and allowing RL to refine it per query.
- Applies curriculum learning and temperature scaling during training to enhance convergence and performance.
Experimental results
Research questions
- RQ1Can test-time prompt editing via reinforcement learning significantly improve zero-shot and few-shot performance of large language models across diverse NLP tasks?
- RQ2How does the proposed method compare in sample efficiency to standard fine-tuning and other prompt tuning techniques?
- RQ3To what extent does the flexibility of the editing action space contribute to performance gains compared to fixed or black-box prompt generation?
- RQ4How robust is the method to variations in the number of few-shot exemplars and the size of the prompt pool?
- RQ5Can the method maintain high performance while ensuring interpretability through semantically coherent edits?
Key findings
- TEMPERA achieves state-of-the-art performance on multiple benchmarks, including a 1.8% absolute improvement on SST-2 and a 3.9% improvement on CR compared to few-shot fine-tuning.
- The method improves sample efficiency by 5.33x on average compared to standard fine-tuning, with results showing 4x fewer examples needed to match performance.
- Performance increases consistently with more in-context exemplars (up to 4 examples), though performance drops at 8 exemplars in AG News due to input length limits.
- The method is robust to prompt pool size, with performance improving slightly (up to 0.6% on AG News) as the pool size increases from 8 to 32.
- Verbalizer editing contributes significantly to performance, with a 1.2% gain on AG News, highlighting its importance in task-specific prompt design.
- Ablation studies confirm that each editing component—verbalizers, instructions, exemplars—adds measurable value, and removing any reduces final performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.