← all notes
·sunny goes aievolutionarycode-generationalgorithms

AlphaEvolve: A Coding Agent for Scientific and Algorithmic Discovery

An evolutionary coding agent that orchestrates a Gemini LLM ensemble to make grounded, evaluator-verified code changes, thereby discovering provably correct algorithms - including the first improvement in 56 years over Strassen for 4×4 complex matrix multiplication (48 scalar multiplications) - and deployed optimizations in Google's production infrastructure.

First page of the paper discussed in this note
first page of the paper · click to open

2025 · Paper


1. Motivation

FunSearch had shown that pairing a frozen code LLM with a deterministic evaluator yields verifiable mathematical discoveries, but it evolved only a single short Python function (10–20 lines) inside a fixed skeleton, required millions of samples, and did not benefit from stronger LLMs.12 AlphaEvolve closes this gap: it generalizes the FunSearch recipe to entire code files (hundreds of lines, any language), exploits state-of-the-art LLMs with rich prompt context and feedback, supports hours-long parallel evaluation on accelerators with on the order of 100 compute-hours per candidate, and needs only thousands of LLM samples.1 The stated aim is a general-purpose agent for both mathematics and compute-critical infrastructure code.3


2. Methodology

2.1 Search Structure

AlphaEvolve runs an asynchronous asyncio pipeline of a controller, LLM samplers, and evaluation nodes, optimized for throughput rather than latency.1 The evolutionary database “implements an algorithm that is inspired by a combination of the MAP elites algorithm and island-based population models,” i.e., a quality-diversity archive partitioned into semi-isolated demes.14 The core loop (paper Fig. 2) is:

loop:
  parent_program, inspirations = database.sample()
  prompt = prompt_sampler.build(parent_program, inspirations)
  diff  = LLM_ensemble.generate(prompt)
  child = apply(parent_program, diff)
  scores = evaluator_pool.run(child)      # cascaded, parallel
  if promising: database.register(child, scores)

The exact parent-selection rule, island count, and migration protocol are not disclosed.1

2.2 State Representation

Candidates are whole code files, not single functions. Users mark evolve regions with # EVOLVE-BLOCK-START / # EVOLVE-BLOCK-END comments; the surrounding skeleton is fixed and calls a user-supplied evaluate(eval_inputs) -> dict[str, float].1 The evolved artifact can sit at several abstraction levels: (i) the solution itself, (ii) a constructor function, (iii) a bespoke search algorithm, or (iv) co-evolved intermediate solutions plus search algorithms - “different levels of abstraction work better for different problems.”1 For most mathematics problems, AlphaEvolve evolves heuristic search programs given a fixed wall-clock budget (e.g., 1000 s) and the best construction found by the previous heuristic, producing multi-stage adaptive searches.1

2.3 Generation Mechanism

Generation uses an ensemble of Gemini 2.0 Flash (high-throughput idea volume) and Gemini 2.0 Pro (occasional higher-quality suggestions); results improve monotonically with base-model strength.1 The output protocol is a sequence of diff blocks in an explicit SEARCH/REPLACE format:1

<<<<<<< SEARCH
  # Original code block to be found and replaced
=======
  # New code block to replace the original
>>>>>>> REPLACE

Full-file rewrite is a configurable alternative for short code or complete rewrites.1 The prompt sampler composes: sampled past solutions with system instructions; explicit context (human instructions, equations, literature PDFs); stochastic formatting (template placeholders instantiated from probability distributions); rendered evaluation results (the program text plus its execution output and scores); and meta prompt evolution - LLM-suggested prompt instructions co-evolved in a separate database.1

2.4 Evaluation & Grounding

Every candidate is scored by a user-provided deterministic evaluator hh mapping solutions to scalar metrics (maximized); multi-metric optimization is supported and improves even single-target results.1 Three optional mechanisms harden this: (i) an evaluation cascade - test-case ensembles of increasing difficulty, advancing only candidates promising at earlier stages, with new solutions first evaluated at small scale “to filter out faulty programs early”; (ii) LLM-generated feedback grading hard-to-formalize properties (e.g., simplicity), added to scores or used as discard criteria; (iii) parallelized evaluation, making ~100 compute-hours per candidate affordable.1 Task-specific grounding includes rounding tensor-decomposition entries to nearest integer or half-integer to enforce exactness for matrix multiplication, and randomized-input equivalence checking against reference code for FlashAttention XLA-IR edits (the final version was confirmed correct for all inputs by human experts).1

2.5 Memory / Information Flow

The program database is the persistent memory; prompts carry past programs with their scores and execution results rendered as feedback.1 Meta prompt evolution co-evolves the prompting context itself in a separate database.1 In math runs, each heuristic generation is shown the best construction found by the previous best heuristic, chaining a multi-stage adaptive search.1

2.6 Selection & Propagation

Database sampling balances exploration and exploitation via the MAP-Elites-inspired archive plus island models; promising evaluated solutions are registered back and drive subsequent sampling.1 Beyond this inspiration statement, selection and migration details are undisclosed.1

2.7 Anti-Slop / Anti-Hallucination Mechanisms

