Variational Active Flow Matching for Discrete Online Black-Box Optimization

Yashvir Singh Grewal, Daniel M. Steinberg, Thang D Bui, Cheng Soon Ong, Edwin V. BonillaNeurIPS 2026

TL;DR

Designing new proteins or drugs means hunting for rare, high-performing molecules inside astronomically vast discrete spaces where every lab test is expensive. While modern flow-matching models are fantastic at generating complex biological sequences all at once, they hide the exact probabilities required by principled search algorithms to steer them. This paper introduces Active Flow Matching (AFM), a clever mathematical detour that lets us actively train discrete flow models to discover top-tier scientific designs—no explicit likelihoods required.

What Problem Does This Paper Address?

Imagine trying to engineer a better virus capsid for gene therapy using a 28-amino-acid sequence. You are searching through $20^{28}$ possibilities, nearly all of which are useless, and testing each candidate costs serious time and money. Instead of hunting for a single needle in this haystack, active generation algorithms learn a probability distribution over whole regions of high-fitness designs—a "super level-set" above a rising performance threshold—proposing diverse batches of candidates round after round.

Classic active-generation methods like CbAS and VSD frame this search as variational inference. To update the generator, however, they need to compute exact likelihoods ($q_\phi(\mathbf{x})$)—the precise probability the model assigns to a finished sequence. That forces researchers to rely on autoregressive models, which generate sequences one token at a time from left to right.

Yet proteins and molecules aren't built left-to-right; their parts fold and interact globally. Modern Discrete Flow Matching (DFM) models capture these non-local, multi-modal structures much better by refining entire sequences in parallel from noise. The catch? Calculating the marginal likelihood of a final sequence in a flow model requires summing over exponentially many denoising paths. Because this is intractable, our sharpest search algorithms couldn't use our best generative backbones.

Methods

Active Flow Matching (AFM) removes this likelihood bottleneck. While a discrete flow model cannot tell you the marginal probability of a final sequence $\mathbf{x}_1$, its neural network denoiser directly outputs a tractable conditional endpoint distribution, $q_t^\phi(\mathbf{x}_1 \mid \mathbf{x}_t)$—its prediction of the clean sequence given a partially noisy state $\mathbf{x}_t$ at time $t$.

AFM's core move is to lift the variational Kullback-Leibler (KL) divergence objective from the intractable final output space onto these conditional flow paths, averaging over intermediate times and states:

  • Forward-KL AFM: Minimizes the forward KL divergence toward the target level-set distribution (defined via a binary classifier trained on data collected so far), encouraging broad exploration.
  • Reverse-KL & Symmetric-KL AFM: Uses a previous flow snapshot to form a tilted reference target for mode-seeking exploitation (Reverse-KL), or sums both objectives to balance coverage and focus (Symmetric-KL).

Because you obviously cannot sample directly from the unknown high-fitness target you are trying to find, AFM estimates expectations using Self-Normalized Importance Sampling (SNIS) alongside a three-part mixture proposal:

  1. A uniform prior for broad exploration.
  2. The base flow from the previous round to refine promising regions.
  3. A replay buffer of confirmed top-scoring sequences to anchor learning.

Datasets

No new benchmarks are introduced; the authors evaluate AFM across six established scientific design benchmarks:

  • Ehrlich Synthetic Landscapes ($L=32, 64$): Procedurally generated test functions over discrete sequences that mimic biophysical ruggedness, constraints, and long-range epistasis, with a known global optimum ($1.0$).
  • AAV Capsid Design ($L=28$): Optimizing a 28-amino-acid viral packaging region ($20^{28}$ space) scored by a pre-trained CNN oracle (global maximum $\approx 19.54$).
  • Structure-Based Protein Design (FoldX): Optimizing the mRouge red fluorescent protein ($L=228$) for thermodynamic stability ($-\Delta G$) and solvent-accessible surface area (SASA), limited to 3 mutations per round.
  • Molecular Docking (Dockstring F2): Designing small molecules (as SELFIES strings) to dock against Thrombin while penalizing poor drug-likeness (QED).

