TL;DR
MeEvo is a novel Automatic Heuristic Design (AHD) framework that cyclically alternates between code-level Natural Evolution and reflection-driven Metacognitive Evolution. By combining population-driven exploration with strategic knowledge retention, MeEvo delivers state-of-the-art optimization performance and significantly lower variance, particularly on complex, heavily constrained tasks.
What Problem Does This Paper Address?
Designing optimization heuristics—rules of thumb that efficiently solve complex real-world problems like logistics or network routing—traditionally requires deep domain expertise and manual trial-and-error. Large Language Models (LLMs) have recently automated this via Automatic Heuristic Design (AHD) by generating executable code alongside natural language "reasoning traces" explaining their design choices.
However, existing LLM-based AHD frameworks are split into two isolated paradigms:
- Natural Evolution (NE): Frameworks like FunSearch and ReEvo apply crossover and mutation directly to the heuristic code. While great at exploring diverse strategies, they discard the LLM's reasoning traces between generations, losing the strategic knowledge behind why a piece of code worked.
- Metacognitive Evolution (ME): Frameworks like MeLA evolve the reasoning traces themselves through self-reflection. While excellent at accumulating design knowledge, they lack population-level diversity, limiting their ability to discover entirely new algorithmic strategies.
This paper addresses this gap by introducing MeEvo, a framework that treats code and reasoning as equal, alternating partners to prevent strategic knowledge loss while maintaining high population diversity.
Methods
MeEvo introduces a Cyclic Alternation Architecture that coordinates two distinct evolutionary processes through a shared history repository containing reasoning traces, fitness values, execution errors, and the best-found heuristic.
The optimization loop alternates between two phases:
- Natural Evolution Phase ($N$ rounds): The LLM acts as an evolutionary operator executing population-driven crossover and mutation directly on the heuristic code. MeEvo introduces a hierarchical operator balance where the crossover-to-mutation ratio adapts autonomously over time. Early in the search, crossover dominates to maximize exploration; later, mutation takes over to focus on local exploitation and refinement.
- Metacognitive Evolution Phase ($M$ rounds): The LLM steps back to reflect on the shared history. It generates structured Meta Insights consisting of a Convergence Diagnosis (identifying stagnation or steady improvement), a Limitation Analysis (uncovering cognitive biases), and a Pathway Recommendation (suggesting specific algorithmic techniques). An insight-mapping LLM then translates these strategic insights into high-quality code variants that seed the next Natural Evolution cycle.
Datasets
MeEvo was evaluated across five diverse optimization problems using two open-source LLM backbones (DeepSeek-V4-Flash and MIMO-v2.5-Pro):
- TSP-ACO & BPP-ACO: Downstream-solver benchmarks where the LLM generates a heuristic matrix to guide Ant Colony Optimization for the Traveling Salesperson and Bin Packing problems.
- Adaptive Curriculum Sequencing (ACS): A real-world constrained problem using the OULAD dataset (120 materials, 20 concepts, 30 students) to generate personalized learning paths.
- Wireless Sensor Network (WSN) Deployment: A real-world continuous optimization problem focused on positioning and powering 50 convergence nodes to cover 200 sensing nodes under strict signal and capacity constraints.
- TSP-Construct: A pure constructive-heuristic benchmark where the LLM builds a TSP tour from scratch without a downstream solver.
Key Insights and Ideas
- Reasoning as an Immutable Asset: Reasoning traces shouldn't be treated as ephemeral byproducts of code generation. Preserving them independently allows the framework to pass strategic design logic across generations, preventing the "forgetting" behavior common in standard genetic algorithms.
- The Necessity of Cyclic Alternation: Parallel co-evolution fails here because the two processes have incompatible operational requirements. Natural Evolution requires a stable parent pool to perform reliable crossovers, while Metacognitive Evolution needs multi-generational history to distill genuine strategic patterns from noise. Alternating them sequentially satisfies both needs.
- Semantic Exploration-Exploitation Balance: Instead of relying on complex external rule engines to manage the search, MeEvo achieves macro-level balance purely through its cyclic rhythm and a simple, autonomous linear shift from crossover to mutation within the code space.
Key Results
MeEvo consistently achieved the best mean performance across all five optimization problems on both LLM backbones:
- On the heavily constrained ACS and WSN tasks, MeEvo significantly outperformed the next-best architecture (MeLA), reducing final objective values while demonstrating exceptionally smooth convergence curves and lower standard deviations ($\pm 5.21$ on ACS, $\pm 0.76$ on WSN).
- Traditional metaheuristic baselines (like GA, PSO, and Sand Cat Swarm Optimization) struggled heavily on the constrained tasks, even when given substantially larger computational budgets.
- Heuristics generated by MeEvo demonstrated robust scale generalization and reproducibility. For instance, a heuristic optimized on a 50-city TSP generalized effectively when evaluated on 100-city instances, outperforming deep reinforcement learning approaches (like POMO) which tend to collapse under distribution shifts.
Limitations and Future Work
The authors note three primary areas for improvement:
- Computational Cost: MeEvo utilizes multiple distinct LLM call types (crossover, mutation, reflection, error correction), making it token-heavy. Future work will explore more cost-efficient prompting strategies.
- Single-Objective Focus: The current framework is tailored strictly for single-objective optimization; extending it to multi-objective scenarios remains an open challenge.
- Static Operator Shift: The transition from exploration to exploitation relies on a predefined linear schedule. Developing an adaptive mechanism that responds dynamically to real-time convergence behavior could further boost search efficiency.
Summary updated