@@ -256,7 +256,9 @@ def sample_template(self) -> PromptTemplate:
256256 templates = list (self .templates .values ())
257257 weights = []
258258 for t in templates :
259- # Score-based weight with exploration bonus for under-used templates
259+ # Exploration bonus for under-used templates: linearly decreases from 0.3 to 0
260+ # as uses increase from 0 to 20. This ensures new templates get enough trials
261+ # before being judged solely on their score.
260262 exploration_bonus = max (0 , 1.0 - t .uses / 20 ) * 0.3
261263 weights .append (self .get_template_score (t ) + exploration_bonus )
262264
@@ -361,6 +363,12 @@ def to_dict(self) -> Dict[str, Any]:
361363 "min_uses_for_evolution" : self .min_uses_for_evolution ,
362364 "elite_fraction" : self .elite_fraction ,
363365 "exploration_rate" : self .exploration_rate ,
366+ # Scoring configuration
367+ "score_weight_success" : self .score_weight_success ,
368+ "score_weight_improvement" : self .score_weight_improvement ,
369+ "score_weight_fitness_delta" : self .score_weight_fitness_delta ,
370+ "score_min_uses" : self .score_min_uses ,
371+ "score_neutral_prior" : self .score_neutral_prior ,
364372 "default_template_id" : self .default_template_id ,
365373 "templates" : {tid : t .to_dict () for tid , t in self .templates .items ()},
366374 }
@@ -373,6 +381,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "PromptArchive":
373381 min_uses_for_evolution = data .get ("min_uses_for_evolution" , 10 ),
374382 elite_fraction = data .get ("elite_fraction" , 0.3 ),
375383 exploration_rate = data .get ("exploration_rate" , 0.2 ),
384+ # Scoring configuration
385+ score_weight_success = data .get ("score_weight_success" , 0.3 ),
386+ score_weight_improvement = data .get ("score_weight_improvement" , 0.4 ),
387+ score_weight_fitness_delta = data .get ("score_weight_fitness_delta" , 0.3 ),
388+ score_min_uses = data .get ("score_min_uses" , 5 ),
389+ score_neutral_prior = data .get ("score_neutral_prior" , 0.5 ),
376390 )
377391 archive .default_template_id = data .get ("default_template_id" )
378392
0 commit comments