Key Insights and Ideas

  • No new flow physics needed: The authors prove that Forward-KL AFM is target-consistent. Mathematically, importance-weighted cross-entropy training on the denoiser reduces directly to standard Discrete Flow Matching on the desired high-fitness posterior. You recover the exact marginal target distribution at the global optimum without ever evaluating a marginal likelihood.
  • Updating the weights beats steering at test time: Guiding a frozen flow model during sampling (like classifier guidance) falls short of actually updating the generator inside the active loop, which builds a reusable, compounding search distribution.
  • Why Reverse-KL lags: Surprisingly, Reverse-KL AFM underperforms Forward-KL not because it collapses onto a single mode, but because its math anchors the active model too tightly to the previous round's base flow—causing sluggish under-exploitation.

Key Results

Across tight query budgets, Forward-KL and Symmetric-KL AFM consistently match or beat autoregressive active-generation baselines (VSD, CbAS), guided discrete diffusion (LaMBO-2), predictor-guided flows (DFM-PG), reward fine-tuning (DRAKES), and Top-$K$ retraining.

Figure 1: Budget-constrained optimisation on Ehrlich synthetic landscapes, where we report the simple regret.
  • Long-range epistasis: On Ehrlich landscapes (above), Forward-KL AFM drops simple regret (distance to the $1.0$ optimum; lower is better) below $0.2$ on $L=32$ and reaches $0.862$ on the much harder $L=64$ task, widening its lead over autoregressive VSD as sequence length grows.
  • Viral & Drug Design: On AAV capsid design ($R=10$ rounds, batch size $128$) and F2 molecular docking ($R=100$ rounds, batch size $32$), AFM achieves the lowest simple regret ($\sim 3.3$) and highest docking scores ($>9.0$), outperforming VSD by a wide margin on small molecules (below).
Figure 2: Simple regret on AAV capsid design task, and the best score in F2 docking.
  • Protein Stability vs. Surface Area: AFM quickly finds top thermodynamic stability variants on FoldX ($-\Delta G > 6$), though autoregressive VSD and CbAS beat it on SASA.

Limitations and Future Work

  • Theory-practice gaps: While Forward-KL AFM is theoretically target-consistent, practical shortcuts—estimating flow proposal densities via Monte Carlo and setting replay buffer weights to $1$—step outside the theorem's strict guarantees (using exact replay weights slightly worsened Ehrlich-64 regret from $0.862$ to $0.888$).
  • Classifier & task sensitivity: Performance depends on the binary classifier's calibration and the chosen threshold schedule; overly aggressive thresholds hurt optimization. Moreover, when properties can be easily improved by simple local tweaks (like FoldX SASA), parallel flow models offer less of an edge over local or autoregressive search.
  • Future directions: The authors point toward tighter variance-reduction techniques for importance weights, multi-objective and constrained optimization extensions, and applying AFM beyond biology to broader discrete design spaces.

Summary updated

Abstract

Many scientific design problems require identifying rare high-fitness objects in vast discrete spaces using costly black-box feedback. Variational active-generation methods, including variational search distributions (VSD) and conditioning by adaptive sampling (CbAS), address this by learning a distribution over high-fitness designs via inference on a level-set posterior. However, these methods rely on generators with explicit likelihoods, most commonly autoregressive models, creating a mismatch with modern non-autoregressive approaches, such as discrete diffusion and flow-based models, which refine designs in parallel and better capture multi-modal structure but have implicit marginal likelihoods. We introduce \textit{Active Flow Matching} (AFM), a variational active-generation framework that removes this likelihood bottleneck by reformulating level-set KL objectives over the conditional endpoint distributions of discrete flow models. AFM yields forward-, reverse-, and symmetric-KL objectives without requiring density evaluation. We show that forward-KL AFM is target-consistent, recovering the level-set posterior without access to marginal likelihoods. Empirically, across protein and small-molecule design tasks, AFM outperforms strong baselines, including autoregressive VSD and CbAS, inference-time guidance, KL-regularised fine-tuning, and Top-$K$ retraining.
BibTeX
@inproceedings{grewal2026variational,
  author = {Yashvir Singh Grewal and Daniel M. Steinberg and Thang D Bui and Cheng Soon Ong and Edwin V. Bonilla},
  title = {{Variational Active Flow Matching for Discrete Online Black-Box Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=CBre2rbyZ1},
}
Figure