MAMBO-G: magnitude-aware guidance damping (Zhu et al. 2025)
Guidance that gets out of the way when the model is already struggling
- model
- MODEL
If you want the one node in this pack's "norm family" that you can set and forget, it's this one. MAMBO-G (Zhu et al., arXiv 2025) watches how hard CFG is having to push at each step and quietly turns itself down when the push is extreme.
The mechanism
For each image it takes the ratio of the guidance difference's size to the unconditional prediction's size: ||c − u|| / ||u||. That ratio is a decent proxy for "the prompt and the model's prior are fighting here." Then it shrinks the effective scale:
w_eff = 1 + (w - 1) · exp(-alpha · ||c - u|| / ||u||)
When the difference is small relative to the unconditional prediction, w_eff is basically your cfg and nothing changes. When the difference is huge - the case where plain CFG overshoots, blows out contrast and cooks the image - the exponential term collapses and w_eff slides toward 1, which is no guidance at all. Let the model have the step.
One important detail from the implementation: the ratio is measured over the whole prediction, so you get one damping factor per image, not a per-pixel map. This is a per-sample guard rail, not a local one.
alpha is the damping strength. 0 gives you plain CFG back exactly, and larger values make the node bail out sooner. The default is 8, which matches the paper's setting.
The inputs
scale- the guidance scale for the rule.-1, the default, uses the KSampler's cfg, which is how you should run it: MAMBO-G is not a scale you set, it's a correction applied to whatever scale you set. In the paper's terms, this value plays the role ofw_max, the ceiling the damping pulls away from.alpha- damping strength, default8. Push it up if high cfg still burns; drop it toward 3 or 4 if the image feels under-guided and you suspect the node is being too cautious.space-auto (the method's own); the rule is nonlinear, so moving it changes the image. Leave it.
One output: MODEL, patched, between the loader and the sampler.
Why this one and not the others
The pack has a small family of methods that pin the guidance to a size: Power-Law CFG, EP-CFG, CFG-Renorm, PMC-CFG, and this. They all solve "the guided result got too big", but they differ in how much knowledge they need from you.
- Norm caps and energy matching need a threshold - CFG-Renorm's
rho, PMC-CFG'sgamma_cap- and a bad threshold either does nothing or strangles the image. - Power-Law CFG needs the difference's absolute size, which scales with the number of latent elements, so its
omegahas to be re-tuned per model and per resolution. The pack's own notes mention needing omega 2.42 with a scale of 19 to get anywhere on SDXL at 1024×1024. - MAMBO-G divides one size by another. The ratio is dimensionless, so there's no resolution term to re-tune and the default alpha travels between SDXL and a 16-channel flow model. That's the whole argument for it.
If you find yourself re-tuning absolute constants every time you change checkpoint, MAMBO-G is the one that stops the bleeding.
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, just torch and the standard library on ComfyUI's newer node API. Tested on ComfyUI 0.38.0 with torch 2.11, GPU and CPU-only. Optional CFG_MEGAPACK_VRAM_FRACTION=0.6 before launch caps the pack's share of the GPU.
Traps
- Crank
alphaand your prompt stops landing. That's the failure mode of this node, not an install problem: at very high alpha almost every step looks "extreme" to the ratio test, so guidance gets damped on everything and you're close to unguided sampling. If an image looks washed out and unresponsive, backalphaoff before you blame the checkpoint. - It's a combine-stage node, so it's exclusive. Chain APG, CFG-Zero* or any other combine node after it and you've replaced it.
- ComfyUI has one CFG-function slot. Another pack's RescaleCFG, Mahiro or RenormCFG chained after this node takes that slot and wins. If MAMBO-G seems inert, that's the first thing to check.
- A 2026-distilled checkpoint at cfg 1 has nothing for this node to damp. The whole trick assumes an aggressive scale; on a model where guidance is baked in, run cfg 1 and skip the CFG-fixing nodes entirely.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| scale | FLOAT | -1.0-1–100 | The guidance scale w for this rule. -1 uses the sampler's cfg value. |
| alpha | FLOAT | 8.00–50 | Damping strength (0 = plain 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 | — |