TL;DR
When humans solve hard puzzles, we don't reinvent basic logic from scratch every time—we build mental toolkits of reusable concepts. Current evolutionary LLM code-generators lack this memory, treating every problem in isolation. LEAP fixes this by letting LLMs build, prune, and share a global Python library of helper functions across tasks, dramatically boosting abstract reasoning accuracy while cutting token costs.
What Problem Does This Paper Address?
Pair an LLM with an evolutionary algorithm—where the model mutates parent programs into child programs and keeps the fittest—and you can discover remarkable algorithms (think FunSearch or AlphaEvolve). Yet, throw these systems at benchmarks requiring deep, multi-step abstract reasoning like ARC-AGI (visual grid puzzles where rules must be inferred from just a few examples), and they hit a wall.
Why? Because standard LLM evolution suffers from amnesia. It treats a 100-puzzle benchmark as 100 isolated islands, relying on random, low-level code tweaks to inch toward a solution. If the LLM figures out how to "flood-fill a connected region" on Puzzle 1, it has no way to remember and reuse that tool on Puzzle 12. Without consolidating low-level code into high-level building blocks, lineages quickly stagnate in local optima.
Methods
The authors introduce LEAP (Library-driven Evolutionary Abstraction Paradigm), shifting evolutionary search from isolated tasks to a concurrent batch of tasks sharing a dynamic "genetic memory"—a global library of Python helper functions.
While standard evolutionary loops select, mutate, and evaluate individual programs, LEAP adds three novel macro-level mechanisms:
- Global Interface Injection: Stuffing dozens of raw helper functions into a prompt wastes context and confuses the LLM. Instead, LEAP decouples interface from implementation: the prompt only receives compact function signatures and one-line docstrings, while the actual code is pre-loaded silently into the evaluation sandbox.
- MDL-Based Admission: Whenever a program makes a fitness breakthrough, an "Abstraction Engine" analyzes its Abstract Syntax Tree (AST) to extract candidate subroutines (lifting hard-coded variables into parameters). To prevent library bloat, a function is only admitted if it passes a Minimum Description Length (MDL) gate—meaning the total tokens it saves by compressing solutions across the task batch must outweigh the length of the new function itself.
- UCB Routing & Strict Pruning: Which functions get shown to the LLM, and which get deleted? LEAP treats prompt injection like a Multi-Armed Bandit problem, using an Upper Confidence Bound (UCB) score to balance proven winners with under-explored newcomers (showing up to 30 functions per prompt). Meanwhile, a separate Survival Score tracks fitness contribution, usage, and age—permanently evicting deadweight functions at the end of every generation.
Datasets
LEAP is evaluated across two distinct domains (no new benchmarks are introduced):
- ARC-AGI-2: An updated, harder version of the classic visual program synthesis benchmark, consisting of 120 evaluation tasks with $1 \times 1$ to $30 \times 30$ colored grids.
- Mathematical Optimization Benchmarks: Six deceptive, continuous-to-discrete combinatorial geometry and signal problems, including Circle Packing (Square and Rectangle), Heilbronn Triangle and Convex problems, MinMax Distance, and Signal Processing.
Key Insights and Ideas
- Smaller models get the biggest lift: By handing the LLM compact, high-level semantic Lego bricks, LEAP offloads the burden of low-level syntax juggling. This disproportionately rescues smaller models whose limited reasoning capacity normally collapses on long-horizon code synthesis.
- Step-function breakthroughs: Standard evolutionary baselines plateau early on ARC-AGI-2. LEAP exhibits a "staircase" learning curve—periods of search punctuated by sudden upward jumps as newly consolidated library primitives unlock solutions across multiple stagnant tasks at once.
- Abstraction saves money: Sharing compressed interfaces doesn't just make search smarter; it makes prompts shorter and convergence faster, turning cross-task library learning into a major token-saver.
Key Results
- ARC-AGI-2: LEAP outperforms all evaluated evolutionary baselines across every LLM backbone. It hits 68.80% solved tasks on Gemini-3-Pro (vs. 45.00% no-evolution and 65.83% for EvoX) and 67.00% on GPT-5.4. Most strikingly, on the lightweight Gemini-3-Flash, it nearly doubles baseline accuracy from 20.00% to 39.20%.
- Math Optimization: Using GPT-5 and Gemini-3-Pro backbones, LEAP achieves best or tied-for-best scores across all six benchmarks (largely matching AdaEvolve's final peaks while converging faster) and surpasses human SOTA references on tasks like Circle Packing and MinMax Distance.
- Cost & Efficiency: LEAP is the cheapest evolutionary method tested on ARC-AGI-2, averaging **0.82M tokens ($14.76) per task**, beating AdaEvolve ($16.38), GEPA ($18.18), and EvoX ($20.34).
Limitations and Future Work
The authors note two main bottlenecks:
- Context Window Ceilings: Even with interface-only injection and aggressive pruning, the library is capped (e.g., 20,000 tokens total, top-30 functions per prompt). On massively heterogeneous task batches requiring hundreds of distinct tools, this ceiling could limit scalability.
- Base Model Dependency: LEAP amplifies an LLM's coding ability, it doesn't replace it—smaller models still struggle to orchestrate deeply complex algorithms compared to frontier backbones.
For future work, the team plans to extend LEAP beyond grid puzzles and math into multimodal reasoning and broader software engineering workflows.
Summary updated