TL;DR
EvoMem introduces a persistent memory architecture for LLM-driven evolutionary code search, allowing systems to "remember" and reuse successful mutation strategies across different runs and even different tasks. By distilling successful code changes into structured "memory cards," EvoMem achieves an average search speedup of nearly 6x and significant improvements in final program performance across diverse domains like geometry and GPU kernel optimization.
What Problem Does This Paper Address?
Evolutionary program search—where an LLM acts as a "mutation operator" to iteratively improve code—has shown great promise in automating complex optimization tasks. However, current systems suffer from a form of "amnesia": each search run starts from scratch.
This means the system repeatedly rediscovers the same basic tactics (like caching, loop unrolling, or specific reasoning patterns) every time it faces a new problem. This lack of persistent knowledge limits the efficiency of the search and prevents the transfer of insights between related domains. The authors aim to bridge this gap by creating a mechanism that captures, abstracts, and reintroduces successful mutation knowledge into the evolutionary loop.
Methods
The authors present EvoMem, a persistent memory extension built on the GigaEvo framework. It operates in two distinct phases:
- The Write Phase (Offline): After an evolutionary run completes, EvoMem analyzes the "lineage" of successful programs. It extracts mutation events that led to fitness gains and converts them into structured memory cards. These cards include a concise description of the tactic, the task context, and provenance (where the idea came from). To keep the memory bank clean, the system uses a combination of semantic clustering (DBSCAN) and LLM-based deduplication to merge similar ideas.
- The Read Phase (Online): During a new evolutionary run, before the LLM proposes a mutation, the system queries the memory bank. It uses a multi-view retrieval strategy (lexical and embedding-based) to find a small, bounded set of relevant memory cards. These are then injected into the LLM's prompt as "advice" rather than hard constraints.
Datasets
The researchers evaluated EvoMem across four broad categories of tasks:
- Geometric Optimization: Circle Packing (arranging shapes densely), Hexagon Packing, Heilbronn-style point placement, and Kissing Number (high-dimensional sphere configurations).
- Multi-hop Question Answering: Benchmarks like HotpotQA and HoVer, which require integrating multiple facts to reach a conclusion.
- Scientific-Code Tuning: The AlgoTune suite, focusing on speeding up numerical routines like Kalman filters and power control.
- GPU Kernel Optimization: The KernelBench suite, which involves writing efficient low-level kernels while maintaining correctness.
Crucially, for evaluation, the system was tested on "cross-task" transfer: it could only use memories generated from other benchmarks, never from the specific task it was currently trying to solve.
Key Insights and Ideas
- Tactics are Transferable: One of the most significant findings is that high-level optimization strategies (e.g., "use annealed force-directed repulsion") discovered in one domain (like Heilbronn point placement) can successfully guide search in another (like Circle Packing).
- Soft Bias vs. Hard Constraints: By providing memory as "advice" in the prompt, the system maintains the exploratory nature of evolution. The LLM can choose to ignore irrelevant advice, and the evaluator-in-the-loop ensures that only truly successful mutations are retained.
- Relevance is Mandatory: An ablation study showed that "random memory" is almost useless (0.25% acceptance rate). The sophisticated retrieval and filtering mechanism is what makes the system work, achieving a 16x higher idea-acceptance rate than random selection.
- Acceleration and Quality: In many cases, EvoMem doesn't just find better solutions; it finds them much faster. For tasks like the Kissing Number, the final quality was similar to the baseline, but the system reached that quality significantly earlier in the search process.
Key Results
EvoMem demonstrated consistent improvements across the board:
- Performance Gains: The system achieved an average relative gain of 6.40% in target metrics across all benchmarks, with some tasks like KernelBench seeing gains as high as 65%.
- Search Speedup: On average, EvoMem reached the baseline's final best score 5.93x faster.
- Acceptance Rate: In a manual audit, ideas retrieved by EvoMem were incorporated into the final code 9.43% of the time, compared to just 0.69% for random memory.
Limitations and Future Work
The authors acknowledge several areas for improvement:
- Variability: The benefits of memory vary significantly across tasks. In some cases, "negative transfer" or premature convergence remains a risk if the retrieved advice is too rigid or mismatched.
- Scale: The current memory bank is relatively small. Future work could explore scaling this to repository-level evolution, capturing project-specific conventions and recurring bug patterns.
- Hyperparameter Sensitivity: The system relies on several moving parts (clustering epsilons, retrieval weights, LLM temperatures) that may require tuning for different domains.
- Cost: While it speeds up search, the offline "write phase" (extraction and enrichment) adds computational overhead that needs to be balanced against the search-time savings.
Summary updated