Overview
The evaluator is a Python module that defines anevaluate() function. SkyDiscover calls this function with the path to each generated program and uses the returned metrics to guide evolution.
Basic Structure
evaluator.py
The
combined_score key is required and must be a float. Higher values indicate better solutions.Complete Example: Circle Packing
Here’s a real evaluator from the benchmarks:evaluator.py
Evaluator Best Practices
1. Handle Errors Gracefully
Don’t raise exceptions:2. Use Timeouts
Prevent infinite loops or slow programs:3. Validate Outputs
Check for NaN, inf, negative values, wrong shapes:4. Normalize Scores
Keepcombined_score in a reasonable range (e.g., 0.0 to 1.0):
Multi-Stage Evaluation (Cascade)
Speed up evaluation by implementing staged checks:evaluator.py
config.yaml
How Cascade Evaluation Works
How Cascade Evaluation Works
- SkyDiscover calls
evaluate_stage1()first - If
combined_score < 0.3, program is rejected (no stage 2) - If
0.3 ≤ combined_score < 0.6, callsevaluate_stage2() - If
combined_score ≥ 0.6, keeps stage 1 result (assumes valid)
LLM-as-a-Judge
Add qualitative feedback using an LLM judge:config.yaml
llm_* metrics to your evaluator’s output:
Prompt Optimization Evaluators
For prompt evolution tasks, the evaluator receives a.txt file:
evaluator.py
language: text in your config:
config.yaml
Metric Guidelines
Required. Overall quality metric. Higher is better. Used for ranking programs.
Binary 0.0/1.0 or continuous validity score. Helps identify constraint violations.
Error message if evaluation failed. Helps debug generated programs.
Evaluation time in seconds. Useful for performance analysis.
Task-specific metrics (accuracy, loss, reward, etc.). Logged for analysis.
Testing Your Evaluator
Test locally before running full discovery:test_evaluator.py
Common Patterns
Unit Tests
Unit Tests
Optimization Benchmarks
Optimization Benchmarks
RL Environments
RL Environments
Next Steps
Configuration
Configure evaluator timeouts and cascade settings
Benchmarks
See real evaluators from 200+ benchmark tasks