Repository navigation
Fix cascade failure scoring, evaluation gates, and negative-fitness ranking - #629
Open
eliseorobles wants to merge 1 commit into
Conversation
|
|
This was referenced Nov 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR hardens evaluation gating, cascade failure handling, database fitness ranking on negative-score tasks,
evaluator_argsforwarding in cascade mode, and LLM feedback failure guards so failed or timed-out candidates cannot outscore valid solutions or skew search behavior.Root Causes & Changes
Cascade Stage-2/3 failures & timeouts retained preliminary
combined_scoreand dropped"error"(openevolve/evaluator.py)evaluate_stage1passed with a preliminarycombined_score(e.g. a 1-trial smoke check) andevaluate_stage2orevaluate_stage3timed out or raised an exception,_cascade_evaluatemutatedstage1_eval_resultin place to setstage2_passed = 0.0(orstage3_passed = 0.0) while leaving Stage 1'scombined_scoreintact and omitting"error".{"error": "All trials failed"}or{"combined_score": 0.0, "error": "..."}), stage metric merging stripped"error"(name != "error") and preserved stalecombined_scorewhen omitted by the failing stage._cascade_evaluatealso indexedself.config.cascade_thresholds[0]without guarding an emptycascade_thresholdslist.EvaluationResulton Stage-2/3 timeout or exception with"error": 0.0,stage*_passed = 0.0, and neutralizedcombined_score(0.0on non-negative fitness scales,-infwhen prior stage fitness is negative); preserve failure"error"indicators across cascade merges while keeping numericerror: 0.0filtering intact when stages succeed; guard emptycascade_thresholds.Failed/timed-out evaluations outranked valid negative-score solutions and could trigger
target_score(openevolve/utils/metrics_utils.py,openevolve/database.py,openevolve/process_parallel.py)-MSE), failed evaluations carrying{"combined_score": 0.0, "error": "..."}or{"error": 0.0, "timeout": True}evaluated to0.0, allowing failed candidates to beat valid solutions inProgramDatabase._is_better,get_best_program,get_top_programs,_update_archive, worker island prompt ranking, andtarget_scoreearly exit.is_failed_evaluation()inmetrics_utils.pyand rank valid finite evaluations ahead of failed/timed-out evaluations inProgramDatabaseand worker prompt context sorting, while skipping failed/stage-failed evaluations inProcessParallelControllertarget_scoreandearly_stoppingchecks.Cascade mode ignored
evaluator.evaluator_argsand re-executedevaluation_fileon every candidate (openevolve/evaluator.py)_cascade_evaluatere-ranspec.loader.exec_module(module)on every candidate evaluation (resetting module-level caches/clients) and invokedevaluate_stage1/2/3(program_path)without forwardingconfig.evaluator.evaluator_args.evaluation_moduleacross evaluations (reloading automatically ifevaluation_filechanges on disk) and resolve/forwardevaluator_argsacrossevaluate_stage1/2/3(supporting mixed signatures such as a 1-argevaluate_stage1smoke check paired with parameterizedevaluate_stage2/3, while rejecting unaccepted or colliding keys at startup).Cascade
_passes_threshold, workerEvaluator, and customearly_stopping_metricfallback ignoredfeature_dimensions(openevolve/evaluator.py,openevolve/process_parallel.py)combined_scorewas absent,_passes_thresholdaveraged all numeric metrics including MAP-Elitesfeature_dimensions(such asprompt_lengthorcomplexity), and_passes_thresholdfell through to other metrics whencombined_scorewasFalse/None/non-numeric. WorkerEvaluatorinstances (database=None) also received nofeature_dimensions, and missing customearly_stopping_metricfell back tosafe_numeric_averageinstead ofget_fitness_score._serialize_configalso clearedconfig.database.novelty_llm = Nonein place without restoring it on the caller'sConfig, andearly_stopping_patience == 0logged patience mode while executing event-based mode.return Falsefor non-numeric/booleancombined_scorein_passes_threshold, excludefeature_dimensionsfrom fallback threshold averaging, passfeature_dimensionsto workerEvaluatorinstances, useget_fitness_scorefor missingearly_stopping_metric, restoreconfig.database.novelty_llmin_serialize_config, and align theearly_stopping_patience <= 0log message.use_llm_feedback=Trueinflated failed/timed-out evaluations (openevolve/evaluator.py)evaluate_programstill queried the LLM judge and blended0.0 * 0.7 + llm_average * 0.3intocombined_score(or added positivellm_*fallback metrics)._llm_evaluatewhenis_failed_evaluation(eval_result.metrics)isTrue, keeping the0.7 / 0.3blend unchanged for valid evaluations.Testing
tests/test_evaluation_gate_integrity.pycovering Stage-2/3 timeouts, exceptions, graceful failure dicts, negative-scale minimization ranking, cached module reuse + reload-on-change, cascadeevaluator_argsforwarding/validation, MAP-Elitesfeature_dimensionsexclusion in_passes_thresholdand worker evaluators, LLM feedback skipping on failures,target_score/early_stoppingguards, and_serialize_confignovelty_llmrestoration.isort --check-only,black --check,unittest, and the unit test suite (pytest tests --ignore=tests/integration).