                               Neural Genetic Search in Discrete Spaces


             Hyeonah Kim * 1 2 Sanghyeok Choi * 3 Jiwoo Son 4 Jinkyoo Park 3 4 Changhyun Kwon 3 4


                          Abstract                                                               Parent                            Offspring
                                                                                 A       F
                                                                                     G            G−A −B −D−C−E −F −G




                                                                      Routing
                                                                                         E
      Effective search methods are crucial for improv-                                                                              E−D −B −C −G −A −F −E
                                                                                     C           B−G −A −F −E −D −C −B
      ing the performance of deep generative models                              B           D

      at test time. In this paper, we introduce a novel




                                                                      Language
                                                                                 She dances gracefully on stage            The river dances
      test-time search method, Neural Genetic Search                                                                         gracefully and slowly
                                                                                 The river flows downstream
      (NGS), which incorporates the evolutionary mech-
      anism of genetic algorithms into the generation
                                                                                                 NC ( O ) C ( = O ) O




                                                                      Molecule
      procedure of deep models. The core idea behind
      NGS is its crossover, which is defined as parent-                                          O C C [C@H] ( O ) C C
                                                                                                                         NC ( O ) C [C@H] ( O ) C ( Br ) C
      conditioned generation using trained generative
      models. This approach offers a versatile and easy-
      to-implement search algorithm for deep gener-                   Figure 1. Illustrative examples of parents and offspring in various
      ative models. We demonstrate the effectiveness                  tasks. Offspring are generated through crossover and mutation.
      and flexibility of NGS through experiments across               Crossover combines two parent chromosomes (Yellow and Blue)
      three distinct domains: routing problems, adver-                by restricting the vocabulary to tokens present in one of the parents.
      sarial prompt generation for language models, and               Mutation (Pink) occasionally removes this limitation, promoting
      molecular design.                                               the solution diversity.

                                                                      process to refine the outputs of generative models using
                                                                      existing problem-specific GAs (Ahn et al., 2020; Kim et al.,
1. Introduction                                                       2024). In contrast, our goal is to integrate the evolutionary
Genetic algorithms (GAs) have demonstrated remarkable                 principles of GAs directly into the generation process of
performance across a diverse range of tasks with discrete             deep models rather than simply chaining the deep models
search space, from classic combinatorial optimization prob-           and GAs.
lems (Holland, 1992; Omara & Arafa, 2010; Vidal et al.,               We present Neural Genetic Search (NGS), a GA-inspired
2012; Nagata & Kobayashi, 2013; Mahmoudinazlou &                      new search algorithm for deep generative models. NGS
Kwon, 2024) to more recent applications in molecular de-              enhances the sequential generation process by incorporat-
sign (Morris et al., 1998; Jensen, 2019; Nigam et al., 2021;          ing genetic operators, crossover, and mutation. Specifically,
Kerstjens & De Winter, 2022). By maintaining a population             we define the crossover as a parent-conditioned generation,
of candidate solutions and iteratively applying evolution-            where the model’s vocabulary is restricted to the tokens used
ary operators, such as crossover and mutation, GAs can                in the selected parents, while mutation simply removes this
systematically explore vast search spaces.                            restriction (Figure 1), allowing for more diverse outputs.
In this work, we investigate how to incorporate the powerful          The generation with the genetic operators proceeds itera-
search capabilities of GAs into deep generative models.               tively with an evolving population, steering the generation
Previous efforts that combined GAs with deep learning for             toward better results over time, similar to traditional GAs.
better search typically applied GAs after the generation              Since the generation process is still governed by the trained
  *                   1                          2
   Equal contribution Mila - Quebec AI Institute Université de       generative models, NGS effectively combine the search ca-
Montréal 3 KAIST 4 Omelet. Correspondence to: Hyeonah                pability of GAs with the generative power of deep models.
Kim <hyeonah.kim@mila.quebec>,            Sanghyeok Choi              Furthermore, as the proposed genetic operators are problem-
<sanghyeok.choi@kaist.ac.kr>, Changhyun Kwon <chk-                    agnostic, NGS can be applied to any sequential generative
won@kaist.ac.kr>.                                                     model across various tasks, in contrast to traditional GAs,
Proceedings of the 42 nd International Conference on Machine          which require significant effort to design problem-specific
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025           operators. NGS also can be easily implemented by adding
by the author(s).                                                     the population and the parent-conditioned masking rule to

                                                                  1
