ESS-Flow: Training-free guidance as Bayesian inference in source space

Adhithyan Kalaivanan, Zheng Zhao, Jens Sjölund, Fredrik LindstenNeurIPS 2026

TL;DR

Suppose you have a powerful generative model that designs proteins or crystal structures, and you want to steer it toward a specific property—without retraining it. Existing steering methods rely on calculus (gradients) to nudge the generation in the right direction, which completely breaks down in scientific domains where properties are evaluated by non-differentiable black-box simulators or involve discrete choices like picking atom types. ESS-Flow solves this by stepping back into the model's simple Gaussian noise space and exploring it with a classic, gradient-free statistical technique, unlocking exact, tuning-free control for messy real-world science.

What Problem Does This Paper Address?

Diffusion and flow-based generative models work by learning a deterministic map (an ordinary differential equation, or ODE) that transforms pure Gaussian noise (the source space) into complex objects like molecules or images (the data space). Often, we don't just want random samples; we want samples that satisfy a specific condition or maximize a reward—a setup known as training-free guidance.

In computer vision, guidance usually relies on taking the derivative (gradient) of a reward function and pushing the sample along that slope. In scientific discovery, however, gradients are frequently unavailable. Checking if a protein folds properly or if a molecule is synthesizable requires running external, non-differentiable simulation software. Similarly, generating crystal lattices involves discrete rounding steps (e.g., snapping continuous values to discrete atomic numbers) where derivatives simply do not exist. Trying to do gradient-free random walks directly in the complex, high-dimensional data space is a nightmare of step-size tuning and falling off the data manifold.

Methods

Instead of wrestling with the jagged data space, the authors pull the problem back into the generative model's source space. When you express both the prior and the desired target distribution in the source space via a change of variables, the notoriously expensive Jacobian determinants of the flow map neatly cancel out! You are left with a standard multivariate Gaussian prior multiplied by a "pullback" reward function—evaluated simply by pushing a noise vector forward through the frozen flow model and scoring the output.

Figure 1: Illustration of ESS-Flow. We sample the target distribution π(z) in the source space of flow-based models, which typically has a Gaus- sian prior p(z). This allows gradient-free sampling with elliptical slice sampling. At stationarity, the transformed ellipse passes through regions of high potential in the data space by construction.

Because the prior in source space is a clean Gaussian, the authors apply Elliptical Slice Sampling (ESS), a classic Markov chain Monte Carlo (MCMC) algorithm. Here is how ESS-Flow works:

  1. Take your current noise vector $z_i$ and draw a random auxiliary vector $\nu$ from the Gaussian prior. Together, they define a 2D ellipse in the high-dimensional source space.
  2. Pick a point on this ellipse, push it forward through the flow model to get a candidate data sample, and score it with your black-box simulator.
  3. If the score clears a random acceptance threshold, move there! If rejected, ESS doesn't throw the ellipse away; it adaptively shrinks the search bracket along the ellipse closer to $z_i$ and tries again.

This gives ESS-Flow adaptive step sizes with zero hyperparameters to tune and zero backward passes. The authors also introduce a proof-of-concept multi-fidelity trick: run ESS-Flow cheaply using coarse ODE solver steps, and correct the final samples using importance weights computed with fine ODE steps.

Datasets

Because ESS-Flow is training-free, it is evaluated using existing pretrained generative priors rather than training on new datasets from scratch:

  • Materials: Uses FlowMM (pretrained on the MP-20 dataset of inorganic crystals) and evaluates property targets using surrogate predictors trained on JARVIS-DFT.
  • Proteins: Uses Proteina (60M-parameter variant) to generate 100-residue protein backbones, scored via ProteinMPNN and ESMFold.
  • Molecules: Uses GeoLDM (pretrained on GEOM-Drugs) to generate 28-atom 3D drug-like molecules, scored with RDKit.

No new datasets are introduced, though the authors extend the standard material generation S.U.N. (Stability, Uniqueness, Novelty) metric to S.U.N.T. by adding a Threshold criterion to verify that generated crystals actually hit the target property.

Key Insights and Ideas

  • Gradient-based source methods get trapped on islands: Even when you do have gradients (using continuous relaxations), methods like D-Flow project gradients along the data manifold. If the manifold has disconnected modes—like two separate half-circles, or distinct chemical compositions—gradient flows get stuck in whichever mode they started in. Because ESS-Flow traces continuous ellipses in the Gaussian source space, it effortlessly leaps across disconnected islands in the data space.
