Inferring Design Distributions: Kernel-Mean Posterior Inference for Stochastic Molecular Design

Molecular design is usually framed as maximizing a score: pick a molecule, run a docking simulation or a quantum-chemistry calculation, and keep whatever scores best. But the interesting quantity in many molecular problems is not a single number — it is a distribution. A candidate molecule's docking poses vary from run to run; a reaction network built from candidate reactants produces a stochastic distribution of products and dynamics; a panel of candidate drugs is meant, as an ensemble, to cover a target profile of properties. What we actually want is to invert a stochastic simulator: find designs whose simulated outcomes, taken as a whole, match a target distribution. Each simulation is expensive and there is no usable likelihood function for the outcome, which is exactly the setting of simulation-based inference (SBI) — the field that learns to infer parameters from simulated data without ever writing down a likelihood. Meanwhile, kernel mean embeddings (KME) offer a way to represent and compare probability distributions directly, without density estimation: map a distribution to a point in a high-dimensional function space and measure distances there. This proposal argues that molecular inverse design should be posed as SBI over chemical space, with kernel mean embeddings supplying both the representation of graph-structured simulator outputs and the distribution-matching objective that keeps exploration diverse.

Two observations make the timing right. First, the SBI toolchain has matured to the point of amortization: BayesFlow 2.0: Multi-Backend Amortized Bayesian Inference in Python trains neural estimators once and answers new queries in milliseconds, but its summary networks — the modules that compress raw simulator output — rely on pooling operations that are known to destroy distributional structure in graph data. Second, sample-efficient molecular optimizers such as SEGO (Sample Efficient Generative Optimization for Molecular Design) have pushed the oracle budget down to roughly a hundred calls, but they treat every candidate as a point with a scalar score, and consequently collapse into repeated chemical formulas that a hard-coded filter must remove. The gap between these two literatures — likelihood-free inference that never touches discrete chemical space, and chemical search that never models outcome distributions — is the space this proposal occupies.

Core Claim

The claim is that we can learn a posterior over design decisions conditioned on a target outcome distribution. Concretely, let $\theta$ denote a design decision: either the latent code or policy parameters of a generative molecular model (so that $\theta$ indexes a region of chemical space), or the design parameters of a stochastic chemical reaction network. Let the expensive oracle — a docking engine with stochastic poses, or a Gillespie-type kinetics simulator — produce, for a design $\theta$, an empirical distribution $\hat{P}_\theta$ of outcomes. Embed the target distribution as $\mu_{\text{target}} = \frac{1}{S}\sum_{s=1}^{S}\phi(y_s)$ with $y_s$ drawn from the target and $\phi(\cdot)$ the feature map of a characteristic kernel, so that no two distinct distributions collide at the same embedding (Sriperumbudur et al.). We then train an amortized estimator

$$q_\psi(\theta \mid \mu) \approx p(\theta \mid \mu_{\text{target}}),$$

on simulated pairs $(\theta, \hat{P}_\theta)$, and refine it in an active loop whose acquisition is distribution-level rather than point-level: each batch is chosen to reduce the expected Maximum Mean Discrepancy (MMD) — the distance between embedded distributions (Gretton et al.) — to the target, while a penalty term pushes the batch's embedding away from the embedding of everything already evaluated:

$$\theta_{1:B} = \arg\min_{\theta_{1:B}} \; \mathbb{E}\big[\text{MMD}(\hat{P}_{\theta_{1:B}}, P_{\text{target}})\big] + \lambda\,\text{MMD}\big(\hat{P}_{\theta_{1:B}}, \hat{P}_{\text{evaluated}}\big).$$

That second term is the structural fix for isomer and mode collapse: a batch of near-duplicate molecules has an embedding nearly identical to the evaluated pool, so duplicates are penalized by construction rather than filtered after the fact.

Three ingredients distinguish this from the closest existing work. The MMD Posterior Bootstrap (Robust Bayesian Inference for Simulator-based Models via the MMD Posterior Bootstrap) already does likelihood-free, MMD-matched posterior inference, but over continuous parameter vectors of physical simulators, with a fresh non-convex MMD minimization per bootstrap draw; we amortize across targets, move to discrete chemical space through generative design codes, and compress the quadratic MMD cost with random-feature and Nyström approximations. Minimum Distance Summaries (Minimum Distance Summaries for Robust Neural Posterior Estimation) uses MMD at test time to adapt a pre-trained posterior estimator, but only by searching over low-dimensional summary statistics, and it cannot ingest structured outputs; we replace the summary statistic itself with a kernel embedding of graph- or set-structured simulator output. SEGO (Sample Efficient Generative Optimization for Molecular Design) is the strongest sample-efficient designer, but its surrogate predicts scalar scores for individual molecules; ours predicts how a distribution of outcomes sits relative to a target, which is what a stochastic oracle actually reveals.

