What is the Best Sampling Method for Stable Diffusion?

And What are the Differences Between Each Sampling Method?

If you’ve used Stable Diffusion in any capacity, you may have noticed a dozen different options on the “Sampling Method” section of your interface. What are all those sampling methods and how do they affect your AI art images? Which will give you the best results?

In this quick guide, I’ll explain what a sampling method is and which one you should choose for your own image generations.

What is a Sampling Method in Stable Diffusion?

What is a sampling method? In short, samplers are just different methods for solving a differential equation called a gradient descent. The differential equation it solves tells the AI software how to extrapolate an image out of visual noise.

That’s because Stable Diffusion is a latent diffusion model, which means it creates images by looking at pure noise and determining how to denoise those pixels into a coherent picture.

So each sampler (also called a sampling method) is just a slightly different mathematical approach to getting from pure noise to a comprehensible image.

How Are the Sampling Methods Different?

Because each sampling method solves the equation in a slightly different way, each sampler will have a few differences in how it denoises a prompt and how long it takes to finish an image. Generally, sampler differ in three primary ways:

  • Speed – how much time it takes for the sampler to finish a number of steps and output an image
  • Steps – how many steps it needs to make a coherent image
  • Convergence – how similar images will appear at different numbers of steps

Some samplers will run faster than others. And some samplers will require less sampling steps to make a fully-fleshed image. Some samplers will converge to the same image given enough steps while others will start looking more and more different which each extra step.

Let’s briefly review the speed and step counts of different sampling methods so you get an idea of their unique strengths and weaknesses.

Speed

Not all samplers generate images at the same speed. Some will produce the same number of steps at a faster rate, thus saving you some time. But this doesn’t mean those faster sampling methods are necessarily better, as they may end up needing far more steps to produce a good-looking image. In general, the fastest samplers are:

  • DPM++ 2M
  • DPM++ 2M Karras
  • Euler_a

Steps

Some samplers require less steps to produce a quality (i.e. coherent) image. Because less steps also means less time, using a sampler that needs less steps should save you some run time.

Generally, the following samplers require less steps to get a good image:

  • DDIM can output coherent images in as little as 8 steps
  • DPM Adaptive can also give good images in 8 steps but not as fleshed out as DDIM will look
  • Euler_a onlyneeds about 16-20 steps to produce good images
  • DPM++ 2M Karras onlyneeds 16-20 steps to get good images

In contrast, the following samplers need a lot more steps to get a good image:

  • DPM Fast will need 60-70 steps just to make an image on par with Euler_a at 20 steps
  • PLMS will need 40-60 steps to produce a quality-looking image

Convergence

A sampler that converges will give you a pretty consistent image regardless of the number of steps used. That is, an image with the same seed will look mostly the same at 20 steps vs 80 steps (albeit with more details added at 80 steps).

On the flip side, some samplers are more erratic…the image you get at 20 steps will be wildly different than what you get at 80 steps. These are divergent samplers.

Most ancestral samplers (usually have an “a” in the name for “ancestral”) will be divergent. These divergent samplers include:

  • Euler_a
  • DPM++ 2S a Karras
  • DPM++ 2S a

The following samplers are more convergent (image won’t change as much as step count increases):

  • Heun
  • DPM++ 2M Karras
  • LMS Karras

What Sampling Method Works the Best?

So which sampling method is best for generating good images in Stable Diffusion? No one sampler is “the best”, and no one sampler will give the best image for every subject or art style possible. They all do the same thing (denoise an image from pixels) and most of them will give a generally similar result given enough steps and processing time.

What’s best for you will come down to:

  1. The subjects and art styles you include in your prompts, and
  2. How fast you need Stable Diffusion to generate

With that in mind, there are some sampling methods that are more popular than others due to their dependability, speed, and/or quality at lower step counts.

The most popular samplers are:

  1. Euler_a (gives good and fast results at low steps, but tends to smooth details out)
  2. DPM++ 2M Karras (similar to Euler a but with more consistency as you increase the step count, does less smoothing than Euler_a)
  3. DDIM (very fast and needs less steps to get a good result, making it a good choice when testing out prompt changes)

I would recommend that you default to one of these 3 samplers when generating Stable Diffusion art. Once you find a prompt that gives good results, feel free to test out the other samplers and see how they change the output.

Prompt: New York City, rain, street photography, detailed, realistic, 35mm lens, by Elsa Bleda
Sampler: DPM++ 2M Karras
Steps: 20
CFG Scale: 7
Generation Time: 4.16 seconds
Prompt: New York City, rain, street photography, detailed, realistic, 35mm lens, by Elsa Bleda
Sampler: Euler a
Steps: 20
CFG Scale: 7
Generation Time: 4.02 seconds
Prompt: New York City, rain, street photography, detailed, realistic, 35mm lens, by Elsa Bleda
Sampler: DDIM
Steps: 20
CFG Scale: 7
Generation Time: 4.17 seconds

Do Different Samplers Work Better for Different Art Styles?

Some users will claim that certain samplers work better for certain art styles. But, in reality, the sampling method you select is just an equation for denoising and no one sampler is designed to denoise any specific art style.

Custom models will have a far greater impact on art style than sampling method ever will.

So, if you are struggling to get good results in a certain style with the base model of Stable Diffusion, then I recommend that you try some other models. I have a guide explaining what a custom model is, and a guide on the most popular models you can download.

Conclusion

Sampling methods all perform the same function but get to the end result in a slightly different way. This causes minute differences in how the final image will look and how many steps it takes to get a good-looking result.

I hope you found this article helpful. If so, here are a few more resources that you may like: