Robust Latent Space Bayesian Optimization with Marginalized Kernel

Ziyi Yang, Yifan Zhu, Jinghui ZhongNeurIPS 2026

TL;DR

When optimizing complex discrete structures like molecules or robot bodies using Variational Autoencoders (VAEs), standard algorithms throw away the model's built-in uncertainty estimates and treat its warped latent space like flat, uniform terrain. MarKBO fixes this by keeping those uncertainty clouds intact—using them both to build a smarter mathematical map of the search space and to steer exploration away from empty, invalid voids. Without needing to retrain the underlying generative model, it achieves state-of-the-art designs on a tight evaluation budget.

What Problem Does This Paper Address?

Suppose you want to discover a potent new drug or an agile robot body, where testing each candidate requires an expensive lab experiment or slow physics simulation. Bayesian Optimization (BO) is the classic tool for finding optimal designs in few steps, using a probabilistic surrogate model—typically a Gaussian Process (GP)—to guess where good solutions hide.

However, BO struggles with discrete, structured objects like molecular graphs. Latent Space BO (LSBO) works around this by training a Variational Autoencoder (VAE) to compress discrete structures into a smooth, continuous "latent space," searching there, and decoding candidates back out.

Here is the catch: a VAE doesn't map a molecule to a single point; it maps it to a probability distribution (a mean and variance) reflecting encoding uncertainty. Standard LSBO throws the variance away, collapsing rich distributions into single points. Furthermore, it assumes the latent space is flat (Euclidean). In reality, nonlinear decoders stretch and warp the space, leaving "prior holes"—uncharted pockets that look plausible to the search algorithm, yet decode into gibberish.

Methods

To stop wasting what the pretrained VAE already knows, the authors introduce MarKBO, upgrading two stages of the optimization loop without fine-tuning the VAE:

Figure 1: Overview of MarKBO (Alg. 3). Structured inputs X are mapped by the VAE encoder qϕ(z | x) to latent posterior distributions, and selected candidates are decoded back through pθ(x | z) into structured outputs. Left: Vanilla LSBO constructs a GP surrogate using a kernel evaluated at reparameterized latent samples, whereas MarKBO integrates the kernel over the encoder posteriors to incorporate their means and covariances into surrogate modeling. Right: The upper panel illustrates RAASP candidates and an SGD optimization trajectory on the logEI acquisition function landscape. In contrast, MarKBO constructs a Riemannian metric G(z) from the encoder’s posterior precisions and uses NUTS to draw latent candidates from the corresponding volume density pRiem(z) (Alg. 2).
  1. Marginalized Quadratic Kernel (Surrogate Modeling): Instead of comparing single latent points, MarKBO integrates a kernel function over the entire Gaussian distributions output by the VAE encoder. While radial basis function (RBF) kernels are standard in BO, the authors pair marginalization with a quadratic polynomial base kernel. This yields an exact, closed-form equation that runs in linear $\mathcal{O}(d)$ time per evaluation—just as fast as standard kernels—while accounting for encoder uncertainty.
  2. Latent Geometry-Aware Sampling (Candidate Acquisition): To dodge "prior holes," MarKBO treats the latent space as a curved Riemannian manifold. Rather than computing expensive decoder Jacobians to measure this curvature, it builds a smooth global metric directly by interpolating the precision matrices (inverse variances) of the top-$p\%$ highest-scoring known data points. Using a gradient-based sampler (NUTS), it draws candidate proposals from regions of high geometric volume—areas that are simultaneously high-performing and well-supported by real data—before selecting queries via Thompson sampling.

Datasets

No new benchmarks were introduced; the authors evaluated MarKBO on two established domains:

  • Practical Molecular Optimization (PMO): 16 drug-discovery tasks (built on GuacaMol and Therapeutics Data Commons), initialized from the GuacaMol test set using SELFIES molecular strings under small (500 calls) and large (10,000 calls) budgets.
  • Automated Robot Design (GLSO): Four physics-simulated locomotion tasks (Flat, Frozen Lake, Ridged, and Wall terrains) where robots are acyclic graphs constrained by graph-grammar rules, initialized with designs from the GLSO-VAE training set (500 calls).

