Skip to content

Commit b64befa

Browse files
committed
add system_message to llm_feedback evaluator
1 parent 153f5a7 commit b64befa

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Configuration for circle packing constructor evolution (n=26)
2+
max_iterations: 100 # Increased iterations
3+
checkpoint_interval: 10
4+
log_level: "INFO"
5+
6+
# LLM configuration
7+
llm:
8+
primary_model: "google/gemini-2.0-flash-001"
9+
# primary_model: "llama3.1-8b"
10+
primary_model_weight: 0.8
11+
secondary_model: "anthropic/claude-3.7-sonnet"
12+
# secondary_model: "llama-4-scout-17b-16e-instruct"
13+
secondary_model_weight: 0.2
14+
api_base: "https://openrouter.ai/api/v1"
15+
# api_base: "https://api.cerebras.ai/v1"
16+
temperature: 0.7
17+
top_p: 0.95
18+
max_tokens: 8192
19+
timeout: 600
20+
21+
# Prompt configuration
22+
prompt:
23+
system_message: |
24+
You are an expert mathematician specializing in circle packing problems and computational geometry. Your task is to improve a constructor function that directly produces a specific arrangement of 26 circles in a unit square, maximizing the sum of their radii. The AlphaEvolve paper achieved a sum of 2.635 for n=26.
25+
26+
Key geometric insights:
27+
- Circle packings often follow hexagonal patterns in the densest regions
28+
- Maximum density for infinite circle packing is pi/(2*sqrt(3)) ≈ 0.9069
29+
- Edge effects make square container packing harder than infinite packing
30+
- Circles can be placed in layers or shells when confined to a square
31+
- Similar radius circles often form regular patterns, while varied radii allow better space utilization
32+
- Perfect symmetry may not yield the optimal packing due to edge effects
33+
34+
Focus on designing an explicit constructor that places each circle in a specific position, rather than an iterative search algorithm.
35+
num_top_programs: 3
36+
use_template_stochasticity: true
37+
38+
# Database configuration
39+
database:
40+
population_size: 60 # Increased population for more diversity
41+
archive_size: 25
42+
num_islands: 4
43+
elite_selection_ratio: 0.3
44+
exploitation_ratio: 0.7
45+
46+
# Evaluator configuration
47+
evaluator:
48+
timeout: 60
49+
cascade_evaluation: true
50+
cascade_thresholds: [0.5, 0.75]
51+
parallel_evaluations: 4
52+
use_llm_feedback: true
53+
system_message: |
54+
You are an expert mathematician specializing in circle packing problems and computational geometry. Your task is to be an expert evaluator of a solution to the circle packing problem.
55+
You will be given a solution to the circle packing problem and you will need to evaluate it based on the following criteria:
56+
- The solution is a valid circle packing of 26 circles in a unit square.
57+
58+
59+
# Evolution settings
60+
diff_based_evolution: false # Use full rewrites instead of diffs
61+
allow_full_rewrites: true # Allow full rewrites for constructor functions

openevolve/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class EvaluatorConfig:
104104
# LLM-based feedback
105105
use_llm_feedback: bool = False
106106
llm_feedback_weight: float = 0.1
107+
system_message: Optional[str] = None
107108

108109

109110
@dataclass

openevolve/evaluator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ async def _llm_evaluate(self, program_code: str) -> Dict[str, float]:
293293
"""
294294

295295
# Get LLM response
296-
response = await self.llm_ensemble.generate(prompt)
296+
response = await self.llm_ensemble.generate_with_context(
297+
system_message=self.config.system_message,
298+
messages=[{"role": "user", "content": prompt}],
299+
)
297300

298301
# Extract JSON from response
299302
try:

0 commit comments

Comments
 (0)