Skip to content

Add option to checkpoint only when improvement is detected #434

@lesshaste

Description

@lesshaste

Currently, checkpoints are saved based on checkpoint_interval (e.g., every 10 iterations), regardless of whether any improvement was made. This can be wasteful when the optimization is making slow progress.

Feature Request:

Add a configuration option checkpoint_on_improvement: bool that when set to True, only saves a checkpoint when a new best solution is found, rather than at fixed intervals.

Possible Implementation:

  1. Config: Add checkpoint_on_improvement: bool = False to Config class in openevolve/config.py
  2. Logic: Modify checkpoint trigger in openevolve/process_parallel.py (around line 667):
  • If checkpoint_on_improvement is True, checkpoint only when database.best_program_id == child_program.id (improvement detected)
  • If False, use existing interval-based logic

Example use case:

  • Only save checkpoint when a new best is found
    checkpoint_on_improvement: true
  • checkpoint_interval is ignored when above is true

This is especially useful when:

  • Users only care about capturing improvements, not every N iterations
  • Long-running jobs where disk space is a concern

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions