FunSearch Uses Code to Discover New Mathematical Solutions
Google DeepMind’s FunSearch pairs a language model with an evaluation loop to search for better code-based solutions. It found a previously unknown solution to the cap set problem and also produced a bin-packing result faster than earlier human-developed methods.
Google DeepMind’s FunSearch combines a language model with a repeated testing process to search for solutions to mathematical and computational problems. Rather than asking the model to provide a final answer in one go, the system generates code, checks how well it performs, and uses the strongest results to guide another round.
“FunSearch uses AI to find verifiable mathematical solutions, with no clear drift toward harm or human dependency.”Why it scores Neutral
A search loop built around code
FunSearch uses Codey, a code-specific variant of Google’s PaLM 2, to generate snippets within an existing code framework. Those snippets represent candidate approaches to a particular problem, which the system can evaluate against a defined measure of quality.
When a candidate performs better than known options, it can be fed back into the process. Codey then produces further suggestions informed by that feedback. This repeated cycle joins language-model generation with an evolutionary algorithm: candidate solutions are produced, assessed, and used to shape the next search.
DeepMind computer specialist Bernardino Romera-Paredes described the language model as a “creativity engine.” In this setup, the model proposes possibilities, while the evaluation process helps determine which ones are worth pursuing.
Finding a solution to the cap set problem
After a few days and millions of suggestions, FunSearch produced code containing a correct solution to the cap set problem that had not previously been known. The problem asks for the maximum size of a set of integers within a certain range when no three distinct elements form an arithmetic progression.
Google DeepMind said this was the first time a language model had discovered a solution to a scientific puzzle. Co-author Pushmeet Kohli, the company’s vice president of research, said the solution was not in the model’s training data and had not been known before.
The result matters because it shows how a language model can contribute to a search whose candidates can be checked. The model does not need to establish a mathematical claim through prose alone: FunSearch expresses its candidate in code, and the system evaluates that candidate as part of the loop.
Testing the approach on bin packing
The team also applied FunSearch to the bin-packing problem. In that problem, objects must be packed into as few containers as possible. The source notes that the problem has implications in both physical and digital settings, while DeepMind’s work focused on the digital side.
For that application, the system found a solution faster than any previously developed by humans. This second example suggests that FunSearch can be used beyond the cap set problem, provided a problem can be represented in a form that allows candidate code to be evaluated.
The article contrasts FunSearch with AlphaTensor, which is based on methods inspired by AlphaZero. It presents the use of a language model as a way to extend the method to other problem domains. The examples show a common pattern: generate code, measure its performance, and keep searching from promising candidates.
Where the method may run into limits
One practical feature of FunSearch is that its results are code. That makes the proposed solutions available for inspection and understanding, rather than leaving the result as an opaque answer from a model.
The approach still depends on having a useful feedback signal: a way to tell whether one candidate is better than another. The source points out that this kind of signal is not available for every task, including generating evidence. Without a way to assess suggestions, the system cannot use its iterative search in the same way.
DeepMind expects FunSearch to benefit as language models improve, anticipating higher-quality samples at lower cost. The broader possibility described by the team is that algorithms could be tailored automatically to specific problems and used in real-world applications. The examples establish a promising direction, while the need for measurable feedback defines an important boundary on where the approach can be applied.
Read next