Nodes/CFG Megapack/Mimic-Scale Thresholding (mcmonkey 2023)
ComfyUI Node

Mimic-Scale Thresholding (mcmonkey 2023)

Run cfg 20 and still get cfg 7 colours

By AbstractEyes·Created 5 days ago·Updated 5 days ago· 3
Mimic-Scale Thresholding (mcmonkey 2023)
  • model
  • MODEL
◄scale-1.0►
◄mimic_scale7.0►
◄threshold_percentile1.000►
◄separate_feature_channelstrue►
◄scaling_startpointMEAN►
◄variability_measureAD►
◄interpolate_phi1.00►
◄spaceauto (the method's own)►

Mimic-Scale is mcmonkey4eva's trick, from sd-dynamic-thresholding - the "CFG Scale Fix" that let SDXL-era models run at guidance values that would otherwise nuke the colours. It's the method behind a lot of the "why does everyone else's cfg 14 look fine" confusion of 2023, and this pack ships it as a node with the original's own knobs.

The idea

You know the trade: high cfg gets you prompt adherence and destroys your colour range. Mimic-Scale takes that literally. It computes CFG twice - once at your high scale, and once at a low "mimic" scale you actually like the colours of - and then rescales the high-scale result, per channel, so its spread matches the low-scale one's. Prompt adherence from the high scale, value distribution from the low one.

Concretely, for each sample and channel it centres both results around their own means (or around zero, if you pick that), measures the mimic copy's range and the high copy's range, and maps the high copy's spread onto the mimic's. Channels that came out unusually wide get squeezed hardest, which is exactly where the burning lives.

The inputs that matter

  • mimic_scale - the scale whose value range gets imitated. Default 7. This is the scale you'd have used if you weren't greedy about adherence, and it's the one knob you'll actually move.
  • scale - the high real scale, and it comes from your KSampler when left at -1. That's the part that trips people: you set cfg 15 to 30 on the sampler, and this node mimics 7 inside it. If cfg equals mimic_scale, the node returns plain CFG - a clean way to prove to yourself it's alive.
  • threshold_percentile - the percentile of the high-scale values treated as their range, default 1.0 (the maximum). Dropping it ignores outliers, which softens the squeeze on channels with one wild value.
  • separate_feature_channels - true measures each channel on its own, which is the original behaviour; turning it off gives you one range for the whole batch tensor.
  • scaling_startpoint - MEAN (default) rescales around each channel's mean, ZERO scales around zero.
  • variability_measure - AD measures spread by (clamped) absolute deviation, STD by standard deviation. MEAN + AD is the classic combination.
  • interpolate_phi - blends between the rescaled output and plain high-scale CFG. 1 is fully rescaled; lower it if the fix is eating real contrast.
  • space - auto unless you're deliberately experimenting.

Output: one MODEL.

Install

The original lives as an A1111 extension; you don't need it. Everything here comes from one pack.

ComfyUI Manager: search CFG Megapack in the Custom Nodes Manager, install, restart. comfy-cli: comfy node install comfy-cfg-megapack. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/AbstractEyes/comfy-cfg-megapack

Restart ComfyUI afterwards. No requirements.txt, no extra packages, no model files - the pack runs on torch plus the standard library through ComfyUI's newer comfy_api.latest node API. Tested on ComfyUI 0.38.0 with torch 2.11, GPU and CPU-only. On a shared card, CFG_MEGAPACK_VRAM_FRACTION=0.6 before launch caps the pack's GPU memory use.

Traps

  • The two scales are not the same scale. mimic_scale is the colour reference; the KSampler's cfg is the one doing the work. A reader who sets both to 7 gets plain CFG and concludes the node is broken.
  • It's an SDXL-era fix for an SDXL-era problem. The whole method assumes you're running cfg 15–30 for a reason. On a 2026 guidance-distilled model where the correct cfg is 1.0, there is no second prediction to rescale and nothing to fix - you'd be applying a fix for over-guidance to a model that isn't guided twice. Check what your checkpoint actually wants before adding this.
  • It costs a per-channel quantile per step. Not a model evaluation, but not free either, and worth knowing if you're squeezing steps.
  • It's a combine-stage node, so it's exclusive. Chain it after APG or any other combine node and you've replaced one with the other; chain it before, and it gets replaced. Same rule for the whole pack: a later node of the same stage wins. Use CFG Plan Readout to see which one is holding the stage.
CategoryCFG Megapack/papers/combining the two predictions

Inputs (9)

NameTypeDefaultDescription
modelMODEL—
scaleFLOAT-1.0-1–100The guidance scale w for this rule. -1 uses the sampler's cfg value.
mimic_scaleFLOAT7.01–30The scale whose value range is imitated.
threshold_percentileFLOAT1.0000.5–1Percentile of the high-scale values used as their range (1 = the maximum).
separate_feature_channelsBOOLEANtrueMeasure each channel on its own (off: one value per batch).
scaling_startpointCOMBOMEANRescale around each channel's mean, or around zero.
variability_measureCOMBOADMeasure the range by absolute deviation (clamped) or standard deviation.
interpolate_phiFLOAT1.000–1Blend with plain high-scale CFG (1 = fully rescaled).
spaceCOMBOauto (the method's own)Where the rule is computed. Linear rules give the same image in any space; nonlinear ones do not. 'auto' uses the space the method was published in (noise for most, denoised for APG and the angle rule, velocity for flow models).

Outputs (1)

NameTypeDescription
MODELMODEL—