DynamicThresholdingSimplePost
Run high CFG without the color burn
- model
- MODEL
Crank CFG on an SDXL model and you know the look: neon-fried colors, contrast cranked to eleven, faces that start to melt. The usual fix is "lower your CFG," but then you lose the prompt adherence you wanted the high CFG for. Dynamic Thresholding is the trick that lets you keep both - high guidance for the adherence, but with the color statistics clamped down so it doesn't blow out. This is the simple variant: two knobs, sane defaults, the one you should reach for first.
Where this comes from
Dynamic Thresholding is Alex "mcmonkey" Goodwin's technique (of SwarmUI and SD3 fame), originally the sd-dynamic-thresholding extension. The core idea, which he credits to Birch-san: it works by clamping the latent between sampling steps so higher CFG scales stop producing color damage. Rather than let the guided prediction run wild, it measures what a lower CFG (the "mimic" scale) would have produced and rescales the real, high-CFG result to match those statistics. You get the structure and adherence of high guidance with the tonal range of low guidance.
The "Post" in the name is the important pack-specific bit. Pamparamm rebuilt several CFG-related nodes as post-CFG functions so they compose cleanly - you can chain this after RescaleCFGPost, a guidance limiter, or another CFG tweak without them fighting each other. The old monolithic dynamic-thresholding node didn't play nice in a stack; this one does.
The two inputs
- mimic_scale (default 8) - the CFG value you want the color statistics to imitate. Set your actual KSampler CFG high (say 12–15) for adherence, and set
mimic_scaleto something tame like 6–8. The image obeys the prompt like it's at 15 but is toned like it's at 7. - threshold_percentile (default 1) - how aggressively it clamps outliers. 1.0 means "use the full range, clamp nothing extra"; drop it slightly (0.95–0.99) to crush the very brightest spikes harder. Most people leave it at 1.
MODEL in, MODEL out. Drop it between your model loader and your sampler - it's a patch, so it works with a plain KSampler, no SamplerCustomAdvanced required.
Install
No models, no dependencies - it's sampling math.
- ComfyUI Manager: search "ComfyUI-ppm", install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/pamparamm/ComfyUI-ppm, then restart.
Common issues & troubleshooting
No visible effect. Two usual causes. One, your actual CFG isn't high enough for there to be anything to tame - this earns its keep when you're pushing CFG well past the family's normal range. Two, you're on a distilled or guidance-distilled model (Z-Image Turbo, Flux, anything running at CFG 1). Those don't run real classifier-free guidance, so there's no high-CFG burn for dynamic thresholding to correct. This is an SD 1.5 / SDXL tool.
It fights your other CFG nodes. It shouldn't - that's the entire point of the Post variant. But mind the order: put the thing that sets the guidance behavior earliest and the thresholding after it. If results look wrong, bypass the rest of the stack and add nodes back one at a time.
Want more control? The full version, DynamicThresholdingFullPost, exposes the scaling startpoint, variability measure, and channel handling. Start here; graduate to that only if these two knobs aren't enough.
Pack rule: erroring after an update? Delete the node and re-add it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| mimic_scale | FLOAT | 8.00–100 | — |
| threshold_percentile | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |