Abstract
Optimizing black-box functions over high-dimensional, structured input spaces—such as chemical graphs or arithmetic expressions—remains a significant challenge. Latent Space Optimization (LSO) addresses this by training a Deep Generative Model (DGM) to map complex structures into a continuous latent space where standard optimization techniques can be applied. However, standard LSO often fails because the generative model is trained once on a static dataset, decoupling it from the optimization objective. We propose Weighted Retraining, a technique that periodically retrains the DGM while weighting data points based on their objective scores. This approach allows the latent space to evolve and focus on high-performing regions, significantly improving sample efficiency and optimization performance.
1. Introduction
Many real-world optimization problems involve "black-box" objectives where evaluations are expensive and the input space is discrete and highly structured. Examples include designing molecules with specific properties or finding optimal computer code. LSO has emerged as a leading strategy, leveraging the representational power of Variational Autoencoders (VAEs) to create a smooth search space. Despite its promise, LSO is often limited by the quality of the initial training data. If the global optimum lies in a region poorly represented by the initial dataset, the optimizer may never find it.
2. The Decoupling Problem in LSO
The core issue in standard LSO is the decoupling of the generative model's training from the subsequent optimization process. Typically, a DGM is trained on a fixed dataset to minimize reconstruction error and regularize the latent space. Once trained, the model is frozen. A surrogate model, such as a Gaussian Process, is then used to search this static latent space.
As illustrated in Figure 6, the DGM only learns to produce valid outputs within a "feasible region" defined by the training data. If the initial data consists primarily of low-scoring examples, the latent space will be optimized for representing those mediocre points. The search process becomes "trapped" within a manifold that does not contain the high-scoring "needles in a haystack" required for successful optimization.
3. Methodology: Weighted Retraining
To bridge the gap between representation and optimization, we introduce two key modifications to the LSO pipeline:
3.1 Weighted Training
Instead of treating all training examples as equally important, we assign weights to data points based on their objective values. We employ a rank-based weighting function: $$w(\mathbf{x}) \propto \frac{1}{kN + \text{rank}(\mathbf{x})}$$ where $N$ is the dataset size and $k$ is a hyperparameter. By using ranks rather than raw values, the method is robust to outliers and invariant to monotonic transformations of the objective function. This weighting forces the DGM to dedicate more of its capacity to promising regions of the input space.
3.2 Periodic Retraining
As the optimizer explores the latent space and queries new points, these points are added to the training set. The DGM is then periodically retrained or fine-tuned. This creates a feedback loop where the latent space itself shifts and "stretches" to better represent the high-performing regions discovered during the search. This recursive self-improvement allows the model to extrapolate beyond the initial training distribution.
4. Experimental Evaluation
We evaluated Weighted Retraining across three domains:
- 2D Shape Area Maximization: Finding the largest square in a $64 \times 64$ binary image.
- Arithmetic Expression Fitting: Optimizing mathematical expressions to match a target curve.
- Chemical Design (ZINC250k): Maximizing the penalized logP score of molecules, a standard benchmark for drug-likeness.
5. Results and Discussion
Weighted Retraining consistently outperformed baselines in both final objective values and sample efficiency.
In the 2D shape task (Figure 1), standard LSO failed to move significantly beyond the average size of the starting shapes. In contrast, Weighted Retraining successfully "moved the goalposts," evolving the latent space to represent and generate much larger shapes.
The most dramatic results were observed in chemical design. On the ZINC250k logP task, Weighted Retraining achieved a score of 27.84 using only 500 queries. This represents a massive improvement over the previous state-of-the-art for machine learning methods, which reached 11.84 after ~5,000 queries. Qualitative analysis showed the model generating molecules that were significantly larger and more complex than any found in the original ZINC dataset, demonstrating a powerful ability to extrapolate.
6. Conclusion
Weighted Retraining transforms Latent Space Optimization from a local search on a static manifold into a dynamic, global optimization process. By aligning the generative model's training with the optimization objective, we overcome the decoupling problem and achieve unprecedented sample efficiency in complex structured domains.
Summary updated