Skip to main content
You can create custom optimization problems for SkyDiscover by writing an evaluator and optionally providing a seed program. This guide shows you how.

Minimal Example

Only one file is required: an evaluator. A seed program is optional but recommended.

Step 1: Write the Evaluator

The evaluator scores whatever the LLM produces. It must return a dictionary with combined_score:
Important: Always return {"combined_score": 0.0, "error": "..."} on failure instead of raising an exception. This allows evolution to continue even when candidates fail.

Step 2: Write the Initial Program (Optional)

Provide a starting solution with an EVOLVE-BLOCK marking what to evolve:
The EVOLVE-BLOCK markers tell SkyDiscover what code to evolve. Everything outside the block remains unchanged.

Step 3: Create Config (Optional)

Provide search settings and a system prompt:

Step 4: Run Evolution

If you don’t provide initial_program.py, SkyDiscover will start from scratch.

Complete Example: String Compression

Let’s create a benchmark for evolving string compression algorithms.

Directory Structure

Evaluator

Initial Program

Configuration

Test Data

Create sample test files:

Running

Prompt Optimization Example

You can also optimize natural language prompts instead of code.

Evaluator for Prompts

Initial Prompt

Configuration for Prompts

For prompt optimization: Set language: text and diff_based_generation: false in your config.

Best Practices

Fail Gracefully

Always return {"combined_score": 0.0, "error": "..."} instead of raising exceptions

Validate Solutions

Check correctness before scoring. Invalid solutions should get score 0.0

Use Multiple Tests

Test on diverse inputs to avoid overfitting to a single test case

Normalize Scores

Make scores comparable across runs (e.g., ratio to baseline)

Add Timeouts

Use timeouts for evaluations that might hang

Log Metrics

Return detailed metrics beyond just combined_score for analysis

File Types

Common Patterns

Like circle packing: the program constructs a solution directly.
Like systems benchmarks: optimize a strategy or algorithm.
Like Frontier-CS: solve a computational problem.
Natural language that will be sent to an LLM.

Handling Timeouts

For long-running evaluations, use subprocess with timeout:

Next Steps

Math Examples

See mathematical benchmarks

Systems Examples

See systems benchmarks

Algorithm Examples

See competitive programming
Simple template to copy: Check out benchmarks/math/heilbronn_triangle/ for a minimal, well-structured example.