Nodes/advanced-cfg-controller/⚙️ Advanced CFG Controller (Expert)
ComfyUI Node

⚙️ Advanced CFG Controller (Expert)

Every knob on the sampler's steering wheel

By FlareAI-Studios·Created 8 months ago·Updated 8 months ago· 1
⚙️ Advanced CFG Controller (Expert)
  • model
  • attention_modifiers_positive
  • attention_modifiers_negative
  • attention_modifiers_fake_negative
  • attention_modifiers_global
  • MODEL
  • STRING
adaptive_cfgHard Intensity
adaptive_cfg_topk0.25
adaptive_cfg_ref8.0
skip_uncondtrue
uncond_sigma_start1000.0
uncond_sigma_end1.0
fake_uncond_startfalse
fake_uncond_expfalse
fake_uncond_exp_methodUse Positive
fake_uncond_exp_value2.0
fake_uncond_exp_normalizefalse
fake_uncond_multiplier1
fake_uncond_sigma_start1000.0
fake_uncond_sigma_end1.0
lerp_uncondfalse
lerp_uncond_strength2.0
lerp_uncond_sigma_start1000.0
lerp_uncond_sigma_end1.0
subtract_latent_meanfalse
subtract_latent_mean_sigma_start1000.0
subtract_latent_mean_sigma_end1.0
latent_intensity_rescalefalse
latent_intensity_rescale_methodHard Measurement
latent_intensity_rescale_cfg8.0
latent_intensity_rescale_sigma_start1000.0
latent_intensity_rescale_sigma_end3.0
cond_expfalse
cond_exp_normalizefalse
cond_exp_sigma_start1000.0
cond_exp_sigma_end1.0
cond_exp_methodAmplify
cond_exp_value2.0
uncond_expfalse
uncond_exp_normalizefalse
uncond_exp_sigma_start1000.0
uncond_exp_sigma_end1.0
uncond_exp_methodAmplify
uncond_exp_value2.0
attention_modifiers_global_enabledfalse
disable_condfalse
disable_cond_sigma_start1000.0
disable_cond_sigma_end0.0
enable_performance_monitoringfalse
adaptive_noise_strength0.00
spectral_norm_target1.0
frequency_filter_cutoff0.50
dynamic_range_compression1.00
args_filter

The Expert node is the engine room of the Advanced CFG Controller pack. Where the Easy Mode node hides everything behind presets, this one hands you fifty-plus parameters and trusts you not to break anything. Same underlying machinery - it clones your model, swaps in its own step-by-step CFG function, and adds hooks around the conditional and unconditional passes - but now every dial is exposed, and the sigma windows are the raw values instead of friendly "from step / until step" numbers.

Before you commit an afternoon to it, the same caveat as the Easy version: this pack is built for classic DDPM models (SD 1.5, SDXL, and their fine-tunes) that run real CFG. On a guidance-distilled model that lives at CFG 1 there's no uncond pass to amplify or skip, so the whole premise collapses. It's also a fresh, single-commit pack from FlareAI-Studios - no community track record, so treat behavior as subject to change.

The sections, grouped

The inputs sort into families, and knowing the family beats memorizing names:

  • Adaptive CFG - adaptive_cfg (Disabled / Soft Intensity / Hard Intensity / Hard Squared / Range Based / Spectral Analysis), adaptive_cfg_topk, and adaptive_cfg_ref. This measures the latent's intensity each step and steers the effective scale toward adaptive_cfg_ref (default 8). Lower adaptive_cfg_topk = finer measurement, slower.
  • Skip the negative - skip_uncond plus uncond_sigma_start/end controls the window where the unconditional pass is skipped (your speed boost). fake_uncond_start and the fake_uncond_exp* family decide what substitutes for the real negative: fake_uncond_exp_method offers a huge menu (Use Positive, Zero Tensor, Sine Wave, Amplify, even "The Darkness"), fake_uncond_exp_value its strength, fake_uncond_multiplier flips it to -1, 0, or 1.
  • Blending - lerp_uncond blends positive and negative predictions together within a sigma window; lerp_uncond_strength is how hard.
  • Post-CFG color - subtract_latent_mean fixes color drift by centering latent values, latent_intensity_rescale rescales intensity against latent_intensity_rescale_cfg (8 = the reference). Both have sigma start/end windows.
  • Prompt shaping - cond_exp / uncond_exp apply math transforms (amplify, root power, error function, sine…) to the positive or negative conditioning, each with its own method dropdown and value.
  • Wildcard stuff - disable_cond (turn the positive prompt off inside a window), adaptive_noise_strength, spectral_norm_target, frequency_filter_cutoff, dynamic_range_compression, enable_performance_monitoring.

The attention modifier inputs

This is what makes the Expert node the center of the pack. Four optional inputs - attention_modifiers_positive, attention_modifiers_negative, attention_modifiers_fake_negative, and attention_modifiers_global - accept the pack's custom ATTNMOD wire type, produced by its Attention Modifier nodes. Those plug in as Python-expression attention replacements at specific UNet blocks, active only within sigma ranges. This is genuinely fiddly, experimental territory; start with the positive slot and one modifier, not all four.

Outputs are the patched MODEL and a STRING - a dump of every parameter you passed. Because the STRING output carries the full settings, you can wire it into a text node to save a "recipe" of a working config. args_filter (optional, multiline) trims which parameters appear in that string.

Install and where it lives

Same pack, same install: Manager → search Advanced CFG Controller, or clone into custom_nodes and restart:

cd ComfyUI/custom_nodes
git clone https://github.com/FlareAI-Studios/advanced-cfg-controller

