When to Use Random Search
✅ Best For
- Establishing a quick baseline
- Simple tasks like summarization
- Broad exploration of prompt space
- Low computational budget
❌ Not Ideal For
- Complex, nuanced tasks
- Directed, efficient optimization
- Tasks requiring structured prompts
- Finding the absolute best prompt
How It Works
- Variation Generation: A teacher model creates a set number of diverse rewrites of your initial prompt.
- Evaluation: Each variation is tested against your evaluation dataset.
- Selection: The variation with the highest average score is chosen as the best prompt.
1
Initialize
Start with an initial prompt template.
2
Generate Variations
Use a teacher LLM to create diverse rewrites of the prompt.
3
Evaluate All Variations
Score each new prompt against the evaluation dataset.
4
Select Best
Choose the prompt with the highest overall score.
Underlying Research
Random search is a foundational technique in hyperparameter tuning, valued for its simplicity and effectiveness in outperforming grid search.- Baseline Strength: Research like “Random Sampling as a Strong Baseline for Prompt Optimisation” shows that even simple random sampling can be highly competitive.
- Broad Applicability: It is often used as a starting point in prompt optimization toolkits and is highlighted in surveys for its ability to avoid local optima in discrete prompt spaces.