Learn ComfyUI Foundations: From Zero to First Image The KSampler: Steps, CFG, Seed, and Scheduler

The KSampler: Steps, CFG, Seed, and Scheduler

Beginner 🕐 12 min Lesson 8 of 13
What you'll learn
  • Adjust the six KSampler settings (seed, steps, cfg, sampler_name, scheduler, denoise) and predict how each change will affect the output
  • Choose appropriate starting settings for text-to-image generation and explain the quality-vs-speed tradeoff in the steps parameter
  • Use a fixed seed to reproduce an exact result and explain when randomizing the seed is preferable

The KSampler Is the Engine

Every image ComfyUI generates passes through the KSampler. It is the node that actually runs the diffusion process — taking the blank noise latent from Empty Latent Image, guided by your positive and negative conditioning, and iteratively denoising it over a specified number of steps until the result matches what your prompt described.

The KSampler has six settings that control how this process runs. Getting these right makes the difference between fast, high-quality results and slow, broken-looking ones. This lesson covers each setting, what it does, and what values work well as starting points.

Seed: Reproducibility

The seed is an integer that initializes the random noise pattern the KSampler starts from. If every other setting stays the same and you run the same seed, you will get an identical image. If you change the seed, you get a completely different result.

There are two modes:

  • Fixed seed: Type a specific number. Use this when you have found an image you like and want to make small adjustments (to the prompt, steps, or other settings) while keeping the same general composition. The image will evolve from the same starting point.
  • Random seed: Click the randomize button (the dice icon) or set the seed value to -1. Every run starts from a different noise pattern, producing different results. Use this for exploration when you are not attached to a specific composition yet.

A practical workflow: use random seed while exploring prompts, switch to a fixed seed once you find a promising direction.

Steps: How Many Denoising Passes

Steps controls how many times the KSampler runs its denoising algorithm. More steps produce a more refined result — up to a point. The quality improvement from step 1 to step 20 is dramatic. From step 20 to step 40, it is modest. Beyond 50 steps, you are mostly spending GPU time for marginal gains.

Practical starting points:

  • 10–15 steps: Fast previews. Useful for testing prompts when you want quick feedback. Quality is noticeably lower.
  • 20 steps: The default. Good quality for most purposes. Use this as your standard.
  • 30–40 steps: Higher quality, especially for intricate details. Worth the extra time for final outputs.
  • 50+ steps: Rarely needed. Reserve for specific use cases like very high-detail scientific or architectural renders.

CFG: How Strictly the Model Follows Your Prompt

CFG stands for Classifier-Free Guidance scale. It controls how aggressively the model steers the generation toward your prompt versus allowing creative latitude.

  • Low CFG (1–4): The model largely ignores your prompt and generates whatever it considers coherent. Useful for very abstract or painterly styles where you want the model to improvise.
  • Medium CFG (5–9): The model follows your prompt but with some interpretation. 7.0 is the traditional default for SD 1.5 and produces well-balanced results.
  • High CFG (10–20): The model follows your prompt very strictly. The image can start to look oversaturated or artifacted at high CFG values.

For FLUX.1 models, use CFG 1.0. FLUX uses a guidance system that is fundamentally different from CFG — setting it above 1.0 in a standard FLUX workflow typically produces degraded results. Some FLUX workflows use a separate guidance scale node instead of the CFG field entirely.

Sampler Name: The Denoising Algorithm

The sampler determines the mathematical algorithm used for each denoising step. Different samplers produce different-looking results and have different speed-quality tradeoffs.

  • euler: The default. Fast, reliable, produces good results. Start here.
  • euler_ancestral (euler_a): Adds stochasticity (randomness) at each step. Often produces more creative, varied results at the cost of less reproducibility even with the same seed.
  • dpm++2m: Popular choice for high-quality results with moderate step counts. Slightly slower than euler but often produces sharper detail.
  • dpm++sde: A stochastic variant of dpm++2m. Very popular for artistic workflows.
  • lcm: Latent Consistency Model sampler — designed for very low step counts (4–8 steps). Requires a specific LCM-compatible LoRA or model.

For learning: stick with euler. Once you are comfortable, try dpm++2m and compare the results at 20 steps.

Scheduler: How Noise Decreases Over Steps

The scheduler controls the noise level at each step — specifically, how quickly the noise decreases from maximum (the starting state) to zero (a fully denoised image). Different schedules emphasize different parts of the generation process.

  • normal: The default linear schedule. A good baseline.
  • karras: Concentrates more denoising effort in the final steps, where fine detail is added. Often produces sharper, more detailed results than normal at the same step count. Very commonly used with dpm++2m.
  • exponential: Similar to karras with a different curve. Worth trying if karras does not suit your model.
  • sgm_uniform: Used internally by SDXL. Generally not changed manually.

A popular combination for quality: dpm++2m sampler + karras scheduler at 25–30 steps.

Denoise: Full for Text-to-Image, Less for Image-to-Image

Denoise controls what fraction of the steps the KSampler actually runs. At 1.0 (the default), the sampler starts from pure noise and runs all steps — this is standard text-to-image generation. At 0.7, the sampler starts 70% of the way through the denoising process, meaning it starts from a partially denoised image rather than pure noise.

For text-to-image generation, always leave denoise at 1.0. The denoise setting only becomes relevant in image-to-image workflows (Lesson 5 of the Image Generation track), where you start from an existing image rather than blank noise.

Starting Settings That Work

If you are not sure where to start, use these settings for SD 1.5:

  • seed: random (or any fixed integer)
  • steps: 20
  • cfg: 7.0
  • sampler_name: euler
  • scheduler: normal
  • denoise: 1.0

For FLUX.1: steps 20–30, cfg 1.0, sampler euler, scheduler simple, denoise 1.0. You will see these settings used throughout the image generation track.

Key takeaways
  • The seed determines the starting noise pattern — a fixed seed with unchanged settings reproduces an identical image; use random seed for exploration and fixed seed when refining a promising composition.
  • Steps controls quality vs. speed — 20 steps is the standard default; 30–40 for final outputs worth the extra time; 50+ is rarely necessary.
  • CFG 7.0 is the standard for SD 1.5 — higher values make the model follow the prompt more strictly but can produce artifacts above 12; FLUX.1 requires CFG 1.0 because it uses a different guidance architecture.
  • The sampler is the denoising algorithm — euler is a reliable default; dpm++2m with karras scheduler is a popular quality combination that produces sharper detail at moderate step counts.
  • Denoise should always be 1.0 for text-to-image generation — lower denoise values only apply to image-to-image workflows where you start from an existing image rather than blank noise.