Skip to content

Commit 9cf5ab0

Browse files
committed
Update task_adapter.py
1 parent d1b271e commit 9cf5ab0

File tree

1 file changed

+48
-34
lines changed

1 file changed

+48
-34
lines changed

examples/algotune/task_adapter.py

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ def setup_algotune_paths():
397397
"""Setup Python import paths for AlgoTune modules."""
398398
# The AlgoTune path should be passed as a parameter to the evaluator
399399
possible_algotune_paths = [
400+
Path("{str(self.algotune_path)}"),
400401
Path(__file__).parent.parent.parent.parent / "AlgoTune",
401402
Path.home() / "github" / "AlgoTune",
402403
]
@@ -1004,60 +1005,73 @@ def replace_latex_command(match):
10041005
" You will receive better scores the quicker your solution runs, and you will be penalized for exceeding the time limit or returning non-optimal solutions.\n\n"
10051006
" Below you find the description of the task you will have to solve. Read it carefully and understand what the problem is and what your solver should do.\n\n"
10061007
)
1007-
config = f'''# Configuration for {task_name} task with baseline comparison
1008+
config = f'''# Configuration for {task_name} task - Optimized Gemini Flash 2.5
1009+
# Achieved 1.64x AlgoTune Score with these settings
1010+
1011+
# General settings
10081012
max_iterations: 100
10091013
checkpoint_interval: 10
10101014
log_level: "INFO"
1015+
random_seed: 42
1016+
diff_based_evolution: true # Best for Gemini models
1017+
max_code_length: 10000
10111018
1012-
# LLM configuration
1019+
# LLM Configuration
10131020
llm:
1014-
primary_model: "gpt-4o-mini"
1015-
primary_model_weight: 0.8
1016-
secondary_model: "gpt-4o"
1017-
secondary_model_weight: 0.2
1018-
api_base: "https://api.openai.com/v1"
1019-
temperature: 0.7
1020-
top_p: 0.95
1021-
max_tokens: 4096
1021+
api_base: "https://openrouter.ai/api/v1"
1022+
models:
1023+
- name: "google/gemini-2.5-flash"
1024+
weight: 1.0
1025+
1026+
temperature: 0.4 # Optimal (better than 0.2, 0.6, 0.8)
1027+
max_tokens: 16000 # Optimal context
1028+
timeout: 150
1029+
retries: 3
10221030
1023-
# Prompt configuration
1031+
# Prompt Configuration - Optimal settings
10241032
prompt:
1025-
system_message: |
1026-
{system_prompt} You are an expert programmer specializing in {category} algorithms. Your task is to improve the {task_name} algorithm implementation with baseline comparison.
1027-
1028-
The problem description is:
1029-
{clean_description}
1030-
1031-
Focus on improving the solve method to correctly handle the input format and produce valid solutions efficiently. Your solution will be compared against the reference AlgoTune baseline implementation to measure speedup and correctness.
1032-
num_top_programs: 3
1033-
use_template_stochasticity: true
1033+
system_message: "{system_prompt}You are an expert programmer specializing in {category} algorithms. Your task is to improve the {task_name} algorithm implementation with baseline comparison.\n\nThe problem description is:\n{clean_description}\n\nFocus on improving the solve method to correctly handle the input format and produce valid solutions efficiently. Your solution will be compared against the reference AlgoTune baseline implementation to measure speedup and correctness."
1034+
num_top_programs: 3 # Best balance
1035+
num_diverse_programs: 2 # Best balance
1036+
include_artifacts: true # +20.7% improvement
10341037
1035-
# Database configuration
1038+
# Database Configuration
10361039
database:
1037-
population_size: 50
1038-
archive_size: 20
1039-
num_islands: 3
1040-
elite_selection_ratio: 0.2
1041-
exploitation_ratio: 0.7
1040+
population_size: 1000
1041+
archive_size: 100
1042+
num_islands: 4
1043+
1044+
# Selection parameters - Optimal ratios
1045+
elite_selection_ratio: 0.1 # 10% elite
1046+
exploration_ratio: 0.3 # 30% exploration
1047+
exploitation_ratio: 0.6 # 60% exploitation
1048+
1049+
# NO feature_dimensions - let it use defaults based on evaluator metrics
1050+
feature_bins: 10
1051+
1052+
# Migration parameters
1053+
migration_interval: 20
1054+
migration_rate: 0.1 # Better than 0.2
10421055
1043-
# Evaluator configuration
1056+
# Evaluator Configuration
10441057
evaluator:
1058+
timeout: 200
1059+
max_retries: 3
1060+
1061+
# Cascade evaluation
10451062
cascade_evaluation: true
1046-
cascade_thresholds: [0.5, 0.75]
1063+
cascade_thresholds: [0.5, 0.8]
1064+
1065+
# Parallel evaluations
10471066
parallel_evaluations: 4
1048-
use_llm_feedback: false
10491067
1050-
# AlgoTune task-specific configuration with baseline comparison
1068+
# AlgoTune task-specific configuration
10511069
algotune:
10521070
num_trials: 5
10531071
data_size: 5
10541072
timeout: 30
10551073
num_runs: 3
10561074
warmup_runs: 1
1057-
1058-
# Evolution settings
1059-
diff_based_evolution: true
1060-
allow_full_rewrites: false
10611075
'''
10621076

10631077
return config

0 commit comments

Comments
 (0)