Optimize Your Sampling: Tuned Diffusion Sampling with Bayesian Optimization

Travis Zhang, Christian Belardi, Justin Lovelace, Jin Peng Zhou, Saebyeol Shin, Carla P. Gomes, Kilian Q. WeinbergerarXiv 2026

TL;DR

Generating images from diffusion models is notoriously slow due to the dozens of sequential network passes required. This paper introduces Optimizing Your Sampling (OYS), a method that uses Bayesian optimization to directly find the best sampling timesteps and parameters for low-step generation. By treating timestep selection as a black-box problem, OYS delivers 5-step schedules that retain up to 94% of the quality of a standard 50-step schedule, slashing inference costs by 10x without any retraining.

What Problem Does This Paper Address?

While diffusion models achieve state-of-the-art results in image and video generation, their iterative denoising process is computationally expensive. To make generation practical, researchers often try to reduce the number of sampling steps. However, at low step budgets (e.g., 5 steps), standard uniform sampling schedules degrade rapidly.

Previous attempts to optimize these timesteps (like Align Your Steps / AYS) rely on minimizing theoretical mathematical proxies, such as KL divergence upper bounds, rather than optimizing the actual output quality. Unfortunately, these theoretical proxies do not perfectly align with human perception or final image quality metrics. OYS addresses this gap by directly optimizing the target evaluation metrics themselves.

Methods

The authors propose Optimizing Your Sampling (OYS), which treats timestep selection as a black-box optimization problem. Instead of relying on a proxy, OYS directly optimizes the final target metric—such as the Human Preference Score (HPS), Fréchet Inception Distance (FID), or LPIPS—by generating images and evaluating them in a loop.

To navigate this optimization space efficiently without gradient information, OYS leverages Bayesian Optimization with a Gaussian Process surrogate model and a qLogNEI acquisition function.

Key methodological details include:

  • Cumulative Product Reparameterization: To ensure that the selected timesteps are monotonically decreasing (from high noise to a clean image), OYS optimizes a set of continuous parameters bounded between 0 and 1, using their cumulative product to construct the schedule.
  • Holistic Parameter Tuning: For models like the EDM family, OYS goes beyond timesteps alone. It jointly optimizes other critical sampling hyperparameters, including the noise boundaries ($\sigma_{min}, \sigma_{max}$), exponential moving average (EMA) length, and classifier-free guidance strength.
Figure 2: Overview of our Optimize Your Sampling (OYS) framework using Bayesian Optimiza- tion. The process begins with Acquisition Maximization (top left), where promising sampling configurations are identified. The selected configuration undergoes Black Box Metric Evaluation (right). This consists of generating images with the diffusion model and scoring them using metrics like FID and HPS. Results update the surrogate model’s posterior distribution (bottom left), refining our understanding of the configuration space. This cycle repeats until convergence or budget exhaustion, efficiently discovering effective sampling parameters.

Datasets

The method was evaluated across multiple tasks and models using several prominent datasets:

  • COCO Captions: Used for tuning and validating text-to-image generation (on DeepFloyd, Stable Diffusion v1.5, and SDXL) as well as image inpainting tasks.
  • DiffusionDB: Used to evaluate newer, large-scale models like FLUX.1-dev and QwenImage.
  • ImageNet-512: Used to evaluate the EDM2 model family across various model complexities.
  • Prompt Diffusion Dataset: A specialized dataset used to evaluate inverse image tasks, such as converting HED edge maps, depth maps, and semantic segmentation maps back into photorealistic images.

Key Insights and Ideas

  • Proxies vs. Reality: Theoretical surrogates (like the KL divergence bound used in AYS) tend to keep optimized schedules very close to default uniform spacings. OYS demonstrates that directly optimizing the end metric uncovers radically different, superior schedules that proxies miss.
  • Front-Loading the Noise: OYS consistently discovers that short schedules perform best when they allocate more steps to high-noise timesteps (early in the generation process). This directly contradicts standard uniform log-SNR spacing heuristics.
  • The Power of Joint Optimization: Sampling performance isn't just about timesteps. Jointly tuning guidance strength and noise boundaries alongside timesteps yields massive quality boosts that traditional tuning methods leave on the table.

Key Results

  • Extreme Acceleration: A 5-step OYS schedule retains 89%–94% of the quality of a 50-step schedule, successfully reducing inference cost by 10x.
  • Text-to-Image Superiority: In a 5-step generation setup on SDXL, OYS achieved a 70.7% win rate against the default schedule and significantly outperformed AYS in human preference.
  • Inpainting & Inverse Tasks: For inpainting, OYS improved PSNR by 6.9 dB on SDXL and 2.9 dB on SDv1.5, completely preventing the full-image corruption that typically plagues low-step default schedules.

Qualitative comparisons using a 5-step sampling schedule User study win rates on SDXL Inpainting results showing OYS preserving unmasked regions

Limitations and Future Work

  • Upfront Tuning Cost: Because OYS evaluates the actual target metric, it requires generating thousands of images during its search phase. While this cost is paid only once per model/task and is heavily amortized over future inferences, it is more computationally demanding during the tuning phase than proxy-based mathematical solvers.
  • Domain Dependency: The optimized schedules are inherently domain-dependent. A schedule optimized for text-to-image generation on a specific dataset will not automatically generalize as a "universal" schedule for other tasks like inpainting.

Summary updated

BibTeX
@misc{zhang2026optimize,
  author = {Travis Zhang and Christian Belardi and Justin Lovelace and Jin Peng Zhou and Saebyeol Shin and Carla P. Gomes and Kilian Q. Weinberger},
  title = {{Optimize Your Sampling: Tuned Diffusion Sampling with Bayesian Optimization}},
  year = {2026},
  eprint = {2608.18040},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.18040},
}
Figure