Figure 2: Conditional generation on a 2D toy prob- lem, targeting samples whose first coordinate x1 is close to a value c indicated by the dotted line. Prior samples are shown in gray with marginals along the border. Some D-Flow samples, which follow the source-space gradient, become trapped in dis- connected manifold components (indicated by the arrow), while ESS-Flow avoids this problem.
  • Preserving fast-generation geometry: Guidance methods that alter the ODE vector field during generation ruin models trained for straight, fast trajectories (like minibatch optimal transport flows). Because ESS-Flow leaves the pretrained vector field untouched, any fast-sampling properties of the base model are preserved.
  • Asymptotic exactness matters for science: Unlike heuristic guidance that aims for a single "pretty" reconstruction, ESS-Flow is a proper MCMC method. It asymptotically samples the true Bayesian posterior, providing the sample diversity and statistical rigor scientists need for hypothesis testing.

Key Results

ESS-Flow outperforms state-of-the-art gradient-based baselines (even when giving baselines differentiable surrogates) and unlocks tasks where gradients are impossible:

Sample property distributions showing ESS-Flow concentrating tightly around extreme target values compared to baselines.
  • Crystalline Materials: When targeting extreme values (>99th percentile, such as a 300 GPa bulk modulus), ESS-Flow slashes Mean Absolute Error down to 8.99 GPa (compared to 39.14 for DAPS and 205.88 for D-Flow) and achieves the highest S.U.N.T. quality rates across all tasks (e.g., 16.0% on band gap vs. $\le$0.1% for all baselines). On a strictly non-differentiable space-group symmetry task, it hits the target symmetry 92.3% of the time (up from 2.5% unconditionally).
  • Protein Backbones: Guiding Proteina with non-differentiable ESMFold refolding error boosts backbone designability from 9.6% (unconditional) to 86.4%, shrinking mean self-consistency RMSD from 6.74 Å to 1.53 Å while maintaining structural diversity.
  • Drug-like Molecules: Unconditional DDIM sampling from GeoLDM produces fragmented, disconnected molecules over half the time (44.3% connected). ESS-Flow boosts connectivity to 97.9%–99.8%, steadily improves drug-likeness (QED from 0.351 to 0.635) and synthesizability (SA from 6.922 down to 4.760), and lifts overall high-quality yield from 0.1% to 0.9%.

Limitations and Future Work

  • Compute Cost: Being a zeroth-order MCMC method, ESS-Flow requires many forward passes through the ODE solver (e.g., 264 steps per chain in the protein/molecule experiments), making it more computationally expensive in function evaluations than single-pass gradient methods.
  • Discretization Bottlenecks: Sample quality is bounded by how well the flow model approximates the true distribution at moderate ODE step counts. Furthermore, the simple importance-reweighting multi-fidelity trick suffers from weight collapse (low effective sample size, dropping to 0.1%–1.0%) when the target distribution is very sharp.
  • Future Directions: The authors point toward emerging one/few-step "flow map" models to drastically cut forward-pass costs, warm-starting parallel MCMC chains, and replacing simple importance weighting with delayed-acceptance ESS or parallel tempering across discretization levels.

Summary updated

Abstract

Guiding pretrained flow-based generative models for conditional generation or to produce samples with desired target properties enables solving diverse tasks without retraining on paired data. We present ESS-Flow, a gradient-free method that leverages the Gaussian prior of the source distribution in flow-based models to perform Bayesian inference directly in the source space using elliptical slice sampling. ESS-Flow only requires forward passes through the generative model and observation process, making it applicable even when gradients are unavailable, such as with non-differentiable simulation-based observations or quantization in the generation process. We demonstrate its effectiveness on scientific applications including generating materials with target properties, protein backbone structures with improved designability, and synthesizable, drug-like molecules. The associated code is available at https://github.com/Adhithyan8/essflow.
BibTeX
@inproceedings{kalaivanan2026ess,
  author = {Adhithyan Kalaivanan and Zheng Zhao and Jens Sjölund and Fredrik Lindsten},
  title = {{ESS-Flow: Training-free guidance as Bayesian inference in source space}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=qokTHEVYpp},
}
Figure