Research Program

The work has three components. The first is the embedding module: a kernel readout for structured simulator outputs. When the oracle emits graphs or sets (docking pose graphs, reaction-network species profiles, molecular libraries), the readout follows the MMD graph-kernel construction of MMD Graph Kernel: Effective Metric Learning for Graphs via Maximum Mean Discrepancy, which represents each graph as an empirical distribution of node representations rather than a pooled vector — the authors showed pooled baselines scoring below 0.05 normalized mutual information on BZR clustering where their kernel reached 0.757. Because the benchmarking study of Benchmarking Simulation-Based Inference found fixed-bandwidth MMD unreliable as an evaluation metric, and Sriperumbudur et al. proved that a kernel's Fourier spectrum controls finite-sample discriminative power, we use multi-scale Gaussian kernel mixtures and validate the choice with a classifier two-sample test rather than trusting MMD itself as the referee. For scalability we adopt the Nyström strategy of Efficient Robust Bayesian Optimization for Arbitrary Uncertain inputs, which cut their embedding inference from 8.117 seconds to 0.780 seconds; that paper also supplies the conceptual bridge — a Gaussian process defined over distributions in the RKHS — but only for low-dimensional continuous controls, never for discrete chemical objects.

The second component is the amortized posterior: a conditional generative network (a normalizing flow or flow-matching head, in the style of BayesFlow 2.0) trained on $(\theta, \mu_{\hat{P}_\theta})$ pairs produced by batched simulator runs, conditioned on target embeddings. The third is the active loop: acquisition over posterior samples under a hard simulator-call budget, with the coverage-penalized objective above replacing scalar expected-improvement heuristics. A secondary theoretical thread, deliberately modest, is a finite-sample analysis of when the kernel readout preserves the posterior-stability guarantee of Random forward models and log-likelihoods in Bayesian inverse problems — that is, how much embedding error the approximate posterior tolerates before Hellinger closeness to the true posterior degrades.

Baselines

The do-nothing reference is one-shot sampling from the base generative model with random selection under the oracle, which establishes what the generator alone contributes and what any inference machinery must add. The strongest existing competitor on sample-efficient molecular design is SEGO (Sample Efficient Generative Optimization for Molecular Design), which combines a Mamba-based SMILES generator with a deep-kernel Gaussian process over language-model embeddings and reported state-of-the-art results on the Practical Molecular Optimization (PMO) benchmark using only 100 oracle calls, where previous methods typically required 1,000 — the efficiency figure our method must match or beat. The second strong competitor is REINVENT, which the PMO benchmark study (Sample Efficiency Matters: A Benchmark for Practical Molecular Optimization) ranked first overall across 23 tasks under the standard 10,000-call limit, with Graph GA close behind; these model-free baselines are the honest test of whether adding inference machinery pays for itself. On the inversion side, the strongest competitors are the MMD Posterior Bootstrap (Robust Bayesian Inference for Simulator-based Models via the MMD Posterior Bootstrap) and BayesFlow 2.0 with its standard summary networks (BayesFlow 2.0). Every comparison is run with the same generator backbone, the same oracle implementations, the same query budget, and the same tuning-effort protocol as PMO, so differences are attributable to the inference machinery rather than the search engine. Beating SEGO means matching or exceeding its top-10 average score curve at 100 and 1,000 oracle calls on PMO while producing strictly more unique scaffold families per top-100 pool; beating the model-free baselines means outperforming them specifically under stochastic oracles and distribution-valued targets at low budgets; beating BayesFlow means lower classifier two-sample test error on posterior recovery, and beating the MMD Posterior Bootstrap means comparable posterior quality at a fraction of its per-target runtime. The key ablation runs our identical pipeline with a mean-pooled readout and a scalar point-acquisition, which isolates the kernel-embedding ingredient from everything else.

Why not just…?

