feat(synthesis): GenomicNG — Nevergrad grammatical-evolution backend#401
Merged
Conversation
This was referenced Jun 19, 2026
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>
1628675 to
0014e0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
GrammaticalEvolutionRepresentationalready decodes. Nevergrad optimizes that integer vector; each genome is decoded into an AeonTermby the existing GE mapper and scored by the existingvalidate+@minimizefitness. 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, PSOAll four route through one class differing only by optimizer name, so adding more is a one-line case.
Behaviour
GESynthesizer).problem.is_solvedholds, instead of burning the rest of the budget.nevergradis an optionalsynthesis-ngextra, 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.pycompares 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 passeduvx ruff checkclean; pre-commit (incl. mypy) passesexamples/synthesis/{dummy,multiobjective}.aewith-s ngand-s ng_cma🤖 Generated with Claude Code