When you generate an image with an AI model, you often see a setting called "sampler" or "scheduler." Choosing between options like DDIM, Euler, or DPM-Solver++ can seem confusing, but it's one of the most important settings for controlling the trade-off between image quality and generation speed.

This guide explains what diffusion samplers are, how they work, and how to choose the best one for your goals.

Key takeaways

  • A "sampler" or "scheduler" is the algorithm that uses a diffusion model's output to take one step in the denoising process.
  • The choice is a complex trade-off, not just speed versus quality. It also affects image diversity, reproducibility, and how well the image follows your prompt.
  • There is no single "best" sampler. The optimal choice depends on your model, your goal (e.g., quick preview vs. final artwork), and the number of steps you can afford.
  • Modern solvers like DPM-Solver++ often provide excellent quality in a low number of steps, while older methods might need a large number of steps (Source name).
  • Deterministic samplers like DDIM produce the same image from the same seed, while stochastic samplers like Euler Ancestral create unique variations (Source name).

What Are Diffusion Samplers and Schedulers?

Diffusion samplers are the algorithms that steer the image generation process from random noise to a final, coherent picture. To understand their role, it helps to separate the three main components of the process: the model, the sampler, and the noise schedule.

  1. The Model: This is a neural network (often a U-Net) trained to look at a noisy image and predict something about the noise. For example, it might predict the noise that was added, or it might predict what the original clean image looked like. This is the core engine, but it only performs one part of the job.

  2. The Sampler (or Solver): This is the algorithm that takes the model's prediction and uses it to compute the next, slightly less-noisy version of the image. A diffusion pipeline runs the model and the sampler repeatedly in a loop (Source name). The sampler is the "driver" that decides how to use the model's prediction to take a step.

  3. The Noise Schedule: This defines the amount of noise present at each step of the process. Early steps have a lot of noise, and later steps have very little.

In practice, software libraries and user interfaces often use the terms "sampler" and "scheduler" interchangeably (Source name). When you select a sampler in a menu, you are choosing a pre-packaged combination of a specific solver algorithm and its configuration (Source name). This article focuses on the solver algorithm, which is the main difference between options like "Euler" and "DDIM."

For a deeper dive into the training process, see our guide on how diffusion models work.

How One Denoising Step Works: A Worked Example

A diffusion sampler's job is to take a noisy image at step t and produce a slightly cleaner image for step t-1. This process repeats until you reach a clean image. Let's walk through one step using a simplified numerical example to make this concrete.

Imagine the process is partway through. We have a noisy image, x_t. Our goal is to calculate the next image, x_{t-1}.

  1. Model Prediction: The diffusion model looks at the current noisy image x_t and the current timestep t. It predicts the noise that it thinks is present in the image. We'll call this predicted_noise.

  2. Estimate the Clean Image: The sampler's first task is to estimate what the final, clean image would look like if the model's noise prediction were perfect. It does this by "subtracting" the predicted noise from the current image, using coefficients from the noise schedule.

    • predicted_clean_image = C1 * (current_image - C2 * predicted_noise)

    Here, C1 and C2 are just numbers calculated from the noise schedule for step t. They ensure the math works out to scale the image and noise correctly.

  3. Calculate the Next Image: Now that it has an estimate of the clean image, the sampler can calculate the next image in the sequence, x_{t-1}. It does this by combining the predicted_clean_image and the predicted_noise, using a new set of coefficients for step t-1.

    • next_image = C3 * predicted_clean_image + C4 * predicted_noise

    This formula essentially says: "Start with our guess for the final image, and add back just the right amount of noise to get to our target noise level for the next step." The sampler takes the model output and returns this updated, less-noisy sample (Source name).

Illustrative Example with Numbers

Let's say our current_image x_t is represented by the number 1.5.

  • The model predicts the noise is 0.8.
  • The scheduler coefficients for this step are C1=1.1, C2=0.9, C3=0.95, and C4=0.3.

Step 1: Estimate the clean image. predicted_clean_image = 1.1 * (1.5 - 0.9 * 0.8) = 1.1 * (1.5 - 0.72) = 0.858 The sampler's best guess for the final image is 0.858.

Step 2: Calculate the next image. next_image (x_{t-1}) = 0.95 * 0.858 + 0.3 * 0.8 = 0.8151 + 0.24 = 1.0551 The new, slightly less noisy image is 1.0551. This next_image becomes the current_image for the next step in the loop.

This process is repeated for the desired number of steps, each time getting closer to the final result. Different samplers use different, more complex formulas for this calculation, but the core principle remains the same.

