Skip to content

feat: add alternating competitive evolution with phase checkpoints - #505

Merged
codelion merged 2 commits into
algorithmicsuperintelligence:mainfrom
galleonli:feat/competitive-coevolution
Oct 10, 2026
Merged

codelion merged 2 commits into
algorithmicsuperintelligence:mainfrom
galleonli:feat/competitive-coevolution

Conversation

@galleonli

Copy link
Copy Markdown
Contributor

Addresses #311 and the request for a comparison example.

An opponent change also changes fitness: keeping the previous scores can make a population select a program that no longer performs well. This adds run_coevolution, which alternates two independently configured OpenEvolve engines. Each phase freezes a cohort of opposing champions, re-evaluates the active population and rebuilds its selection state before generating new programs.

The coordinator keeps the two program populations separate, retains internal island scheduling and lineage, and commits both population state and the completed-phase cursor together. Resume checks the evaluator/task identity, configurations, seeds and phase settings. A failed phase restarts against the same committed opponent cohort; external calls may repeat. The bounded opponent history contains recent distinct champions. Existing single-population APIs are unchanged.

The executable CPU example evolves an attack policy and a defender's inspection allocation over three channels. It uses the real APIs and process workers with a local scripted proposal endpoint, not an LLM. It compares competition with the existing engine against fixed opponents, using both equal proposal counts and a larger static-baseline match budget. Counts include refreshes and every cross-match.

For final-version seeds 0, 1 and 2 in both single-channel and mixed-attacker variants, worst-channel detection was 1/3 with competition versus 0 for both static baselines. Mean detection remained 1/3 throughout. The three single-channel runs used 561/567/579 matches in total; the larger static baselines used 940/955/969. Complete counts, source hashes, commands and the earlier exploratory mixed-attacker no-gain result are included in the example. This is a controlled finite-policy demonstration, not evidence of real LLM quality, unseen-task generalization or Nash convergence.

Validation on macOS arm64 / Python 3.12.3:

  • OPENAI_API_KEY=test-key-for-unit-tests python -m unittest discover -s tests -p 'test_*.py': 588 tests passed, including 14 new tests. These cover score refresh, population isolation, phase failure/resume, context mismatch, stale artifacts, island counters and a real process-worker run.
  • Both comparison commands completed for seeds 0, 1 and 2.
  • Repository pre-commit hooks (isort, black) and git diff --check passed.

Recovery is single-writer and phase-level. Evaluators/programs and their serialized wrappers require the same trust as existing OpenEvolve runs; external effects are not exactly-once. Returned champion scores belong to each population's last opponent cohort. No paid model, GPU, distributed or real-model quality experiment was run.

@CLAassistant

CLAassistant commented Oct 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion merged commit 93c84c7 into algorithmicsuperintelligence:main Oct 10, 2026
4 checks passed
@galleonli
galleonli deleted the feat/competitive-coevolution branch October 10, 2026 13:28
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.

3 participants