Nodes/CFG Megapack/beta-CFG (Malarz et al. 2025)
ComfyUI Node

beta-CFG (Malarz et al. 2025)

A curve over the run, and a normalized push

By AbstractEyes·Created 5 days ago·Updated 5 days ago· 3
beta-CFG (Malarz et al. 2025)
  • model
  • MODEL
◄scale-1.0►
◄a2.0►
◄b2.0►
◄gamma1.00►
◄peak_normalizefalse►
◄spaceauto (the method's own)►

Two things are happening in beta-CFG (Malarz, Kasymov, Zieba, Tabor & Spurek, ECAI 2025), and it's worth separating them because they fail in different ways.

The first is the schedule. Instead of holding one guidance scale for the whole run, the scale follows a Beta distribution's probability density over the denoising progress - small at the ends, peaking somewhere in the middle. It's a smooth, tunable version of "guide in the middle of the run", which is what a lot of the when-to-guide literature converges on. Shape a and shape b decide where the peak sits and how wide it is.

The second is the normalization. The guidance difference is divided by its own norm raised to gamma, so the push no longer grows with how large the difference happens to be - guidance becomes about direction more than magnitude. At gamma = 0 you get plain, unnormalized CFG back; the default is 1, which is full normalization.

The node's own description ends with a warning worth taking literally: re-tune the scale per model. The two mechanisms interact, and a scale that's right for SDXL at 50 steps is not automatically right on a flow model with a different schedule.

Inputs

  • model - before the sampler, as always.
  • scale (default -1) - -1 uses the KSampler's cfg, which then gets shaped by the Beta curve rather than applied flat. Set it here if you want the model chain to disagree with the sampler.
  • a (default 2) - the first Beta shape. The paper uses 2, and bumps it to 3 once the scale is 5 or above, which is the kind of detail that tells you the authors tuned this against a real grid rather than a vibe.
  • b (default 2) - the second shape. Equal a and b gives a symmetric hump peaking mid-run. Making them unequal slides the peak earlier or later - the usual reason to touch this input.
  • gamma (default 1) - the power the difference's norm is raised to before dividing. 0 is no normalization (plain CFG arithmetic). Between 0 and 1 is a partial normalization, which is sometimes what you want; full normalization at high scale can flatten local contrast.
  • peak_normalize (default off) - divide the Beta curve by its own peak, so the scale never exceeds w. With it off, the peak of the Beta density multiplies your scale and the effective guidance briefly goes above what you asked for. Turn it on if you want "scale 7" to mean a ceiling rather than an average.
  • space - auto uses the method's published space (noise prediction). Nonlinear, so a change here is a change to the picture.

Output: one MODEL.

Install

# ComfyUI Manager: search "CFG Megapack" -> Install -> restart
# or:
comfy node install comfy-cfg-megapack
# or by hand:
cd ComfyUI/custom_nodes && git clone https://github.com/AbstractEyes/comfy-cfg-megapack

No requirements.txt, nothing to download, ComfyUI ≥ 0.38 required. It uses comfy_api.latest, so an older ComfyUI won't load the pack.

How to actually dial it in

Tune one thing at a time, because a, b, gamma and the scale all change the same observable (how hard the image is pushed).

  1. Set gamma = 0 and peak_normalize on. That's plain CFG under a Beta-curved scale - the easiest thing in the node to reason about, and you'll see the schedule's effect in isolation.
  2. Move a/b until you like when the guidance is strong. Symmetric 2/2 is the paper's starting point; if fine detail is coming out mushy, the peak is probably too late.
  3. Then raise gamma to 1 and re-check. This is where most images change character: normalization stops a big difference from dominating a step.
  4. Only then adjust the scale.

Two pack-wide rules that bite here: a later mix node replaces this one rather than stacking, and ComfyUI's model has a single CFG-function slot, so another pack's RescaleCFG/Mahiro/RenormCFG chained afterwards will quietly take over. Also note the hook forces the unconditional pass on (disable_cfg1_optimization), so this is an SDXL/SD1.5-range tool - at cfg 1 on a distilled 2026 model there's no guidance for a Beta curve to shape.

CategoryCFG Megapack/papers/combining the two predictions

Inputs (7)

NameTypeDefaultDescription
modelMODEL—
scaleFLOAT-1.0-1–100The guidance scale w for this rule. -1 uses the sampler's cfg value.
aFLOAT2.00.5–10Beta shape a (paper 2; 3 for scales of 5 and more).
bFLOAT2.00.5–10Beta shape b.
gammaFLOAT1.000–2Power of the norm the difference is divided by (0 = no normalization).
peak_normalizeBOOLEANfalseDivide the Beta curve by its peak, so the scale never exceeds w.
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—