How Do You Compare Diffusion Samplers?

Diffusion samplers are often grouped by their underlying mathematical approach. The primary distinction is between deterministic methods that follow a fixed path and stochastic methods that introduce randomness. Understanding these categories helps clarify their behavior.

Here is a comparison of some common diffusion samplers.

Sampler Type Typical Steps Deterministic? Primary Use Case
DDPM Ancestral (Stochastic) Many No Foundational method, good for understanding the theory, but rarely used in practice due to slowness.
DDIM ODE Solver Low to moderate Yes (by default) Fast generation and producing reproducible images. Excellent for iterating on a prompt.
Euler ODE Solver Low Yes Very fast previews and generating a basic composition quickly. Quality can degrade at low steps.
Euler Ancestral SDE Solver (Stochastic) Low to moderate No Adding diversity and fine, textural detail. Creates unique variations from the same seed.
DPM-Solver++ Multistep ODE Solver Low Yes High-quality results in a low number of steps. A modern default for balancing speed and quality.
Heun Higher-Order ODE Solver Low to moderate Yes Producing high-quality, stable images, often with better prompt adherence than simpler solvers.

DDPM vs. DDIM vs. Euler: What's the Difference?

These three samplers represent foundational concepts in diffusion, and understanding them clarifies how modern samplers evolved. They differ in how they model the denoising process, which affects their speed, determinism, and the path they take from noise to image.

DDPM (Denoising Diffusion Probabilistic Models)

DDPM is the original ancestral sampler. It is a probabilistic process that closely mirrors the reverse of how the model was trained (Source name). At each step, it predicts the noise and then adds a small amount of new random noise back in. This makes the process stochastic, meaning it's not repeatable even with the same starting point. DDPM typically requires a large number of steps to produce a high-quality image, making it too slow for most practical applications today.

DDIM (Denoising Diffusion Implicit Models)

DDIM is a more efficient formulation that can be deterministic. It achieves this by defining a path that doesn't require adding new noise at every step (Source name). This allows it to skip many steps in the denoising sequence, enabling much faster generation with comparable quality. Because it's deterministic by default, DDIM is excellent for reproducibility. If you use the same seed, prompt, and settings, you will get the same image every time. Most modern samplers are based on the ideas introduced by DDIM.

Euler

Euler is the simplest numerical method for solving an Ordinary Differential Equation (ODE), which is the mathematical framework behind deterministic samplers like DDIM. It's a first-order solver, meaning it takes one simple, straight-line step at a time. This makes it very fast, but it can be less accurate, especially with a low number of steps. A related method, Euler Ancestral, reintroduces noise at each step, making it stochastic (Source name). This can sometimes improve perceived image detail and diversity at the cost of being non-reproducible.

Which Sampler Should You Choose?

The best diffusion sampler depends entirely on your goal. There is no single "best" option, only the right tool for the job. Here is a practical guide for choosing a sampler based on what you want to achieve.

For Maximum Quality

Choose a higher-order solver like DPM-Solver++ (2M Karras) or Heun. These methods are designed to be highly accurate and converge to a high-quality image in a moderate number of steps. They use information from previous steps to make a more accurate prediction for the current step (Source name). They are excellent for final renders where detail and prompt adherence are critical.

For Fast Previews

Choose a simple, fast solver like Euler or a modern fast solver like DPM-Solver++. At a very low step count, Euler will give you a rough but recognizable impression of the image's composition and color palette. DPM-Solver++ can also produce surprisingly good previews at a low step count. This is ideal for quickly testing different prompts or ideas.

For Reproducibility and Iteration

Choose any deterministic sampler, such as DDIM, Euler, or a non-ancestral DPM-Solver++. When you use a deterministic sampler with a fixed seed, you will get the exact same image every time. This is essential when you find a good result and want to make small tweaks to the prompt, like changing "a red car" to "a blue car," without altering the entire composition.

For Creative Diversity

Choose a stochastic or ancestral sampler, such as Euler Ancestral. These samplers inject a small amount of random noise at each step. As a result, generating an image multiple times with the same seed will produce slightly different variations. This can be a great way to explore creative possibilities around a central theme or add fine, unpredictable details to textures like fur or foliage.

For Model Compatibility

Always check the documentation for the model you are using. Some models are trained or fine-tuned with specific schedulers in mind. While most samplers can be used with most models (Source name), you might get better results by using the one recommended by the model's creators. This is especially true for specialized or newer architectures, like those used in some forms of AI video generation.

What to learn next

Sources and further reading