Skip to content

feat(synthesis): GenomicNG — Nevergrad grammatical-evolution backend#401

Merged
alcides merged 1 commit into
masterfrom
claude/genomic-ng-synthesizer
Jun 20, 2026
Merged

feat(synthesis): GenomicNG — Nevergrad grammatical-evolution backend#401
alcides merged 1 commit into
masterfrom
claude/genomic-ng-synthesizer

Conversation

@alcides

@alcides alcides commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Adds GenomicNG, a synthesis backend that drives Aeon's grammar-guided synthesis with Nevergrad derivative-free optimizers.

A derivation is encoded as a fixed-length integer codon genome — exactly the representation geneticengine's GrammaticalEvolutionRepresentation already decodes. Nevergrad optimizes that integer vector; each genome is decoded into an Aeon Term by the existing GE mapper and scored by the existing validate + @minimize fitness. So the entire synthesis stack (grammar generation, phenotype decoding, fitness) is reused — only the search strategy changes.

Flags

  • -s ng / -s genomic_ng — NGOpt (Nevergrad's recommended meta-optimizer; default)
  • -s ng_cma, -s ng_de, -s ng_pso — CMA-ES, Differential Evolution, PSO

All four route through one class differing only by optimizer name, so adding more is a one-line case.

Behaviour

  • Single- and multi-objective goals. Multi-objective resolves the Pareto archive by knee-point compromise selection (mirrors GESynthesizer).
  • Robust to the ill-typed/un-evaluable candidates a black-box search constantly proposes: they are penalised, not fatal.
  • Early-stops once problem.is_solved holds, instead of burning the rest of the budget.
  • nevergrad is an optional synthesis-ng extra, imported lazily — the default install is unchanged.

Tests

tests/genomic_ng_test.py (15 tests): objective re-orientation, knee-point selection, factory routing for all 5 flags, and end-to-end single/multi-objective + alternative-optimizer synthesis.

Benchmark

scripts/bench_genomic_ng.py compares GenomicNG against GP. On a 10-example, validate-heavy suite GP wins decisively (8/10 solved vs 4/10) — the expected result, since grammar-guided tree search beats flat-vector black-box optimization for finding valid typed programs, especially on validate-only goals with no fitness gradient. GenomicNG's value is on problems with a strong continuous objective and high valid-candidate density.

Test plan

  • uv run pytest tests/genomic_ng_test.py — 15 passed
  • uvx ruff check clean; pre-commit (incl. mypy) passes
  • End-to-end runs on examples/synthesis/{dummy,multiobjective}.ae with -s ng and -s ng_cma

🤖 Generated with Claude Code

Adds a grammatical-evolution synthesis backend driven by Nevergrad. A
derivation is encoded as a fixed-length integer codon genome (reusing
geneticengine's GrammaticalEvolutionRepresentation decoder) which Nevergrad
optimises with any of its derivative-free algorithms; candidates are scored by
the existing validate + @minimize fitness, so the whole Aeon synthesis stack is
reused and only the search strategy changes.

- New flags: -s ng / genomic_ng (NGOpt, the recommended default), ng_cma,
  ng_de, ng_pso.
- Single- and multi-objective goals supported; multi-objective resolves the
  Pareto archive by knee-point compromise selection.
- Robust to ill-typed/un-evaluable candidates (penalised, not fatal) and
  early-stops once the goal is solved.
- nevergrad is an optional 'synthesis-ng' extra, imported lazily, so the
  default install is unchanged.
- Unit tests for orientation, knee-point selection, factory routing, and
  end-to-end single/multi-objective synthesis.
- scripts/bench_genomic_ng.py compares GenomicNG against the GP backend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alcides alcides force-pushed the claude/genomic-ng-synthesizer branch from 1628675 to 0014e0e Compare June 20, 2026 09:24
@alcides alcides merged commit 23ec346 into master Jun 20, 2026
9 checks passed
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.

1 participant