Why not just use simple summary statistics or standard pooling? The evidence is direct: on the BZR graph-clustering benchmark, pooling-based baselines scored below 0.05 on normalized mutual information while the distribution-based kernel readout reached 0.757 (MMD Graph Kernel), and Sriperumbudur et al. showed that matching only low-order moments is not injective — distinct outcome distributions can be indistinguishable. The pooled-readout ablation in this proposal settles the question on our tasks specifically.

Why not just use Wasserstein distance instead of MMD? On the closest available head-to-head, the MMD Posterior Bootstrap stayed centered on true parameters under 10% outlier contamination where Wasserstein ABC drifted, and ran in 109 seconds versus 3,340 seconds on the Gaussian benchmark (Robust Bayesian Inference for Simulator-based Models via the MMD Posterior Bootstrap); bounded kernels also buffer the extreme values that Wasserstein amplifies. Optimal transport does encode geometry that a naive RBF kernel misses, so we will run a Wasserstein-matched variant on the kinetics tasks; if it wins there, that is a finding we will report rather than hide.

Why not just run Graph GA or REINVENT and skip the inference machinery? This is the real threat, and the PMO benchmark is unambiguous that at the 10,000-call limit model-free methods are hard to beat (Sample Efficiency Matters). Our honest position is that the claim is regime-scoped: point-based search degrades when the oracle is stochastic, the target is a distribution, or the budget falls below roughly a thousand calls — and SEGO's own 100-call result shows surrogates matter exactly there. The decisive experiment runs the full PMO suite both with standard deterministic oracles and with stochastic, noisy-oracle variants; if we only win in the noisy and low-budget regimes, the contribution is that boundary, mapped precisely.

Why not just let an LLM surrogate reason over the molecules? Closed-Loop Bayesian Molecular Inference Design with Semantic LLM Surrogates shows LLM surrogates are competitive with Gaussian-process Bayesian optimization on its MolQA tasks, but its authors concede there is no probabilistic calibration or convergence guarantee, and a text-only surrogate cannot invert a Gillespie simulator's stochastic dynamics. Where calibration to an explicit simulator matters — the core of this proposal — the LLM route does not currently apply; where it does compete, we will include it as a baseline on the molecular tasks.

Proposed Experiments and Decisive Checks

The first block validates the readout on structured data before any inference: reproduce the graph-classification and clustering setting of MMD Graph Kernel (supervised accuracy 0.915 on MUTAG; BZR clustering at 0.757 NMI) and confirm that the kernel readout retains this discrimination when transplanted into an SBI pipeline where the pooled variant is the ablation. The second block tests the inversion machinery on stochastic chemical kinetics, where the likelihood is genuinely unavailable: the 7-parameter toggle-switch model under Cauchy noise used by the MMD Posterior Bootstrap (no reported decimal posterior-accuracy figures found on Lacuna for that task), plus a new design-flavored task built with Gillespie simulators in the spirit of CERENA and Rule-Based Gillespie Simulation of Chemical Systems: infer a posterior over network design parameters from a target distribution of steady-state products. Posteriors are scored with the classifier two-sample test, following the finding of Benchmarking Simulation-Based Inference that C2ST, not fixed-bandwidth MMD, is the reliable referee; a calibrated pipeline should approach the near-perfect C2ST of 0.5 that sequential neural methods achieved on Two Moons at 100,000 simulations. The third block is molecular design: the 23-task PMO benchmark (DRD2, GSK3β, JNK3, and the Guacamol multi-property tasks, top-10 average score AUC against oracle calls) plus the five docking targets parp1, fa7, 5ht1b, braf, and jak2 from SEGO — for which the file reports only that SEGO found strict hits in less than half the time of GEAM or Saturn, with no decimal value, so the PMO call-efficiency figure remains our quantitative anchor. Diversity is reported as unique scaffold families and chemical formulas per top-100 pool, which is where the coverage-penalty acquisition must show its effect. The decisive checks are three: the kernel readout must beat its pooled ablation at matched compute; the coverage-penalized acquisition must reduce collapse counts without degrading the score curve; and the noisy-oracle PMO variant must locate the regime boundary within which distribution-level inference beats model-free search. If the first check fails, the proposal reduces to an honest negative result about summary statistics in amortized inference — which, given how routinely pooled readouts are deployed, would itself be worth knowing.