galapagos
DocsHubLeaderboardPlaygroundNews
galapagos

six blocks · any task ·
better solutions emerge.

Platform

  • Hub
  • Leaderboard
  • Playground

Resources

  • Docs
  • API reference
  • Card spec

Community

  • GitHub
  • Contribute

Updates

  • News
  • Releases

© 2026 Galapagos. Licensed under Apache-2.0.

Build your own scaffold.

Hub/Scaffolds/SkyDiscover/AdaEvolve

SkyDiscover/adaevolve

AdaEvolve

Hierarchical adaptive search: G-signal exploration intensity, UCB island allocation, and LLM meta-guidance on stagnation.

Test-time searchApache-2.0
Scaffold cardFiles and versions
adaevolve/proposer.py
41 lines · 2.2 KBpythonDownload
"""AdaEvolve Proposer component — the SEARCH/REPLACE diff (with full-rewrite fallback) operator.

One file per component (see scaffold.py). AdaEvolve mutates with ``diff_based_generation`` +
``allow_full_rewrites``: one LLM call → SEARCH/REPLACE diffs applied to the parent (upstream
``extract_diffs``/``apply_diff``), falling back to a full rewrite (``parse_full_rewrite``) —
exactly what the shared :class:`~galapagos.components.proposer.DiffProposer` implements. Cost is
recorded via ``env.state.record_cost`` and the child sets ``metadata["changed"]`` (no-op
detection), both inherited.

The one AdaEvolve-specific addition: the child is stamped with the CURRENT sampling island
(``state.signals["adaevolve"]["island"]``, published by the policy's ``select``), mirroring the
upstream ``add()`` routing to ``current_island``. ``Genome.child`` copies the parent's metadata
wholesale, so without the stamp a paradigm-overridden parent (the global best, possibly archived
on another island) would misroute its children; stamping here also avoids mutating archived
parents' metadata in ``select``. Migrants and spawn seeds keep their explicitly stamped island
(they never pass through ``propose``).
"""
from __future__ import annotations

from ...components.proposer import DiffProposer, Env
from ...records import Genome


class AdaEvolveProposer(DiffProposer):
    """SEARCH/REPLACE diff with full-rewrite fallback + mandatory no-op detection. Children are
    routed to the CURRENT island via ``metadata["island"]`` (see module docstring).

    Upstream ``_execute_generation`` applies a parsed diff by WHOLE-LINE matching
    (``extract_diffs``/``apply_diff``) and falls back to ``parse_full_rewrite`` when no block parses
    — so whole-line + fallback are both on (vs the base substring ``apply_edit``)."""

    diff_wholeline = True
    diff_wholeline_fallback = True

    def propose(self, prompt, env: Env) -> Genome:
        child = super().propose(prompt, env)
        sig = (env.state.signals.get("adaevolve", {}) if env.state is not None else {}) or {}
        island = sig.get("island")
        if isinstance(island, int):
            child.metadata["island"] = island
        return child