Nodes/ComfyUI-ppm/DynamicThresholdingFullPost
ComfyUI Node

DynamicThresholdingFullPost

The full-control CFG color clamp

By pamparamm·Created 2 years ago·Updated about 12 hours ago· 265
DynamicThresholdingFullPost
  • model
  • MODEL
mimic_scale8.0
threshold_percentile1.00
separate_feature_channelsfalse
scaling_startpointMEAN
variability_measureAD
interpolate_phi1.00

This is Dynamic Thresholding with every knob exposed. The class is DynamicThresholdingPost but it shows up in the menu as DynamicThresholdingFullPost - the big sibling of the two-input Simple version. Same job: let you run high CFG on SDXL-class models for the prompt adherence without the deep-fried colors. The difference is that this one hands you the internals - how it measures spread, where it centers the rescale, whether it treats color channels together or apart. Reach for it when the simple two-knob version is close but not quite there.

The mechanism, grounded

Dynamic Thresholding is Alex "mcmonkey" Goodwin's technique (originally the sd-dynamic-thresholding extension, core idea credited to Birch-san). It clamps the latent between sampling steps so that higher CFG scales stop wrecking the colors. Concretely: it takes the statistics a low "mimic" CFG would have produced and rescales your actual high-CFG prediction to match, so the image keeps high-guidance structure but low-guidance tonal range.

The "Post" naming is Pamparamm's doing - this is a post-CFG function, built to chain cleanly with the pack's other CFG nodes (RescaleCFGPost, RenormCFGPost, the guidance limiter) instead of stomping on them.

The inputs

Only two of these matter on day one; the rest are for when you're chasing a specific artifact.

  • mimic_scale (default 8) - the CFG whose color statistics you want to imitate. Run your real CFG high, set this low, get adherence-at-15 with color-at-8.
  • threshold_percentile (default 1) - outlier clamp aggressiveness. 1.0 clamps nothing extra; nudge down to 0.95–0.99 to crush the brightest spikes harder.

The advanced set:

  • separate_feature_channels (default false) - whether to compute the rescale per latent channel instead of across all of them at once. On can help when one color channel is blowing out more than the others.
  • scaling_startpoint (default MEAN) - the reference point the rescale centers on (the mean of the latent, versus zero). MEAN is the safe default and what you want almost always.
  • variability_measure (default AD) - how it measures spread before rescaling: AD (average/absolute deviation) or standard deviation. AD is more robust to outliers, which is usually what you want here.
  • interpolate_phi (default 1) - how far to blend between the thresholded result and the raw high-CFG result. 1.0 = full dynamic thresholding; lower it to dial the whole effect back toward untouched.

MODEL in, MODEL out. It's a model patch, so it works with a plain KSampler.

Install

No downloads, no dependencies.

  • 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

Start with the Simple node. Honestly - DynamicThresholdingSimplePost covers most cases with two knobs. Only come here when you can name the problem you're solving (one channel burning, effect too strong, spiky highlights). The extra parameters are easy to over-tune into a muddy image.

No effect. Same trap as the simple version: your CFG isn't high enough to need clamping, or you're on a distilled / guidance-distilled model (Flux, Z-Image Turbo, anything at CFG 1) that never runs real CFG in the first place. This is an SD 1.5 / SDXL tool.

interpolate_phi is your safety valve. If tuned settings look worse than default, pull interpolate_phi down to blend back toward the raw output rather than fighting the other knobs.

Pack rule: node throwing errors after an update? Delete and re-add it.

Categorymodel_patches/unet

Inputs (7)

NameTypeDefaultDescription
modelMODEL
mimic_scaleFLOAT8.00–100
threshold_percentileFLOAT1.000–1
separate_feature_channelsBOOLEANfalse
scaling_startpointCOMBOMEAN2 options: MEAN, ZERO
variability_measureCOMBOAD2 options: AD, STD
interpolate_phiFLOAT1.000–1

Outputs (1)

NameTypeDescription
MODELMODEL