Introduction
Prompt engineering has traditionally been a trial-and-error process aimed at finding a single, static prompt that performs well on average across an entire dataset. However, large language models (LLMs) are notoriously sensitive to input context; a prompt that effectively identifies a gender stereotype might fail or cause confusion when applied to racial bias. Furthermore, simply stacking multiple prompting techniques (e.g., combining personas with few-shot examples and chain-of-thought reasoning) often introduces noise and reduces performance—a phenomenon known as prompt interference.
To address these challenges, we introduce Adaptive Prompting, a meta-learning approach that moves away from "one-size-fits-all" engineering. Instead, it predicts the optimal combination of prompting techniques—such as personas, reasoning steps, or specific definitions—for each individual input instance, a task we define as ad-hoc prompt composition.
Methodology
The Adaptive Prompting framework consists of a three-step pipeline designed to optimize LLM performance dynamically based on the input text.
- Label Collection: We define a pool of five common prompting techniques: Personas, Definitions, Directional Stimuli (hints), Reasoning Steps, and In-context Demonstrations. We generate all 64 valid combinations (compositions) of these techniques and evaluate a training set through an LLM using every composition to identify which ones yield correct classifications.
- Encoder Training: A "meta-model" (DeBERTa-v3-large) is trained as a regressor to analyze raw input text and predict the likelihood that each of the 64 prompt compositions will result in a correct classification by the target LLM.
- Adaptive Inference: For new, unseen text, the encoder predicts the best composition. The system then dynamically constructs that specific prompt for the final classification by the LLM (e.g., Mistral-7B, Command-R 35B, or Llama-3 70B).
To interpret these results, we employ Shapley Value Analysis to quantify the individual contributions and second-order interactions of each prompting technique.
Experimental Setup and Datasets
Our study focuses primarily on social bias detection using three benchmarks:
- StereoSet: Common stereotypes regarding gender, profession, race, and religion.
- SBIC (Social Bias Inference Corpus): Offensive language and implicit bias.
- CobraFrames: Social and situational contexts, including power dynamics.
To test generalizability, we also evaluated the method on non-bias tasks, including Sentiment Analysis (ABSA), Natural Language Inference (e-SNLI), and CommonsenseQA.
Key Results and Insights
Adaptive Prompting consistently outperformed static "average best" prompts, suggesting that fixed prompts leave significant performance on the table.
- Performance Gains: On the StereoSet dataset, Adaptive Prompting achieved a 0.853 Macro F1 with Llama-3 (70B), significantly exceeding the best fixed-prompt baseline of 0.817. The gains were even more pronounced for the medium-sized Command-R (35B), which saw an F1 boost from 0.706 to 0.781.
- The "More is Better" Fallacy: We found that the "full" prompt (using all techniques) is rarely optimal. In many instances, adding more instructions actually degraded performance compared to a minimal base prompt.
- Input-Specific Synergy: Techniques interact in complex, often negative ways. For example, Shapley analysis revealed that Reasoning Steps and Personas can conflict on certain datasets, working well individually but hurting performance when combined.
- Model-Specific Preferences: Optimal prompts are both task- and model-dependent. A definition that helps Mistral might be redundant or distracting for Llama-3.
Conclusion and Future Work
Adaptive Prompting demonstrates that instance-level prompt optimization can outperform both static prompt engineering and, in some cases, task-specific fine-tuning of smaller models. However, the initial "Label Collection" phase is computationally expensive. Future research will focus on developing technique-agnostic approaches to reduce this overhead and extending the framework from binary classification to multi-class tasks and open-ended generation.
Summary updated