Purpose
The purpose of Phase 5 is to replace manual merge strategy selection with an automated evolutionary process. Instead of a human deciding which MergeStrategy to apply, the EvolutionEngine explores a search space of merge configurations, evaluates their fitness, and iteratively improves the population until termination criteria are met. This enables EMEP to discover non-obvious merge combinations that outperform hand-tuned approaches.Entry Criteria
Phase 5 begins when the following entry criteria are satisfied:- Phase 4 (Evaluation + Benchmarking) is complete and the EvaluationEngine produces stable fitness scores
- The MergeEngine supports at least three MergeStrategy implementations
- The BenchmarkEngine can run automated benchmarks without human intervention
- The FitnessEngine defines at least two objective functions for multi-objective optimization
- The ExperimentTracker can log generation-level metrics
Exit Criteria
Phase 5 is complete when all exit criteria are met:- The EvolutionEngine can initialize, evolve, and terminate a population automatically
- Genome encoding represents merge configurations, layer selections, and hyperparameters
- Population management maintains diversity and avoids premature convergence
- Mutation operators modify genomes without breaking model validity
- Crossover operators combine parent genomes into valid offspring
- Selection uses NSGA-II (Deb et al. 2002) to handle multiple conflicting objectives
- Termination conditions include generation limit, fitness plateau, and wall-clock timeout
- The ExperimentTracker records full lineage for every individual
Primary Components
Deliverables
The following deliverables are produced in Phase 5:- EvolutionEngine: A fully operational engine that runs genetic algorithms over model merge spaces
- Genome specification: A schema encoding merge type, layer masks, scaling coefficients, and model IDs into a genetic representation
- Population manager: Controls population size, elitism, diversity preservation, and archival of pareto fronts
- Mutation operators: Point mutation, layer-wise mutation, and hyperparameter perturbation with validity checks
- Crossover operators: Single-point, uniform, and layer-aligned crossover for combining parent genomes
- Selection strategy: NSGA-II implementation (Deb et al. 2002) for non-dominated sorting and crowding distance
- Termination logic: Configurable termination on generation count, fitness stagnation, or time budget exhaustion
- Multi-objective optimization: Support for at least two simultaneous objectives (for example, accuracy and inference latency)
Dependencies
Phase 5 depends on the completion of earlier phases and specific components:- Phase 4: Requires automated evaluation and benchmarking to score individuals
- Phase 3: Requires advanced merge strategies to provide a rich search space
- Phase 2: Requires the basic MergeEngine to execute genome-specified merges
- Phase 1: Requires the ModelRegistry to resolve model references in genomes
- ExperimentTracker: Must support generation-scoped logging and parent-child lineage tracking
Key Tasks
The detailed task breakdown for Phase 5 is maintained in the project task tracker. See Phase 5 Tasks for assigned owners, estimates, and current status.Risks
The primary risks in Phase 5 include premature convergence to local optima, excessive computational cost from large populations, and invalid genomes producing non-loadable models. These risks and their mitigations are documented in the Risk Register.Quality Gate
Before Phase 5 can be marked complete, the following quality gate must pass:- A population of 20 individuals evolves for 10 generations without crashes
- The final pareto front contains at least 3 non-dominated solutions
- At least one evolved candidate outperforms the best manually tuned baseline on the primary objective
- All individuals have complete lineage tracked in the ExperimentTracker
- Termination triggers correctly within 5% of the configured budget