Steering Flexible-Size Molecular Generation\\via RL on Trans-Dimensional Flows

Adrien Goldszal, Malte Franke, Andreas KrauseAI4Mat @ NeurIPS 2026

TL;DR

Most AI models that design 3D molecules decide how many atoms to build before they even start, locking them into a fixed size. This paper shows how to steer flexible-size molecular generators—models that can add or delete atoms on the fly—using reinforcement learning (RL). By teaching the model when to grow or shrink a molecule alongside where to place its atoms, the authors push a molecular generator far beyond its training data's size limits, boost chemical validity, and design tighter-fitting drug candidates.

What Problem Does This Paper Address?

In drug discovery and materials science, generating a molecule that merely looks like the training data isn't enough; we want to steer generation toward specific goals like better binding affinity or structural stability. Reinforcement learning is a natural way to do this, and recent work has successfully applied RL to diffusion and flow-matching models.

However, almost all existing RL methods assume fixed cardinality—the number of atoms is chosen upfront and never changes. Recently, trans-dimensional models like Morph have broken this constraint by allowing insertion and deletion events during generation. Steering these models with RL poses a mathematical headache: if the number of atoms changes mid-trajectory, the dimension of the state and action spaces changes at every step. Standard policy-gradient methods aren't built for actions that change size on the fly.

Methods

The authors solve this by framing flexible-size molecular generation as a parameterized-action Markov Decision Process (MDP).

Figure 2: Two consecutive trans-dimensional actions aj = (γj, ηj) in Morph. At each step, the structural decision γj selects the action-space component, while the conditional content ηj specifies updated coordinates, substituted atom and bond types, and the position, type, and incident bonds of inserted atoms, yielding gj+1. At step k, an atom and a bond are substituted and one atom is deleted, so nk+1 = nk −1. At step k + 1, an existing atom is substituted and a new atom is inserted from the same site. Unhighlighted structural decisions are no-ops.

At each generation step, the policy makes a two-part decision:

  1. Structural decision ($\gamma$): First, the model chooses what structural edits to make—whether to leave an atom alone (no-op), substitute its type, delete it, or insert a new atom. This discrete choice dynamically selects the active action-space component for the current step.
  2. Conditional content ($\eta$): Next, the model samples the actual continuous 3D coordinates and discrete atom/bond types only for the variables active under that structural decision.

Because the structural decision is sampled by the policy itself, its probability is included in the per-step policy density alongside the coordinate and content probabilities. To make the deterministic coordinate flow amenable to RL exploration, the authors add fixed-variance Gaussian noise to the coordinate updates (noting that standard time-scaled variance collapses near the end of the trajectory and causes exploding gradients). Finally, they fine-tune Morph using Group-Relative Policy Optimization (GRPO) with a KL-divergence penalty to keep the model tethered to its pretrained prior.

Datasets

The authors evaluate their approach across three standard molecular benchmarks:

  • QM9: Over 100,000 small organic molecules containing at most 32 atoms, used to test out-of-distribution size extrapolation.
  • GEOM-Drugs: A dataset of drug-like molecules, used to test whether a sparse validity reward can improve molecular quality without distorting the underlying distribution.
  • CrossDocked2020: A structure-based drug design benchmark (using the standard 100-pocket test split), used for pocket-conditioned ligand generation.

Key Insights and Ideas

  • Dimension-changing decisions can be steered directly: By scoring the discrete insertion/deletion choices in the policy gradient, RL can teach a model to adapt molecular size as a response to the target objective, rather than treating size as a fixed hyperparameter.
  • Optimizing simple validity yields emergent physical quality: On GEOM-Drugs, rewarding only a binary "strict validity" check (is it RDKit-sanitizable, single-fragment, and radical-free?) unexpectedly improved 3D physical realism—reducing steric clashes and lowering internal strain energy—without any explicit 3D geometry reward.
  • Bidirectional size adaptation: In pocket-conditioned drug design, simply rewarding binding affinity usually tricks models into making huge molecules. Here, by rewarding size-normalized affinity, the RL policy learned to grow ligands in 36 protein pockets and shrink them in 59 others, achieving higher binding efficiency with fewer atoms.

Key Results

  • Out-of-distribution size on QM9: Using a 4-round curriculum, the model's mean generated molecule size jumped from 17.6 atoms (base) to 69.9 atoms (max 82 atoms)—nearly 4× the training mean and completely outside the 32-atom pretraining support—while keeping chemical validity stable (0.828–0.873).
Figure 3: Atom-count distributions across the size curriculum. RDKit-valid molecules only, 1000 generated per seed. Line is the mean density over 3 inference seeds, band ±1 std. Unit-width bins are convolved with a Gaussian of σ = 1.6 atoms.
  • Validity & physicality on GEOM-Drugs: Strict validity rose from 92.9% to 98.0% (and RDKit validity from 96.0% to 99.1%). PoseBusters validity climbed from 87.8% to 94.3% (matching the training set ceiling), and median PoseCheck strain energy dropped from 17.9 to 14.8 kcal/mol. Unlike test-time guidance methods that increase strain and sampling cost, amortized RL improved both validity and strain.
Figure 4: Validity optimization induces emergent physical quality. (a) Strict validity, the optimized RL reward, across five GEOM curriculum rounds (base = pretrained Morph). (b) The corresponding curriculum in the PoseBusters–PoseCheck strain plane. Morph points are means over 3 seeds; bands and shaded regions indicate ±1 std. TABASCO and SemlaFlow are literature results [Vonessen et al., 2026]; the dashed line marks the GEOM-Drugs PoseBusters level.
  • Pocket-conditioned ligand generation (CrossDocked2020): Per-pocket GRPO improved AutoDock Vina scores from −5.21 to −7.14 kcal/mol (surpassing crystal ligands at −6.36), improved drug-likeness (QED: 0.508 → 0.598) and synthesizability (SA: 0.694 → 0.746), and boosted PoseBusters validity (0.606 → 0.794). Binding efficiency (ligand efficiency) rose from 0.244 to 0.336, outperforming crystal ligands (0.279).

Limitations and Future Work

  • Constrained by the base model: RL can only steer what the pretrained generator can support. Pushing QM9 molecules to 70 atoms degrades 3D geometry, GEOM-Drugs gains plateau near the training data ceiling, and pocket-conditioned scores still trail specialized, higher-capacity baselines (like DePPA).
  • Computational cost: Long sampling trajectories make RL expensive, especially when evaluating costly oracles like docking. Future work could explore few-step samplers, trajectory distillation, or even letting the policy learn how many sampling steps to take.
  • Per-pocket optimization: The pocket-conditioned experiments required fine-tuning a separate policy for each target pocket. Amortizing this optimization across targets—and using explicit multi-objective or Pareto formulations—are natural next steps.

Summary updated

BibTeX
@inproceedings{goldszal2026steering,
  author = {Adrien Goldszal and Malte Franke and Andreas Krause},
  title = {{Steering Flexible-Size Molecular Generation\textbackslash\{\}\textbackslash\{\}via RL on Trans-Dimensional Flows}},
  booktitle = {AI4Mat @ NeurIPS},
  year = {2026},
  url = {https://openreview.net/forum?id=0e0aQopHg1},
}
Figure