Key Insights and Ideas

  • Less is more for Gaussian distributions: Standard RBF kernels implicitly compare infinitely many statistical moments and suffer from vanishing gradients if their bandwidth hyperparameter is poorly tuned. Because VAE posteriors are Gaussian—completely defined by just their mean and covariance—a degree-two quadratic kernel captures everything needed to distinguish them, with zero bandwidth tuning required.
  • Encoder variance is a "free" geometric compass: In regions where the VAE is unsure, larger variances naturally smooth out the GP surrogate's predictions. Meanwhile, using inverse variances as a local metric guides the sampler along directions the decoder actually understands, sidestepping invalid dead zones without touching decoder gradients.
  • Complementary teamwork: Ablations reveal that putting uncertainty into the kernel shapes what function is being maximized, while geometry-aware sampling defines where it is safe to look; combining both yields a clear synergy over using either alone.

Key Results

Across both domains, MarKBO converges faster and reaches higher final scores than strong LSBO, high-dimensional BO, and evolutionary baselines:

  • Molecular Design: MarKBO achieved the highest top-1 scores across all four highlighted small-budget tasks—including 0.673 on Perindopril MPO (vs. ~0.62–0.66 for top baselines and 0.561 for an unmarginalized quadratic kernel) and 0.772 on Fexofenadine MPO—while maintaining its lead on 20,000-evaluation runs. Crucially, violin plots show MarKBO generates dense clusters of diverse, high-scoring molecules rather than relying on lucky outliers.
Figure 2: Results on PMO benchmark over 10 seeds. Top row: optimization curves on four small- budget tasks. Bottom left: violin plots of final scores on two small-budget tasks; green lines indicate medians, red lines indicate means. Bottom right: optimization curves on two large-budget tasks.
  • Robot Design: MarKBO achieved the highest cumulative reward and fastest convergence across all four simulated terrains over 10 random seeds, beating both latent-space BO competitors (like InvBO and MSR) and combinatorial search methods (GA, MCTS).

Limitations and Future Work

Because MarKBO leaves the generative model frozen, it is entirely at the mercy of the pretrained VAE's quality. If the VAE was poorly trained—suffering from posterior collapse (where the latent space ignores the input) or poor reconstruction accuracy—both the marginalized surrogate and the geometry-aware sampler lose their footing. Future directions are not explicitly discussed in the main text.

Summary updated

Abstract

Latent space Bayesian optimization circumvents the curse of dimensionality over structured inputs by performing Gaussian process surrogate-guided search in a continuous latent space learned by deep generative models. However, existing latent space Bayesian optimization methods overlook both the inherent stochasticity of latent space representations and the geometric properties of the manifold induced by VAE, leading to suboptimal optimization performance. In this work, we propose a marginalized kernel that integrates out the latent variables through the VAE inference posterior, yielding a closed-form kernel on the observation space that naturally accounts for encoding uncertainty. We adopt a quadratic polynomial kernel as the base kernel in the latent space, which captures discrepancies in the first two moments of the latent posteriors while avoiding the bandwidth sensitivity inherent to the RBF kernel. Furthermore, inspired by the Riemannian interpretation of VAEs, we incorporate a geometry-aware sampling scheme that leverages the metric structure revealed by the learned posterior covariances to guide candidate acquisition toward high-information regions of the latent space. Empirical evaluations on molecular design and robot design tasks demonstrate that our method outperforms existing state-of-the-art baselines across the majority of tasks.
BibTeX
@inproceedings{yang2026robust,
  author = {Ziyi Yang and Yifan Zhu and Jinghui Zhong},
  title = {{Robust Latent Space Bayesian Optimization with Marginalized Kernel}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=fRlRq8PSjh},
}
Figure