The central claim: “This evaluation mechanism allows AlphaEvolve to avoid any incorrect suggestions from the base LLM.”1 Controls are layered: execution grounding of every candidate; the cascade’s early filtering of faulty programs; exact integer/half-integer rounding checks for tensor decompositions; correctness-by-construction framings (the Borg heuristic only ranks machines already deemed feasible; kernel tiling search does not alter kernel semantics); randomized-input equivalence checks for compiler IR; LLM-feedback discard rules; and human-expert sign-off before production deployment (e.g., the TPU circuit rewrite validated by TPU designers).1


3. Results

  • Matrix multiplication: improved state of the art for 14 tensor-rank targets, e.g., 4,4,4\langle4,4,4\rangle 49→48 (first advance over Strassen’s 1969 algorithm for complex-valued 4×4 matrices), 3,4,6\langle3,4,6\rangle 56→54, 3,4,7\langle3,4,7\rangle 66→63, 4,5,6\langle4,5,6\rangle 93→90; 5,5,5\langle5,5,5\rangle matched at 93. Baselines include Strassen, Laderman, Smirnov’s alternating least squares, AlphaTensor, and flip-graph search.1
  • Mathematics: applied to 50+ open problems; matched best-known constructions on ~75% and surpassed them on ~20%, including the kissing number in dimension 11 (593 spheres vs. the previous record 592) and a new upper bound for the Erdős minimum-overlap problem.31 A scaled follow-up (“AlphaEvolve-v2,” Georgiev et al.) extended these results further.5
  • Infrastructure: a 5-line Borg scheduling heuristic “continuously recovers on average 0.7% of Google’s fleet-wide compute resources” (chosen over deep RL for interpretability); a TPU matmul kernel tiling heuristic gives an average 23% kernel speedup and ~1% reduction in Gemini training time; a Verilog arithmetic-circuit rewrite was integrated into an upcoming TPU; FlashAttention XLA optimization gives 32% kernel speedup plus 15% on pre/postprocessing.1
  • Ablations: removing evolution, prompt context, meta-prompt evolution, full-file scope, or the strong base LLM each significantly degrades results on tensor decomposition and kissing-number tasks.1

Exact LLM call counts and dollar costs are not disclosed.1


4. Limitations & Assumptions

The headline limitation is stated plainly: AlphaEvolve “handles problems for which it is possible to devise an automated evaluator”; LLM-as-judge settings are not optimized for.1 The system is closed-source; selection rules, island/migration specifics, per-task sampling budgets, and costs are undisclosed, so baselines such as FunSearch were not re-run under matched conditions.1 Discoveries additionally rely on downstream provable-correctness checks and human experts in task formulation (e.g., Terence Tao, Javier Gómez-Serrano) and production sign-off.1


5. Critical Analysis

  • Distinctive strength: the pairing of whole-file, multi-language evolution with cascaded, heavily parallelized evaluation converts LLM creativity into provably correct artifacts at production scale - the Borg and TPU deployments show the loop working where verification is economic, not just mathematical.1
  • Structural weakness / trade-off: the undisclosed database dynamics and budgets make the core search mechanism non-reproducible; the ~100-compute-hour-per-candidate evaluation regime is unavailable outside hyperscale infrastructure, and every result is contingent on a hand-built evaluator.
  • Connections: AlphaEvolve is the direct successor of FunSearch (#6) - its Table 1 is explicitly a FunSearch-vs-AlphaEvolve capability delta (whole files vs. single function, thousands vs. millions of samples, strong-LLM benefit vs. none).1 OpenEvolve (#7) is an open reimplementation that adopts its EVOLVE-BLOCK markers and SEARCH/REPLACE diff protocol,6 and MLEvolve (#5) uses AlphaEvolve as a named baseline on 15 math tasks, claiming the best result on 11 of them.7 Its archive design draws on MAP-Elites (#25).4

6. References

Footnotes

  1. AlphaEvolve full text - https://ar5iv.labs.arxiv.org/html/2506.13131 ; results repo: https://github.com/google-deepmind/alphaevolve_results 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

  2. Romera-Paredes et al., “Mathematical discoveries from program search with large language models,” Nature 625:468–475 - https://www.nature.com/articles/s41586-023-06924-6

  3. Novikov et al., “AlphaEvolve: A coding agent for scientific and algorithmic discovery,” arXiv:2506.13131 - https://arxiv.org/abs/2506.13131 2

  4. Mouret & Clune, “Illuminating search spaces by mapping elites,” arXiv:1504.04909 - https://arxiv.org/abs/1504.04909 2

  5. Georgiev, Gómez-Serrano, Tao & Wagner, “Mathematical exploration and discovery at scale,” arXiv:2511.02864 - https://arxiv.org/abs/2511.02864

  6. OpenEvolve repository - https://github.com/algorithmicsuperintelligence/openevolve

  7. Du et al., “MLEvolve: A Self-Evolving Framework for Automated Machine Learning Algorithm Discovery,” arXiv:2606.06473 - https://arxiv.org/abs/2606.06473