Dynamic Search for Inference-Time Alignment in Diffusion Models

Xiner Li, Masatoshi Uehara, Xingyu Su, Gabriele Scalia, Tommaso Biancalani, Aviv Regev, Sergey Levine, Shuiwang Ji

TL;DR

This paper frames the inference-time alignment of diffusion models as a tree search problem and introduces DSearch (Dynamic Search for Diffusion). By dynamically adjusting beam width, scheduling search steps based on noise levels, and using a lookahead heuristic, DSearch successfully optimizes complex, non-differentiable reward functions across image generation, biological sequence design, and molecular optimization without requiring any fine-tuning.

What Problem Does This Paper Address?

Diffusion models excel at generating high-quality, realistic data. However, in practical applications, we often need to steer or "align" their outputs to maximize specific downstream properties—such as maximizing the aesthetic score of an image or the binding affinity of a therapeutic molecule.

Standard alignment techniques like classifier guidance rely heavily on calculating gradients through the reward function. Unfortunately, in real-world scientific domains, reward functions are frequently non-differentiable black boxes. For instance, molecular docking simulators (like AutoDock Vina) or structure predictors (like AlphaFold3) rely on physical simulations and lookup tables that do not support gradient computation.

While gradient-free alternatives exist (e.g., best-of-N sampling or value-based importance sampling), they are either computationally wasteful or struggle to find optimal generation trajectories. This paper addresses the challenge of efficiently guiding diffusion generation along high-reward paths using purely gradient-free feedback.

Methods

The authors realize that a pre-trained diffusion model inherently defines a generative tree structure. DSearch navigates this tree using three novel components:

  1. Dynamic Beam-Tree Width: Instead of maintaining a static number of candidate paths (beams), DSearch operates under a flexible memory budget constraint ($w(t)b(t) = C$). If a candidate path performs poorly, the algorithm applies early stopping (pruning) and reallocates those computational resources to branch out and further explore highly promising paths.
  2. Time-Aware Search Scheduling: In diffusion models, early denoising steps are highly noisy and contain sparse information, making intermediate reward predictions highly inaccurate. DSearch utilizes an exponential scheduling function to skip searching during early stages and heavily concentrate search efforts in the information-dense later stages.
  3. Look-Ahead Heuristic Estimation: To accurately evaluate the potential of an intermediate, noisy state, DSearch avoids simple one-step approximations. Instead, it rolls out $M$ parallel particles $K$ steps into the future to get a significantly more precise estimate of the final expected reward.
Figure 2: Illustration of DSearch. Our proposed dynamic search has expanding tree widths. We dynamically adjust weaker beams and reallocate their computational resources to other beams across time steps, fixing w(t)b(t) while strategically scheduling b(t).

Datasets

The authors validated DSearch across three distinct domains:

  • Images: Using Stable Diffusion v1.5, evaluated against reward functions for image compressibility, LAION Aesthetic Score, and Human Preference Score (HPS v2).
  • Biological Sequences: Discrete diffusion models trained on datasets of DNA enhancers and 5' Untranslated Regions (5'UTRs). Rewards were predicted using an Enformer model (for cell-specific activity) and ConvGRU models (for mean ribosomal load and stability).
  • Molecules: The GDSS graph diffusion model trained on the ZINC-250k dataset. Rewards included drug-likeness (QED), synthetic accessibility (SA), and binding affinity to the Parp1 protein.

Key Insights and Ideas

  • Diffusion as a Search Tree: Pre-trained diffusion models naturally induce a tree structure characterizing the generation process, making search theory a highly compatible framework for inference-time guidance.
  • Asymmetric Information Density: Not all diffusion steps are equally important. Searching early in the denoising process is inefficient due to high noise; waiting until later stages yields much higher precision for guidance.
  • Resource Reallocation Beats Static Budgets: Rather than treating all generation paths equally, dynamically pruning weak trajectories and expanding strong ones allows the model to discover significantly higher-reward outputs within the same compute budget.

Key Results

DSearch consistently outperformed strong gradient-free baselines (including Best-of-N, SMC, and SVDD) across all tasks while maintaining a healthy balance of sample naturalness and diversity.

Quantitative performance comparison of DSearch against baseline methods across image, biological sequence, and molecular alignment tasks.
  • Image Generation: DSearch achieved a higher Aesthetic Score (6.54) and Human Preference Score (0.3133) compared to the next-best baseline, SVDD (6.37 and 0.2970, respectively).
  • Molecular Optimization: DSearch reached a perfect Synthetic Accessibility (SA) score of 1.000 and a superior Parp1 protein docking score of 13.7 (compared to SVDD's 12.7), proving highly effective for drug discovery tasks.
  • Efficiency: Thanks to search scheduling, DSearch achieved these superior rewards while reducing computational costs by up to 35% compared to non-scheduled search baselines.

Limitations and Future Work

The primary limitation of DSearch is its increased memory footprint (when parallelized) or sequential runtime overhead (when not parallelized) compared to standard single-trajectory diffusion inference. This is an inherent trade-off of beam-search style algorithms.

For future work, the authors suggest exploring adaptive machine learning methods to dynamically learn and optimize the search and beam schedules on the fly, rather than relying on predefined hyperparameter curves (like exponential decay).

Summary updated

BibTeX
@misc{li2025dynamic,
  author = {Xiner Li and Masatoshi Uehara and Xingyu Su and Gabriele Scalia and Tommaso Biancalani and Aviv Regev and Sergey Levine and Shuiwang Ji},
  title = {{Dynamic Search for Inference-Time Alignment in Diffusion Models}},
  year = {2025},
  eprint = {2503.02039},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.02039},
}
Figure