Skip to content

Fix cascade failure scoring, evaluation gates, and negative-fitness ranking - #629

Open
eliseorobles wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
eliseorobles:fix/evaluation-gate-and-cascade-integrity
Open

eliseorobles wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
eliseorobles:fix/evaluation-gate-and-cascade-integrity

Conversation

@eliseorobles

Copy link
Copy Markdown

Summary

This PR hardens evaluation gating, cascade failure handling, database fitness ranking on negative-score tasks, evaluator_args forwarding 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

  1. Cascade Stage-2/3 failures & timeouts retained preliminary combined_score and dropped "error" (openevolve/evaluator.py)

    • When evaluate_stage1 passed with a preliminary combined_score (e.g. a 1-trial smoke check) and evaluate_stage2 or evaluate_stage3 timed out or raised an exception, _cascade_evaluate mutated stage1_eval_result in place to set stage2_passed = 0.0 (or stage3_passed = 0.0) while leaving Stage 1's combined_score intact and omitting "error".
    • When a later stage returned a graceful failure dictionary (e.g. {"error": "All trials failed"} or {"combined_score": 0.0, "error": "..."}), stage metric merging stripped "error" (name != "error") and preserved stale combined_score when omitted by the failing stage.
    • _cascade_evaluate also indexed self.config.cascade_thresholds[0] without guarding an empty cascade_thresholds list.
    • Fix: Return a non-mutating EvaluationResult on Stage-2/3 timeout or exception with "error": 0.0, stage*_passed = 0.0, and neutralized combined_score (0.0 on non-negative fitness scales, -inf when prior stage fitness is negative); preserve failure "error" indicators across cascade merges while keeping numeric error: 0.0 filtering intact when stages succeed; guard empty cascade_thresholds.
  2. 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)

    • On minimization tasks where valid scores are negative (e.g. -MSE), failed evaluations carrying {"combined_score": 0.0, "error": "..."} or {"error": 0.0, "timeout": True} evaluated to 0.0, allowing failed candidates to beat valid solutions in ProgramDatabase._is_better, get_best_program, get_top_programs, _update_archive, worker island prompt ranking, and target_score early exit.
    • Fix: Add is_failed_evaluation() in metrics_utils.py and rank valid finite evaluations ahead of failed/timed-out evaluations in ProgramDatabase and worker prompt context sorting, while skipping failed/stage-failed evaluations in ProcessParallelController target_score and early_stopping checks.
  3. Cascade mode ignored evaluator.evaluator_args and re-executed evaluation_file on every candidate (openevolve/evaluator.py)

    • _cascade_evaluate re-ran spec.loader.exec_module(module) on every candidate evaluation (resetting module-level caches/clients) and invoked evaluate_stage1/2/3(program_path) without forwarding config.evaluator.evaluator_args.
    • Fix: Reuse the loaded evaluation_module across evaluations (reloading automatically if evaluation_file changes on disk) and resolve/forward evaluator_args across evaluate_stage1/2/3 (supporting mixed signatures such as a 1-arg evaluate_stage1 smoke check paired with parameterized evaluate_stage2/3, while rejecting unaccepted or colliding keys at startup).
  4. Cascade _passes_threshold, worker Evaluator, and custom early_stopping_metric fallback ignored feature_dimensions (openevolve/evaluator.py, openevolve/process_parallel.py)

    • When combined_score was absent, _passes_threshold averaged all numeric metrics including MAP-Elites feature_dimensions (such as prompt_length or complexity), and _passes_threshold fell through to other metrics when combined_score was False/None/non-numeric. Worker Evaluator instances (database=None) also received no feature_dimensions, and missing custom early_stopping_metric fell back to safe_numeric_average instead of get_fitness_score.
    • _serialize_config also cleared config.database.novelty_llm = None in place without restoring it on the caller's Config, and early_stopping_patience == 0 logged patience mode while executing event-based mode.
    • Fix: Dedent return False for non-numeric/boolean combined_score in _passes_threshold, exclude feature_dimensions from fallback threshold averaging, pass feature_dimensions to worker Evaluator instances, use get_fitness_score for missing early_stopping_metric, restore config.database.novelty_llm in _serialize_config, and align the early_stopping_patience <= 0 log message.
  5. use_llm_feedback=True inflated failed/timed-out evaluations (openevolve/evaluator.py)

    • When programmatic evaluation failed or timed out, evaluate_program still queried the LLM judge and blended 0.0 * 0.7 + llm_average * 0.3 into combined_score (or added positive llm_* fallback metrics).
    • Fix: Skip _llm_evaluate when is_failed_evaluation(eval_result.metrics) is True, keeping the 0.7 / 0.3 blend unchanged for valid evaluations.

Testing

  • Added tests/test_evaluation_gate_integrity.py covering Stage-2/3 timeouts, exceptions, graceful failure dicts, negative-scale minimization ranking, cached module reuse + reload-on-change, cascade evaluator_args forwarding/validation, MAP-Elites feature_dimensions exclusion in _passes_threshold and worker evaluators, LLM feedback skipping on failures, target_score / early_stopping guards, and _serialize_config novelty_llm restoration.
  • Ran isort --check-only, black --check, unittest, and the unit test suite (pytest tests --ignore=tests/integration).

@CLAassistant

CLAassistant commented Nov 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants