CFG Mix: Scale Rules
One node, four ways to decide how far along the guidance to go
- model
- MODEL
The companion node to CFG Mix: Direction Rules. Where that one changes where guidance points, CFG Mix: Scale Rules keeps the direction and changes how far along it you travel - the arithmetic every CFG variant spends its first paragraph arguing about.
The four rules
standard(default) -u + w (c - u). Plain CFG, the thing everything else is measured against. Useful on its own because it makes your plan explicit and because the plan is inspectable.cfg_zero_star- CFG-Zero*, Fan et al. 2025. Before guiding, it rescales the unconditional prediction to fit the conditional one as well as it can, then guides with that corrected base. Built for flow-matching models, and it can leave the latent completely unmoved for the first few steps, which the paper argues is the right thing to do when the model's early estimate is meaningless.power_law- Power-Law CFG, Lehman Pavasovic et al. 2025. The scale grows with the size of the guidance difference:1 + (w - 1)·||c - u||^alpha. Big disagreements get pushed harder, small ones barely at all.magnitude_damped- MAMBO-G, Zhu et al. 2025, the same maths as this pack's dedicated MAMBO-G node: the scale shrinks where the difference is large relative to the unconditional prediction.
The inputs
One MODEL out, and in:
rule- the four above.scale- the guidance scale for the rule.-1, the default, uses the sampler's cfg.zero_init_steps-cfg_zero_staronly: how many steps at the start leave the latent unmoved. Default0here; the dedicated CFG-Zero* node in this pack defaults to1, which is the paper's value for flow models.power_alpha-power_lawonly: the exponent on the difference's norm, default0.9. At0this rule is standard CFG, which is a nice way to check the wiring.damping_alpha-magnitude_dampedonly: damping strength, default8.0is standard CFG again.space- where the rule is computed,autoby default. All three non-standard rules here are nonlinear, so this dropdown changes the image. Leave it onauto.
As with the Direction Rules node, every knob is present regardless of which rule is selected, and only the live ones do anything. A power_alpha sitting on a magnitude_damped run is dead weight, not a subtle interaction.
The one rule to be careful with
Power-law is the fiddliest thing in this pack, and the reason is in the formula: it multiplies by the absolute size of the guidance difference, which scales with the number of latent elements - so it changes when you change resolution, and when you change model family. The pack's own notes are refreshingly direct about the consequence: their showcase needed omega equivalent to 2.42 and a scale of 19 to get a sensible image on SDXL at 1024×1024, where the difference's size was about 2.7 in noise units. The node's scale input feeds omega as w - 1, so "just use the defaults" is not a strategy here.
If the appeal is "adaptive scale", magnitude_damped gives you most of the benefit with a dimensionless ratio and no re-tuning per resolution. If the appeal is "guidance that doesn't fight itself at the start", cfg_zero_star is the one built for the flow models that dominate current releases.
Install
ComfyUI Manager: search CFG Megapack, 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. Nothing else to install - no requirements.txt, no model downloads, no extra packages; the pack uses torch and the Python standard library through ComfyUI's current node API (comfy_api.latest). Tested on ComfyUI 0.38.0 with torch 2.11, GPU and CPU-only. On a shared GPU, CFG_MEGAPACK_VRAM_FRACTION=0.6 before launch caps how much of it the pack will take.
Traps
- It's the "combine" stage, and that stage holds one rule. Chain this after Direction Rules, Pentachoron or any paper node that combines the two predictions, and you've replaced it, not composed with it. A later node of the same stage wins, silently.
- Chaining against other packs. RescaleCFG, Mahiro and RenormCFG from other packs share ComfyUI's single CFG-function slot with this node, and the last one chained takes it. If a rule looks inert, check what's downstream of it.
zero_init_stepson an epsilon model is not what the paper intends; zero-init is for flow models, where the first estimate is close to meaningless. On SDXL it just delays the start of your guidance.- Use the Plan Readout. CFG Plan Readout prints the entire plan on the model - which node owns which stage, and what each setting is. When you're chaining several of these, it's the only fast way to know what you actually built.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| rule | COMBO | standard | 4 options: standard, cfg_zero_star, power_law, magnitude_damped |
| scale | FLOAT | -1.0-1–100 | The guidance scale w for this rule. -1 uses the sampler's cfg value. |
| zero_init_steps | INT | 00–50 | cfg_zero_star: the first N steps leave the latent unmoved (paper: 1 on flow models; 0 = off). |
| power_alpha | FLOAT | 0.900–3 | power_law: exponent on the difference's norm (0 = standard CFG). The effective scale is 1 + (w - 1) ||c - u||^alpha, so retune w per model and resolution. |
| damping_alpha | FLOAT | 8.00–100 | magnitude_damped: damping strength (0 = standard CFG). |
| space | COMBO | auto (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)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |