TL;DR
This paper introduces GAP3, a novel genetic algorithm that automatically searches for effective "prompts" (task-specific instructions) for large language models (LLMs) without requiring access to their internal workings or pre-existing manual prompts. This makes prompt tuning more accessible and practical, especially for LLMs offered as black-box services.
What Problem Does This Paper Address?
Large language models (LLMs) have shown incredible capabilities, particularly in few-shot learning scenarios where they can perform tasks with minimal examples. A popular technique to adapt LLMs to specific tasks is "prompt tuning," which involves adding a small number of tunable parameters (prompts) to the input. However, existing prompt tuning methods often have significant prerequisites: some require access to the LLM's internal states (making them unsuitable for black-box APIs), while others demand carefully crafted manual prompts as a starting point, which is labor-intensive and may not be optimal. This paper aims to overcome these limitations by developing a "precondition-free" prompt tuning method.
Methods
The core of this paper is the Generic Algorithm for Predictive Probability guided Prompting (GAP3). GAP3 is a genetic algorithm that evolves discrete prompts from scratch. Here's how it works:
- Representation: Prompts are treated as "chromosomes," and individual tokens within the prompt are considered "genes."
- Initialization: GAP3 starts with an "empty" prompt, meaning it doesn't require any pre-existing manual prompts.
- Evolution: The algorithm iteratively generates a population of candidate prompts.
- Crossover: Promising prompts from the current population are combined to create new ones.
- Mutation: Prompts are modified by either inserting new tokens or masking existing ones.
- Guidance: The key innovation is how GAP3 guides the mutation process. When a token is masked, GAP3 uses the predictive probabilities of the backbone LLM to select a replacement token that best maximizes the probability of the correct label for the training data. This leverages the LLM's own understanding to refine the prompts.
- Fitness: The "fitness" of a prompt is determined by its performance on a given task, measured by metrics like accuracy. A secondary fitness function is used to break ties and ensure diversity.
This approach avoids the need for internal model access and manual prompt engineering.
Datasets
The experiments were conducted on a suite of 7 benchmark NLP tasks:
- Yelp Polarity
- AG's News
- DBPedia
- SST-2
- MRPC
- RTE
- SNLI
These are standard datasets commonly used for evaluating NLP models, particularly in few-shot learning settings. The paper uses a k-shot learning setup, where k=16 examples per label are randomly sampled from the original training set for each task.
Key Insights and Ideas
- Democratizing Prompt Tuning: The most significant contribution is making prompt tuning accessible for black-box LLMs, which are increasingly common as "LLM-as-a-Service."
- Learning from Scratch: GAP3's ability to evolve effective prompts from an empty state is a major advantage over methods requiring manual initialization.
- Leveraging LLM Probabilities: Using the LLM's own predictive probabilities to guide prompt mutations is an elegant way to exploit the model's knowledge without direct gradient access.
- Weak Dependence on Auxiliary Models: For MLM or T5-like backbones, GAP3 can generate prompts without any auxiliary models. Even when a casual LM is used as the backbone, an auxiliary MLM can be employed, and the paper suggests GAP3's dependence on the specific auxiliary is weak.
Key Results
- Outperforms Baselines: GAP3 consistently outperformed existing derivative-free prompt tuning methods (BBT, GPS, GRIPS) on all tested tasks and backbones.
- Significant Improvements: For the RoBERTaLARGE backbone, GAP3 achieved average score improvements of at least 2.9%, and for GPT-2LARGE, it was 2.4%.
- Competitive with Gradient-Based Methods: GAP3's performance was competitive with, and sometimes surpassed, gradient-based prompt tuning methods, especially for the RoBERTaLARGE backbone.
- Full-Model Fine-Tuning Still Dominant: While GAP3 is highly effective, full-model fine-tuning still achieved the highest overall scores, though it violates the black-box assumption.
- Robustness: The paper shows that GAP3's performance is relatively robust to the choice of auxiliary MLM when a casual LM is used as the backbone.
Limitations and Future Work
- Computational Cost: The primary limitation acknowledged is the computational cost associated with the genetic algorithm's evolution process, which can be expensive for very large training datasets. The authors suggest exploring k-fold cross-validation or other strategies to mitigate this.
- Label Word Selection: The current method uses manually assigned label words. Future work will focus on developing strategies for automatically discovering or optimizing these label words.
- Prompt Interpretability: The learned prompts are not directly human-readable. Future research could explore methods to make these prompts more interpretable.
- Hyperparameter Sensitivity: While generally robust, GAP3 shows some sensitivity to the crossover probability, suggesting further heuristics might be beneficial for finding optimal values.
Summary updated