# Sampling method

There are several sampling methods are available in Dreamerland including Euler A, Euler, DDIM, DPM++ 2M Karras, DMP++2M SDE Karras and UniPC

<figure><img src="https://2310956826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftbrc6W2n35oVxftMovDQ%2Fuploads%2FIdmr1nYlDYUhleB1itzh%2FIMG_7752.jpg?alt=media&#x26;token=687f8c7e-a394-4de7-8f7d-a19cc2bac56e" alt="" width="375"><figcaption></figcaption></figure>

In order to understand what sampling method is, we have to know how Stable Diffusion generate an image from scratch.

To generate an image, Stable Diffusion begins by generating a completely random image in the latent space. Then, the noise predictor estimates the noise within the image, which is subsequently subtracted. This iterative process is repeated multiple times, resulting in a final output of a clean image.&#x20;

The process to remove noise and generate new images at each step is referred to as **sampling**. The method used in sampling is called the sampler or sampling method. The sampling method remove noise and generate a cleaner image each step.&#x20;

<figure><img src="https://2310956826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftbrc6W2n35oVxftMovDQ%2Fuploads%2FARKlpwl1unyYO4sO4o3S%2Fcat_euler_15.webp?alt=media&#x26;token=f8ea4586-fdf6-48f5-9114-d06948243108" alt="" width="256"><figcaption><p>Sampling process step by step</p></figcaption></figure>

**What the difference between sampling methods?**

They are different mathematic method to predict noise. We will give you a big picture of each one but we won't go into technical here.

**Euler A and Euler**

A stands for Ancestral. Ancestral sampler will add noise to the image at each step. Therefore the result of Euler A will be more creative. However, Euler A would not converge because noise will be added at each step to introduce randomness.

<figure><img src="https://2310956826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftbrc6W2n35oVxftMovDQ%2Fuploads%2FHrBLPQQ7jNhlWHJvgZsi%2Feuler-2-40.webp?alt=media&#x26;token=3c6cbd65-617b-4f7a-9001-d0d6d70854c2" alt="" width="256"><figcaption><p>Euler</p></figcaption></figure>

<figure><img src="https://2310956826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftbrc6W2n35oVxftMovDQ%2Fuploads%2FcRy8t8WHHhLIWxymCekh%2Feuler-a-2-40.webp?alt=media&#x26;token=5b115561-d0ef-4dfb-8ab4-892990a4b5b9" alt="" width="256"><figcaption><p>Euler A</p></figcaption></figure>

**DDIM**

DDIM (Denoising Diffusion Implicit Model) is one of the first samplers designed for diffusion models. DDIM only takes eight steps to achieve incredible images

**DPM++**

DPM++ trades speed for quality. It normally take more steps than other sampling methods to get high quality images. It’s better suited for highly tuned prompts.

**UniPC**&#x20;

UniPC (Unified Predictor-Corrector) Framework for Fast Sampling of Diffusion Models is introduced in 2023 by Wenliang Zhao, Lujia Bai, Yongming Rao, Jie Zhou, Jiwen Lu. it can achieve high-quality image generation in **5-10 steps**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dreamerland.ai/basic-terms/sampling-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
