Skip to content

Commit 4714754

Browse files
committed
Prevent repeated migration of programs between islands
Adds a check to avoid re-migrating already migrated programs in the ProgramDatabase migration logic. This prevents exponential duplication of identical programs, conserves computational resources, and maintains diversity in the MAP-Elites + Island hybrid architecture. Also updates config.yaml to adjust LLM temperature and selection ratios for improved optimization.
1 parent 32158b7 commit 4714754

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

examples/llm_prompt_optimization/config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ llm:
1616
- name: "gemini-2.5-flash-lite" # Using Gemini 2.5 Flash Lite
1717
weight: 1.0
1818

19-
temperature: 0.8 # Optimal from experiments
19+
temperature: 0.4 # Optimal from experiments
2020
max_tokens: 16000 # Optimal context
2121
timeout: 150
2222
retries: 3
@@ -53,8 +53,8 @@ database:
5353

5454
# Selection parameters - Optimal ratios from testing
5555
elite_selection_ratio: 0.1 # 10% elite selection
56-
exploration_ratio: 0.5 # 30% exploration
57-
exploitation_ratio: 0.4 # 60% exploitation
56+
exploration_ratio: 0.3 # 30% exploration
57+
exploitation_ratio: 0.6 # 60% exploitation
5858

5959
# Migration parameters - Optimal settings
6060
migration_interval: 10

openevolve/database.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,26 @@ def migrate_programs(self) -> None:
13471347
target_islands = [(i + 1) % len(self.islands), (i - 1) % len(self.islands)]
13481348

13491349
for migrant in migrants:
1350+
# Prevent re-migration of already migrated programs to avoid exponential duplication.
1351+
# Analysis of actual evolution runs shows this causes severe issues:
1352+
# - Program cb5d07f2 had 183 descendant copies by iteration 850
1353+
# - Program 5645fbd2 had 31 descendant copies
1354+
# - IDs grow exponentially: program_migrant_2_migrant_3_migrant_4_migrant_0...
1355+
#
1356+
# This is particularly problematic for OpenEvolve's MAP-Elites + Island hybrid architecture:
1357+
# 1. All copies have identical code → same complexity/diversity/performance scores
1358+
# 2. They all map to the SAME MAP-Elites cell → only 1 survives, rest discarded
1359+
# 3. Wastes computation evaluating hundreds of identical programs
1360+
# 4. Reduces actual diversity as islands fill with duplicates
1361+
#
1362+
# By preventing already-migrated programs from migrating again, we ensure:
1363+
# - Each program migrates at most once per lineage
1364+
# - True diversity is maintained between islands
1365+
# - Computational resources aren't wasted on duplicates
1366+
# - Aligns with MAP-Elites' one-program-per-cell principle
1367+
if migrant.metadata.get("migrant", False):
1368+
continue
1369+
13501370
for target_island in target_islands:
13511371
# Create a copy for migration (to avoid removing from source)
13521372
migrant_copy = Program(

0 commit comments

Comments
 (0)