[Paper Review] Instances Need More Care: Rewriting Prompts for Instances with LLMs in the Loop Yields Better Zero-Shot Performance
PRoMPTd rewrites prompts for each test instance to provide more specific, unambiguous, and complete guidance, yielding better zero-shot performance across eight datasets and enabling interpretability and adversarial-prompt defense.
Large language models (LLMs) have revolutionized zero-shot task performance, mitigating the need for task-specific annotations while enhancing task generalizability. Despite its advancements, current methods using trigger phrases such as "Let's think step by step" remain limited. This study introduces PRomPTed, an approach that optimizes the zero-shot prompts for individual task instances following an innovative manner of "LLMs in the loop". Our comprehensive evaluation across 13 datasets and 10 task types based on GPT-4 reveals that PRomPTed significantly outperforms both the naive zero-shot approaches and a strong baseline (i.e., "Output Refinement") which refines the task output instead of the input prompt. Our experimental results also confirmed the generalization of this advantage to the relatively weaker GPT-3.5. Even more intriguingly, we found that leveraging GPT-3.5 to rewrite prompts for the stronger GPT-4 not only matches but occasionally exceeds the efficacy of using GPT-4 as the prompt rewriter. Our research thus presents a huge value in not only enhancing zero-shot LLM performance but also potentially enabling supervising LLMs with their weaker counterparts, a capability attracting much interest recently. Finally, our additional experiments confirm the generalization of the advantages to open-source LLMs such as Mistral 7B and Mixtral 8x7B.
Motivation & Objective
- Motivate the need for instance-level prompt optimization to boost zero-shot LLM performance.
- Propose PRoMPTd to rewrite prompts for each test instance using contrastive demonstrations.
- Demonstrate that instance-level rewriting improves accuracy across multiple datasets and task types.
- Show that rewritten prompts enhance interpretability and can aid defense against adversarial prompting.
Proposed method
- Define a prompt rewriting function F that maps an original prompt rho to a rewritten rho* for a test instance.
- Formulate prompt rewriting as few-shot in-context learning for a dedicated rewriting LLM M_rewrite using contrastive demonstrations D of good/bad prompts with rationale.
- Construct PRoMT, a dataset of 10 prompt-rewriting demonstrations across task types (math, logic, code, content) generated via ChatGPT.
- Apply PRoMPTd by using M_rewrite to generate rho* for each test instance and run the zero-shot task LLM M_task on rho* with GPT-4 in all experiments.
- Evaluate performance against baselines (Zero-Shot and Zero-Shot CoT) and a task-level variant PRoMPTd (Instruction-only).
- Assess ablations to determine the importance of reasoning rationale and task-type signals in rewriting.
Experimental results
Research questions
- RQ1Does per-instance prompt rewriting improve zero-shot performance across diverse tasks compared to standard zero-shot and zero-shot CoT baselines?
- RQ2How do instance-level prompts affect performance on mathematical reasoning, logical reasoning, and code generation tasks?
- RQ3What is the contribution of including a reason for rewriting and task-type indication in PRoMPTd?
- RQ4Can PRoMPTd generalize to unseen task types and help defend against adversarial prompting?
Key findings
- PRoMPTd consistently outperforms naive zero-shot prompts across all eight datasets.
- On MATH, PRoMPTd yields about 10% absolute improvement over baselines; on HumanEval code generation, about 5% absolute improvement.
- PRoMPTd (Instruction-only) improves over task-level rewriting but is less robust than per-instance rewriting.
- Ablations show that both the reason-for-rewriting and task-type signals are important for optimal performance.
- Human evaluation indicates rewritten prompts are more specific, unambiguous, complete, and structured with minimal hallucination.
- PRoMPTd can generalize to unseen task types (e.g., sentiment classification) and can aid in defending against adversarial prompting by providing interpretable prompt transformations.
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.