| FunSearch | |
|---|---|
| Developer | Google DeepMind |
| Initial release | December 14, 2023 (2023-12-14) |
| Written in | Python |
| Type | Artificial intelligence program synthesis evolutionary computation mathematical optimization |
| License | Apache License 2.0 (software) CC BY 4.0 (other materials) |
| Website | deepmind |
| Repository | github |
FunSearch (short for searching in the function space) is an artificial intelligence method developed by Google DeepMind for discovering computer programs that solve mathematical and algorithmic problems. It combines a large language model with an automated evaluator and an evolutionary search procedure, generating candidate programs, scoring them, and using high-performing programs to produce new candidates.1
Google DeepMind announced FunSearch in 2023, and the associated paper was published in Nature.2 The system was applied to the cap set problem in extremal combinatorics and to the online bin packing problem, where it found new mathematical constructions and new packing heuristics.34
Method
FunSearch frames a problem as a search over computer programs rather than as a direct search over individual solutions. The user provides a problem specification, an evaluation function, and an initial program or program skeleton. At each iteration, FunSearch samples existing programs from a database, favors higher-scoring programs, builds a prompt for a pretrained large language model, and asks the model to generate modified programs. The generated programs are then executed and scored by the evaluator.1
The search process uses an island-based evolutionary method intended to maintain a diverse set of candidate programs and reduce the risk of becoming trapped in local optima. According to the original paper, one advantage of the approach is that FunSearch outputs programs that can sometimes be inspected, simplified, and interpreted by researchers, instead of only producing a final numerical answer or a large list of objects.1
Algorithmic formulation
FunSearch can be described as a search over a space of program fragments, usually functions embedded in a fixed program skeleton. Let be a space of candidate functions and let be an evaluator score obtained by running a fixed solver that calls the candidate function. Given an initial function , FunSearch maintains a database of evaluated, valid functions. It repeatedly samples high-scoring functions from , uses them to construct prompts for a large language model, and asks the model to generate a new candidate function . The new function is executed inside the problem-specific program skeleton and scored by the evaluator. If the generated function is valid, it is added back into , allowing later prompts to build on stronger previous candidates.1
In simplified form, the search loop can be written as:
The idealized objective is to find a candidate function with a high evaluator score,
although in practice FunSearch returns the best valid function discovered during the search. The original implementation uses an island-based evolutionary process to preserve diversity among candidate functions while favoring higher-scoring programs.14
Applications
Cap set problem
FunSearch was first demonstrated on the cap set problem, a problem in additive combinatorics concerning the largest possible subset of with no three points in a line. In dimension 8, FunSearch found a cap set of size 512, improving on previously known constructions. The paper also reported improved lower bounds for the cap set capacity by using FunSearch to discover constructions related to admissible sets.1
Google DeepMind described the result as an example of using large language models to generate verifiable new knowledge in mathematics.2 A Nature news article reported that the system improved on human efforts for a combinatorics problem related to the card game Set.5
Online bin packing
FunSearch was also applied to the online bin packing problem, where items must be assigned to bins as they arrive.1 In this setting, FunSearch evolved programmatic heuristics that decide which bin should receive a new item. The original paper reported that the discovered heuristics outperformed the common first-fit and best-fit baselines on simulated data and OR-Library benchmark instances.1
Software
Google DeepMind released the FunSearch software in a public GitHub repository accompanying the FunSearch paper. The repository includes examples and data for cap sets, admissible sets, online bin packing, independent sets in strong products of cycle graphs, corner-free sets, and related experiments. It also includes a single-threaded implementation of the FunSearch pipeline, although the repository notes that it does not include the language models, execution sandbox, or distributed infrastructure used in the original experiments. The repository states that its software is licensed under the Apache License 2.0, while other materials are licensed under the Creative Commons Attribution 4.0 International License.6
Reception
In a Nature News & Views article, Jean-Baptiste Mouret described FunSearch as connecting genetic programming with large language models, writing that the work showed how language models could help computer programs evolve. The article characterized the system as a proof of concept for AI-assisted mathematical discovery.3
See also
See also
References
References
- Romera-Paredes, Bernardino; Barekatain, Mohammadamin; Novikov, Alexander; Balog, Matej; Kumar, M. Pawan; Dupont, Emilien; Ruiz, Francisco J. R.; Ellenberg, Jordan S.; Wang, Pengming; Fawzi, Omar; Kohli, Pushmeet; Fawzi, Alhussein; et al. (2024). "Mathematical discoveries from program search with large language models". Nature. 625: 468–475. doi:10.1038/s41586-023-06924-6. Retrieved May 4, 2026.
- "FunSearch: Making new discoveries in mathematical sciences using Large Language Models". Google DeepMind. December 14, 2023. Retrieved May 4, 2026.
- Mouret, Jean-Baptiste (January 17, 2024). "Large language models help computer programs to evolve". Nature. 625: 452–453. doi:10.1038/d41586-023-03998-0.
- Ellenberg, Jordan S.; Fraser-Taliente, Cristofero S.; Harvey, Thomas R.; Srivastava, Karan; Sutherland, Andrew V. (March 17, 2025). "Generative Modeling for Mathematical Discovery". arXiv:2503.11061 [cs.LG].
- Castelvecchi, Davide (December 14, 2023). "DeepMind AI outdoes human mathematicians on unsolved problem". Nature. doi:10.1038/d41586-023-04043-w.
- "google-deepmind/funsearch". GitHub. Google DeepMind. Retrieved May 4, 2026.