Nodes/Dynamic Thresholding/DynamicThresholdingSimple
ComfyUI Node Runs on cloud

DynamicThresholdingSimple

DynamicThresholdingSimple - ComfyUI Node

By mcmonkeyprojects·Created 4 years ago·Updated about a year ago· 1,224
DynamicThresholdingSimple
  • model
  • MODEL
mimic_scale7.0
threshold_percentile1.00

If you've ever cranked CFG scale up to make a model actually listen to your prompt, you've probably watched the image turn into a deep-fried, oversaturated mess for your trouble. That's the exact problem Dynamic Thresholding - better known as "the CFG Scale Fix" - was built to solve, and DynamicThresholdingSimple is the no-fuss version of it. Drop it in, set two numbers, and you can push CFG way past where it normally falls apart.

How it works. Under the hood this is a MODEL patch: it wraps your checkpoint's sampling function so the CFG math runs differently at every step. Instead of applying your (jacked-up) CFG value directly, it also computes a milder "mimicked" prediction at a lower guidance scale, then clamps the extreme values from your real CFG back toward that tamer result before each denoising step. That clamping-to-a-percentile trick is the "dynamic thresholding" the name refers to - it's the same idea Google used in Imagen to stop high-guidance images from blowing out. The upshot: you get the extra prompt obedience that high CFG buys you, minus the sunburn. The author, mcmonkey (Alex Goodwin - also the developer behind SwarmUI), didn't invent the underlying technique; the credits in the repo trace it to Birch-san's original research, with mcmonkey building the UI and doing the ComfyUI/SwarmUI ports. It's been around since January 2023, which makes it one of the older tricks still floating around the ecosystem.

Inputs that matter. There are only three, which is the whole point of the Simple variant:

  • model - your checkpoint's MODEL output, straight from the loader.
  • mimic_scale (default 7) - roughly, the CFG value the algorithm pretends you're using when it computes the "sane" reference image to clamp toward. Leave it near the normal sweet spot for your model family (7 for SD1.5/SDXL, 4-6 for Pony/Illustrious).
  • threshold_percentile (default 1, range 0-1) - how aggressively the clamp bites. At 1 you're getting the full effect; dial it down if you want a lighter touch.

The single output is MODEL - a patched version of what you fed in. You don't do anything else with it except plug it straight into your KSampler's model input in place of the checkpoint loader's direct connection. Then, critically, you crank the CFG value on the KSampler itself - DT doesn't do anything if your sampler's CFG is already sitting at a normal 7. People running this in practice report using KSampler CFG in the 12-18 range with mimic_scale left around what they'd normally use, and getting away with it cleanly.

Installing it. There's no ComfyUI Manager walkthrough written into the README (the author left that section a TODO), but the pack has been around long enough that searching "Dynamic Thresholding" in Manager is worth trying first. Failing that, the manual route the README actually documents:

cd ComfyUI/custom_nodes
git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding

Restart ComfyUI. No extra Python packages, no model downloads - it's pure logic bolted onto the sampling function, so this is about as light an install as custom nodes get. Once it's up, find the node under advanced/mcmonkey in the add-node menu, or just double-click the canvas and type "dynamic thresholding" into the search box.

Where people get stuck. The single biggest gotcha is exactly what I flagged above: adding this node and then leaving your KSampler's CFG at the default does nothing useful - you have to actually push CFG up for there to be anything to clamp. The README does note one real compatibility caveat: this works by patching the sampling function, so it's compatible with basically any KSampler variant, custom ones included, unless that custom sampler completely overrides ComfyUI's internal sampling function rather than just wrapping it - most don't, but if you're chaining a more exotic custom KSampler and getting no effect at all, that's the first thing to suspect.

Worth knowing before you reach for this: it's very much a 2023-era SD1.5/SDXL-era tool. It's still legitimately useful if you're running Illustrious, Pony, or classic SDXL checkpoints at high CFG - but a lot of 2026's newer models (distilled Turbo/Lightning checkpoints, Flux-lineage stuff) run CFG effectively fixed near 1, where this node has nothing to do. If your workflow is one of those, you can skip it entirely. If you're still fighting burned SDXL outputs at CFG 10+, it does exactly what it says.

If two numbers isn't enough control - you want to schedule how mimic_scale or CFG ramps across steps, or tweak the clamping math itself - the sibling node DynamicThresholdingFull exposes all of that.

Categoryadvanced/mcmonkey

Inputs (3)

NameTypeDefaultDescription
modelMODEL
mimic_scaleFLOAT7.00–100
threshold_percentileFLOAT1.000–1

Outputs (1)

NameTypeDescription
MODELMODEL