Many sampling methods are available in NovArch AI. Euler a, Heun, DDIM… What are samplers? How do they work? What is the difference between them? Which one should you use? You will find the answers in this article.
What is Sampling?
The sampler is responsible for carrying out the denoising steps.
To produce an image, NovArch AI first generates a completely random image in the latent space. The noise predictor then estimates the noise of the image. The predicted noise is subtracted from the image. This process is repeated a dozen times. In the end, you get a clean image.
This denoising process is called sampling because NovArch AI generates a new sample image in each step. The method used in sampling is called the sampler or sampling method.
Sampling is just one part of the NovArch AI model.
Below is a sampling process in action. The sampler gradually produces cleaner and cleaner images.
Images after each denoising step.
While the framework is the same, there are many different ways to carry out this denoising process. It is often a trade-off between speed and accuracy.
Samplers overviewSamplers in NovArch AI
Old-School ODE solvers
Let’s knock out the easy ones first. Some of the samplers on the list were invented more than a hundred years ago. They are old-school solvers for ordinary differential equations (ODE).
Euler – The simplest possible solver.
Heun – A more accurate but slower version of Euler.
LMS (Linear multi-step method) – Same speed as Euler but (supposedly) more accurate.
Ancestral samplers
Do you notice some sampler’s names have a single letter “a”?
Euler a
DPM2 a
DPM++ 2S a
DPM++ 2S a Karras
They are ancestral samplers. An ancestral sampler adds noise to the image at each sampling step. They are stochastic samplers because the sampling outcome has some randomness to it.
Be aware that many others are also stochastic samplers, even though their names do not have an “a” in them.
The drawback of using an ancestral sampler is that the image would not converge. Compare the images generated using Euler a and Euler below.
Euler a does not converge. (sample steps 20)
Euler converges. (sampling steps 20)
Images generated with Euler a do not converge at high sampling steps. In contrast, images from Euler converge well.
For reproducibility, it is desirable to have the image converge. If you want to generate slight variations, you should use different seed numbers.
Karras noise schedule
The samplers with the label “Karras” use the noise schedule recommended by the Karras article. If you look carefully, you will see the noise step sizes are smaller near the end. They found that this improves the quality of images.
Comparison between the default and Karras noise schedule.
DDIM and PLMS
DDIM (Denoising Diffusion Implicit Model) and PLMS (Pseudo Linear Multi-Step method) were the samplers shipped with the original Stable Diffusion v1. DDIM is one of the first samplers designed for diffusion models. PLMS is a newer and faster alternative to DDIM.
They are generally seen as outdated and not widely used anymore.
DPM and DPM++
DPM (Diffusion probabilistic model solver) and DPM++ are new samplers designed for diffusion models released in 2022. They represent a family of solvers of similar architecture.
DPM and DPM2 are similar except for DPM2 being second order (More accurate but slower).
DPM++ is an improvement over DPM.
DPM adaptive adjusts the step size adaptively. It can be slow since it doesn’t guarantee to finish within the number of sampling steps.
UniPC
UniPC (Unified Predictor-Corrector) is a new sampler released in 2023. Inspired by the predictor-corrector method in ODE solvers, it can achieve high-quality image generation in 5-10 steps.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article