Skip to main content
Phase 5 introduces the EvolutionEngine, the core automated optimization layer of EMEP. In this phase, you implement genetic algorithms that treat merged model configurations as genomes, evolve populations of candidates through mutation and crossover, and select superior individuals using NSGA-II multi-objective optimization (Deb et al. 2002). The EvolutionEngine operates on top of the MergeEngine and EvaluationEngine from earlier phases, creating a closed loop where better merges are discovered automatically rather than manually tuned.

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:

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:
  1. EvolutionEngine: A fully operational engine that runs genetic algorithms over model merge spaces
  2. Genome specification: A schema encoding merge type, layer masks, scaling coefficients, and model IDs into a genetic representation
  3. Population manager: Controls population size, elitism, diversity preservation, and archival of pareto fronts
  4. Mutation operators: Point mutation, layer-wise mutation, and hyperparameter perturbation with validity checks
  5. Crossover operators: Single-point, uniform, and layer-aligned crossover for combining parent genomes
  6. Selection strategy: NSGA-II implementation (Deb et al. 2002) for non-dominated sorting and crowding distance
  7. Termination logic: Configurable termination on generation count, fitness stagnation, or time budget exhaustion
  8. 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

Position in Roadmap

Phase 5 sits at the center of the EMEP roadmap, bridging merge execution with automated discovery. It consumes the infrastructure built in Phases 0 through 4 and feeds optimized models into Phase 6 for quantization and deployment.