Nodes/CFG Megapack/CFG Truncation (Yi et al. 2024; Lumina-Image 2.0)
ComfyUI Node

CFG Truncation (Yi et al. 2024; Lumina-Image 2.0)

Guide the first quarter, then stop paying for it

By AbstractEyes·Created 5 days ago·Updated 5 days ago· 3
CFG Truncation (Yi et al. 2024; Lumina-Image 2.0)
  • model
  • MODEL
◄ratio0.25►

This is the cheapest useful idea in the pack, and the one with the best ratio of "obvious once you see it" to "why didn't I already do this".

CFG Truncation (Yi, Li, Xin & Li, NeurIPS 2024, used in Lumina-Image 2.0) applies guidance for the first part of the run only. After the cutoff, the conditional prediction is used directly - no extrapolation away from the unconditional one. Set ratio = 0.25 and three quarters of your sampling steps are plain conditional passes.

The paper's motivation is quality: late-step guidance mostly exaggerates contrast and detail on an image whose structure is already settled, and truncating it avoids the over-sharpened look. But the side effect is the part most people care about, and the pack states it in the node description outright - after the cutoff, the unconditional pass is skipped. That's the second model call per step going away. On a fifty-step render at ratio = 0.25, roughly 37 steps run at half cost.

Inputs

Two, and only one of them is a decision:

  • model - the wire from your loader.
  • ratio (default 0.25, range 0.01–1) - the share of the run with guidance on. Lumina uses 0.25; the pack's tooltip says 0.2–0.6 is the useful band. 1.0 is plain CFG for the whole run, which makes it a clean control for comparing.

There's no scale and no space input on this node - it doesn't change the arithmetic of guidance, it changes when guidance happens. The scale stays whatever your sampler says.

Output: a MODEL, into the KSampler's model input as usual.

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 dependencies and nothing to download. ComfyUI 0.38+ is required for the node API it uses.

How to tune ratio - and why "share of the run" is fuzzier than it sounds

The pack's window nodes measure percentages the way ComfyUI's own timestep-range nodes do: against the model's noise schedule, not against a step counter. On a Karras-type scheduler the two disagree - step 12 of 30 is not 40% of the noise range - so a ratio that looked right on one scheduler can mean a different cutoff on another. That's a feature (it keeps the cutoff in the same place when you change the step count) with a usability cost (your intuition about "the first ten steps" is not the unit). If the cutoff lands somewhere surprising, check the scheduler before assuming the node is broken.

Practical dialing: 0.25 is safe and fast. Push toward 0.5 if your prompt has details that get abandoned by the truncation - the usual symptom is a subject that's mostly right but missing an attribute it had at higher ratio. Going past 0.6 mostly gives up the speedup.

Where it fits, and the shared traps

It writes the when stage of the pack's seven-stage plan, so a later schedule node replaces it - CFG When: Schedule and Window with a window ending at the same percent is the general-purpose version of this node, and it has an explicit skip_uncond_outside toggle if you want to control the speedup directly. The Guidance Interval node is the same idea but bounded at both ends on the noise scale, which is what you want if the very first steps are also better left alone.

ComfyUI keeps one CFG function per model, so a RescaleCFG/Mahiro/RenormCFG from another pack chained after this one will take the slot and this node will do nothing. And note the asymmetry the pack is upfront about: its hook disables ComfyUI's CFG-1 optimization, so on a distilled model running at cfg 1 you're forcing the unconditional pass and getting no guidance for it to feed. On SDXL and SD1.5, though - where CFG 7 is the point - this is the one node in the pack that can make a render faster rather than slower.

CategoryCFG Megapack/papers/when to guide

Inputs (2)

NameTypeDefaultDescription
modelMODEL—
ratioFLOAT0.250.01–1Share of the run with guidance (Lumina 0.25; 0.2-0.6 useful).

Outputs (1)

NameTypeDescription
MODELMODEL—