No model downloads, no heavy deps (torch/numpy/colorama only). It lives under model_patches/Advanced_CFG_Controller, with the attention modifiers and utilities in subfolders.

Practical advice

The sigma defaults (start 1000, end 1) are sized for a full-range SDXL sampler: the 1000 ceiling never actually triggers, and the 1 floor means the negative pass is skipped only in the final fine-detail steps (sigma < 1) - a gentle default, not the drastic speed-up the toggles promise. If you want the real speed boost, widen that window toward your sampler's middle sigmas. Don't touch everything at once - the pack's own monkeypatch of ComfyUI's global sampling function means mistakes can bleed into other nodes, and a restart clears it. My honest recommendation: get comfortable with adaptive_cfg, skip_uncond, and the two color-fix toggles first. If you still need fake_uncond_exp_method at "The Darkness," you've gone off the deep end - and that's fine, just save the settings string so you can come back.

Categorymodel_patches/Advanced_CFG_Controller

Inputs (53)

NameTypeDefaultDescription
modelMODEL
adaptive_cfgCOMBOHard Intensity6 options: Disabled, Soft Intensity, Hard Intensity, Hard Squared, Range Based, Spectral Analysis
adaptive_cfg_topkFLOAT0.250–0.5Top-K percentage for intensity measurement (lower = more precise)
adaptive_cfg_refFLOAT8.00–100Reference CFG value for adaptive scaling
skip_uncondBOOLEANtrueSkip negative prompt calculation for speed boost
uncond_sigma_startFLOAT1000.00–10000Start skipping negative at this sigma level
uncond_sigma_endFLOAT1.00–10000Stop skipping negative at this sigma level
fake_uncond_startBOOLEANfalseUse fake negative prompt when skipping
fake_uncond_expBOOLEANfalseApply experimental modifications to fake negative
fake_uncond_exp_methodCOMBOUse PositiveMethod for generating fake negative prompt
fake_uncond_exp_valueFLOAT2.00–1000Strength value for fake negative method
fake_uncond_exp_normalizeBOOLEANfalseNormalize fake negative to preserve magnitude
fake_uncond_multiplierINT1-1–1Multiplier for fake negative (-1, 0, or 1)
fake_uncond_sigma_startFLOAT1000.00–10000Start using fake negative at this sigma
fake_uncond_sigma_endFLOAT1.00–10000Stop using fake negative at this sigma
lerp_uncondBOOLEANfalseBlend positive and negative prompts
lerp_uncond_strengthFLOAT2.00–10Blending strength (higher = more negative influence)
lerp_uncond_sigma_startFLOAT1000.00–10000Start blending at this sigma level
lerp_uncond_sigma_endFLOAT1.00–10000Stop blending at this sigma level
subtract_latent_meanBOOLEANfalseFix color drift by centering latent values
subtract_latent_mean_sigma_startFLOAT1000.00–10000Start color correction at this sigma
subtract_latent_mean_sigma_endFLOAT1.00–10000Stop color correction at this sigma
latent_intensity_rescaleBOOLEANfalseRescale latent intensity to prevent oversaturation
latent_intensity_rescale_methodCOMBOHard MeasurementMethod for measuring latent intensity
latent_intensity_rescale_cfgFLOAT8.00–100Target intensity level for rescaling
latent_intensity_rescale_sigma_startFLOAT1000.00–10000Start rescaling at this sigma
latent_intensity_rescale_sigma_endFLOAT3.00–10000Stop rescaling at this sigma
cond_expBOOLEANfalseApply experimental modifications to positive prompt
cond_exp_normalizeBOOLEANfalseNormalize positive prompt to preserve magnitude
cond_exp_sigma_startFLOAT1000.00–10000Start modifications at this sigma
cond_exp_sigma_endFLOAT1.00–10000Stop modifications at this sigma
cond_exp_methodCOMBOAmplifyModification method for positive prompt
cond_exp_valueFLOAT2.00–100Strength value for positive modification
uncond_expBOOLEANfalseApply experimental modifications to negative prompt
uncond_exp_normalizeBOOLEANfalseNormalize negative prompt to preserve magnitude
uncond_exp_sigma_startFLOAT1000.00–10000Start modifications at this sigma
uncond_exp_sigma_endFLOAT1.00–10000Stop modifications at this sigma
uncond_exp_methodCOMBOAmplifyModification method for negative prompt
uncond_exp_valueFLOAT2.00–100Strength value for negative modification
attention_modifiers_global_enabledBOOLEANfalseEnable global attention modifications
disable_condBOOLEANfalseDisable positive prompt in specified range
disable_cond_sigma_startFLOAT1000.00–10000Start disabling positive at this sigma
disable_cond_sigma_endFLOAT0.00–10000Stop disabling positive at this sigma
enable_performance_monitoringBOOLEANfalseTrack performance metrics during generation
adaptive_noise_strengthFLOAT0.000–1Strength of adaptive noise injection
spectral_norm_targetFLOAT1.00.1–5Target norm for spectral normalization
frequency_filter_cutoffFLOAT0.500.1–1Cutoff frequency for frequency domain filtering
dynamic_range_compressionFLOAT1.000.1–1Dynamic range compression ratio (1.0 = disabled)
args_filteroptSTRINGComma-separated list of parameters to include in output
attention_modifiers_positiveoptATTNMODAttention modifications for positive prompt
attention_modifiers_negativeoptATTNMODAttention modifications for negative prompt
attention_modifiers_fake_negativeoptATTNMODAttention modifications for fake negative
attention_modifiers_globaloptATTNMODGlobal attention modifications

Outputs (2)

NameTypeDescription
MODELMODEL
STRINGSTRING