Skip to content

feat: add LCM scheduler and use it by default for LCM sampling#983

Merged
leejet merged 3 commits into
leejet:masterfrom
wbruna:lcm_scheduler
Nov 22, 2025
Merged

feat: add LCM scheduler and use it by default for LCM sampling#983
leejet merged 3 commits into
leejet:masterfrom
wbruna:lcm_scheduler

Conversation

@wbruna

@wbruna wbruna commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

Implement the linear LCM scheduler, as defined e.g. in Diffusers' LCMScheduler, and select it by default with the LCM sampler.

The main change is ensuring the timesteps match the LCM training schedule. The default discrete scheduler can choose unmatched timesteps, which tend to require higher step counts to avoid artifacts and blurring. It is more noticeable with detailed images, or when the model isn't pushed too hard (e.g. with minimal prompts). simple and sgm_uniform tend to generate much better results, but I’d guess that’s mostly by chance.

Not every generation is better, and when compared with simple, it isn’t clear there’s even a benefit; but it’s easier to notice the difference when comparing with discrete. A few examples with 4 steps, somewhat cherry‑picked to avoid the worst abominations:

discrete lcm
lcm_1763329553 lcm_1763329568
lcm_1763329678 lcm_1763329680
lcm_1763330029 lcm_1763330042
lcm_1763329682 lcm_1763329719

I can’t properly test video generation, so I didn’t change its default; just let me know if I should.

Another consideration: since this change mostly affects how the timesteps are rounded, a better alternative might be adding an extra parameter to all schedulers to request this behavior. This could make LCM models (and perhaps other distillations) behave better across all schedulers at once.

@leejet leejet merged commit 45c4677 into leejet:master Nov 22, 2025
9 checks passed
akleine added a commit to akleine/stable-diffusion.cpp-JetsonNano that referenced this pull request Mar 15, 2026
inspired by wbruna's leejet/stable-diffusion.cpp#983
plus
renamed constants & variable names from "schedule" to "scheduler"
akleine added a commit to akleine/stable-diffusion.cpp-JetsonNano that referenced this pull request Mar 15, 2026
inspired by wbruna's leejet/stable-diffusion.cpp#983
plus
renamed constants & variable names from "schedule" to "scheduler"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants