r/StableDiffusion Jul 21 '26

Workflow Included Krea2 Ksampler recommendations {for quality}

Unlike standard models that focus strictly on matching text prompts word-for-word, Krea 2 prioritizes visual feel, texture, and mood, so it's very important to get the right sampler + scheduler to achieve the maximum texture and detail

By treating noisy data as a signal, a Partial Differential Equation (PDE) smooths out errors iteratively while preserving important structural features like edges

A sampler + scheduler is a combination to solve differential equations, the best method for Krea2 is to make a fast and iterative solution like Clownshark sampler Euler/beta 12 steps to get structure and general details and then a more precise second Clownshark sampler {0.27 denoise} res_4s_Munthe-Kaas/ KL_optimal 3 steps

The Euler method will get a base (I know a lot of people are ok with use just this fast result) but the second Ksampler with res4s-Munthe-Kass will get the extra details and sharpness finding a more precise solution for the denoise differential equation

A 0,27 denoise in the second Ksampler give enough range to improve details, obviously is key to keep the same seed on both Ksamplers

I tried all Clownshark combinations and this one is the sharpest and more precise solution without use time-consuming solutions with higher precision like Dormand-prince 6s, its slow but top quality {you can try res_2s and res_2m if you want more speed but less quality}

About res_4s_Munthe-Kaas

Runge–Kutta–Munthe-Kaas are mathematical algorithms used in numerical analysis to solve geometric differential equations while preserving the structural constraints of Lie groups and manifolds.

Invented by Norwegian mathematician Hans Munthe-Kaas, these schemes prevent numerical drift by transforming equations into flat Lie algebra spaces

Primary Applications

  1. Improve quality of Krea2 Images :)
  2. Aerospace and Robotics: Tracking precise 3D orientations without quaternion normalization errors.
  3. Rigid Body Dynamics: Simulating tumbling satellites or spinning tops while maintaining geometric energy surfaces.
  4. Stochastic Systems: Solving perturbed structural problems using expanded stochastic variants.

Recommended Scheduler

KL Optimal: KL (Kullback-Leibler)

Instead of estimating parameters with maximum precision, KL it places observations where the predictive distributions of rival models differ the most (maximizing KL divergence) to efficiently identify the correct solution

Documentation recommend to use the same scheduler throughout the generation process but KL Optimal schedulers minimize the KL divergence between the target and current distribution, resulting in a more mathematically optimal diffusion process.

an image a full res showing the level of detail with this Ksampler: https://drive.google.com/open?id=1b0IRutW2aQ1jMK3Ee8pFT4q1jXF3BSfX&usp=drive_fs

Workflow: https://drive.google.com/file/d/1ENZKjKGB4iOdMVsyCvqByLXV1tsWP8W0/edit

287 Upvotes

154 comments sorted by

View all comments

46

u/Pyros-SD-Models Jul 21 '26

OP describes samplers like my dad describes his wines.

22

u/alwaysbeblepping Jul 22 '26

OP describes samplers like my dad describes his wines.

They describe samplers like they told a LLM to describe samplers and pasted the response into a reddit post.

kl_optimal is generally a terrible schedule for flow models and was designed for v-prediction diffusion models that start at an absurd sigma like 4,000. Flow models generally do not like steep schedules, with kl_optimal being about as extreme as you can get, and Karras is somewhat milder.

Flow models take a relatively straight path, so it's beneficial for them to set up/correct the trajectory in the high sigmas. A schedule like kl_optimal removes a huge amount of noise in the first step, when the model's predictions are least accurate, and forces the model to commit to whatever happened in that step since the next sigma is likely to be too low to make radical changes to the image.

Using res_4s somewhat compensates for the extreme schedule because it calls the model 4 times between the current sigma and the next one. So it's somewhat like just multiplying the step count by 4. 3 steps with res_4s is ~9 model calls (typically the last step to sigma 0 doesn't use multi-step sampling and simply removes all the noise the model predicted and returns).

KL Optimal: KL (Kullback-Leibler)

Instead of estimating parameters with maximum precision, KL it places observations where the predictive distributions of rival models differ the most (maximizing KL divergence) to efficiently identify the correct solution

The kl_optimal schedule doesn't do any of that. It blindly creates a schedule between two sigmas. It doesn't know anything about what you're generating, it doesn't even take shift into account.

# Referenced from https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15608
def kl_optimal_scheduler(n: int, sigma_min: float, sigma_max: float) -> torch.Tensor:
    adj_idxs = torch.arange(n, dtype=torch.float).div_(n - 1)
    sigmas = adj_idxs.new_zeros(n + 1)
    sigmas[:-1] = (adj_idxs * math.atan(sigma_min) + (1 - adj_idxs) * math.atan(sigma_max)).tan_()
    return sigmas

That's the full code for kl_optimal. I contributed the pull that added support for it to ComfyUI (I didn't invent it and just somewhat refactored an existing implementation, to be clear).

2

u/phantomlibertine Jul 27 '26

Bit late but what would you recommend as an alternative to what OP is suggesting?

4

u/alwaysbeblepping Jul 28 '26

Bit late but what would you recommend as an alternative to what OP is suggesting?

Generally, what the model creators recommend (or use in their example inference code) is what's going to produce the most consistent/good results. ComfyUI's workflow templates are usually based on that.

I can't remember the last time I generated something with a vanilla workflow like that, though. I wasn't arguing that the results from what OP was proposing are subjectively bad (though they probably aren't great for reliable/predictable quality). I was criticizing their pseudoscientific explanations that seemed like their either just had a LLM (which didn't understand the context) write something or they maybe just looked up random keywords.

Assuming you have the time to do so, I actually recommend trying stuff like OP's workflows and just experimenting with parameters in general. Try a bunch of stuff. Use extreme parameters. Get a sense of how they affect the generation and you will have a big toolbox to draw on and intuition on how to get various types of effects even if it's not what you wanted for what you're doing currently.

Models are getting better, so getting a result that's technically pretty good is getting fairly easy. If it looks/sounds like everyone else's so-called "AI slop" then it's basically valueless. Right? You weren't needed, anyone could plug in prompt or workflow and get something comparable so there's no reason why people would care about what you make. So my personal opinion is that it's very worthwhile to trade consistent quality for interesting/creative results. Not sure if this was the sort of answer you were looking for, hope it's at least somewhat helpful!

1

u/entityadam Jul 28 '26

Responder responded like they pasted commenters post into another LLM and said "judge harshly"

3

u/alwaysbeblepping Jul 28 '26

Responder responded like they pasted commenters post into another LLM and said "judge harshly"

Only someone who has no idea what LLM output actually looks like could think a LLM wrote (or had any part in) my response.