Nodes/CFG Megapack/PMC-CFG: posterior-mean capped CFG (Peng & Ma 2026)
ComfyUI Node

PMC-CFG: posterior-mean capped CFG (Peng & Ma 2026)

A speed limit on how far one guidance step can go

By AbstractEyes·Created 5 days ago·Updated 5 days ago· 3
PMC-CFG: posterior-mean capped CFG (Peng & Ma 2026)
  • model
  • MODEL
◄scale-1.0►
◄gamma_cap1.05►
◄spaceauto (the method's own)►

PMC-CFG (Peng & Ma, arXiv 2026) is a one-idea node, and the idea is a good one. Instead of picking a guidance scale and hoping the result stays sane, it computes the largest guidance step it can take while keeping the result within a fixed multiple of the conditional prediction's own size. Full CFG where CFG is safe; a shorter step where it would balloon.

The mechanism

Take the conditional and unconditional denoised predictions. The guidance step is along D = x0_c - x0_u, and the result is x0_c + beta·D for some beta. Plain CFG uses beta = w - 1.

The node solves, per image, for the largest beta that keeps ||x0_c + beta·D|| at or below gamma_cap · ||x0_c|| - that's a quadratic in beta, and the answer is the positive root. Then it takes min(w - 1, beta_cap): whichever is smaller. So the cap only ever binds when your scale would have pushed the prediction much further from the conditional one than gamma_cap allows.

Because beta is per-image and the map is linear, the same cap applies cleanly whether you're working in the denoised image or in velocity - which is why the node behaves the same way on flow-matching models.

The input that matters

  • gamma_cap - the norm cap, default 1.05. It's the entire method: 1.05 means the guided prediction may be at most 5% longer than the conditional one. The paper's useful range is 1.05 to 1.15 (1.15 for SD3.5), and the tooltip is honest that a large value is just plain CFG.
  • scale - the guidance scale for the rule; -1 (default) means the KSampler's cfg.
  • space - leave on auto.

One MODEL out. Checkpoint → node → KSampler.

The SDXL caveat you'll hit in the first five minutes

On SDXL, gamma_cap 1.05 comes out close to unguided - the layout and colour drift away from what plain cfg 7 gives you. This isn't a bug and it isn't subtle; the paper names the limit itself. The cap holds guidance near zero wherever the conditional estimate is small, and in SDXL's first steps it is small relative to the noise level. Which is to say: the node is doing exactly what it says, and what it says is too conservative for epsilon-prediction models at the default.

Two ways forward. Loosen gamma_cap toward 1.15–1.3 on SDXL and watch for the point where the cap stops binding at all - the pack's showcase notes it needs a larger cap there to guide normally. Or keep the default and accept it as a "let the model have the early steps" method. On a flow-matching model (Anima and its relatives) the default behaves as intended, which makes this another entry in the pack's general pattern: a lot of these 2025–2026 methods were tuned on flow models, and on SDXL's noise predictions the absolute constants act much harder.

That pattern is worth internalising for this whole pack. On SDXL the noise prediction gets multiplied by a sigma that starts near 14.6, and the first steps' estimates sit far apart, so anything expressed as an absolute constant or a norm cap bites early and bites hard. Adaptive defaults - like MAMBO-G's ratio or Adaptive Guidance's cosine threshold - already account for it. Fixed caps like this one don't.

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 to install beyond the pack - no requirements.txt, no model files, just torch and the standard library on top of 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 card, CFG_MEGAPACK_VRAM_FRACTION=0.6 before launch caps the pack's GPU memory use.

Traps

  • It's a combine-stage node, so it's exclusive. Chained after APG, CFG-Zero*, MAMBO-G or any other combine node - including this pack's three Mix stage nodes - it replaces it. A later node of the same stage wins.
  • The cap binds hardest exactly when you'd want guidance most. Early steps, small conditional estimate, beta crushed toward zero. If your prompt adherence has collapsed rather than softened, that's this.
  • Other packs' CFG-function nodes share ComfyUI's one slot. RescaleCFG, Mahiro or RenormCFG chained after this node takes it.
  • Use the probe. CFG Measure: Per-Step Probe records how far guidance actually pushed at each step, which is the only way to see the cap engaging rather than inferring it from a flat-looking image.
CategoryCFG Megapack/papers/combining the two predictions

Inputs (4)

NameTypeDefaultDescription
modelMODEL—
scaleFLOAT-1.0-1–100The guidance scale w for this rule. -1 uses the sampler's cfg value.
gamma_capFLOAT1.051–2The norm cap (1.05-1.15; large = plain CFG).
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—