CFG When: Schedule and Window
The one node that turns guidance off for part of the run
- model
- MODEL
This is the widest node in the pack, and the one I'd install first out of the stage nodes - because it covers three separate families of published method in one place. Guidance Interval is a window with guidance only in the middle. CFG Truncation is a window that ends early. Wang's rising schedules, TV-CFG, C2FG and CADS are all just different shape values. Here it's one node with a shape menu, a window, and a story about what happens outside the window.
The mechanism
Two things happen at once. First, a window: start_percent to end_percent of the run, in ComfyUI's percent - measured on the model's own noise schedule, like ComfyUI's own timestep-range nodes, and therefore shift-aware on flow-matching models. On a karras-type scheduler that is not the same as a share of your step count, which is the detail everyone gets wrong once.
Second, a shape inside the window: how the scale moves from the first step of the window to the last. constant is a flat line; linear_up, linear_down, cosine_up, cosine_down, v_shape and lambda_shape are Wang's family (normalized so the window's average equals your base scale); tv_cfg peaks in the middle at a position you choose; beta_pdf follows the window's progress as a Beta curve; c2fg_exp grows with exp(a(1 - t)) following the noise level; cads_ramp sits at zero in high noise and ramps up between two noise levels.
Outside the window, outside decides: no guidance (conditional) - the conditional prediction alone, i.e. no CFG; base scale or fixed scale - your other CFG Megapack nodes still apply, only the scale changes; or plain CFG at base scale, which switches the other nodes off outside too.
The scale entering all of this is the sampler's cfg, or whatever a mix node set.
Inputs that matter
shape- defaultconstant. Start here, then move.start_percent/end_percent- the window. 0 to 1 means the whole run.outside- the interesting decision.no guidance (conditional)is the one that also skips work: withskip_uncond_outsideleft True, the unconditional pass is not computed outside the window, which is a real speed-up and, per the pack's own testing, the same image.floor- lowest scheduled scale allowed (0 = no floor).shape_a/shape_b- the shape's parameters (-1 = the shape's default): TV-CFG's peak position, Beta's alpha and beta, C2FG's rate, CADS's two thresholds.outside_scale- used by the fixed-scale outside mode.
Output: MODEL.
What I'd actually use it for
Skipping the tail. Guidance in the last 20% mostly cooks texture. Window 0 to 0.8, outside on conditional, skip_uncond_outside on: cheaper render, calmer highlights.
Emulating Guidance Interval without sigma bounds. The pack's interval node wants EDM-style sigma values (it converts them for flow models by itself); here you just drag two percentages.
A quick rising schedule. cosine_up with a floor, imitation of Wang's paper nodes without another node in the graph.
Reproducing a shared workflow's schedule. Plenty of community workflows assume one; this is the transparent way to rebuild it instead of guessing.
Install
ComfyUI Manager → search CFG Megapack → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/AbstractEyes/comfy-cfg-megapack
No requirements.txt, no models, no keys. The hard requirement is a recent ComfyUI - the nodes use comfy_api.latest and the README reports testing on 0.38.0 with torch 2.11 - so if the pack doesn't import after a restart, that's the reason to check first.
Where people get burned
Reading percentages as steps. "Guidance in the first 30%" is not "guidance for the first 30% of my 30 steps" on a karras schedule. If you want step-precise control, look at where your scheduler puts the sigma values (the Probe writes them) rather than trusting the mental arithmetic.
Two "when" nodes. Schedule and window both live in this stage: CFG When, TV-CFG, the Wang schedules, C2FG, Early-high-late-unconditional, CFG Truncation, Transition-Point. Chain two and the later silently replaces the earlier.
Expecting the speed-up without asking for it. The unconditional pass is only skipped when outside is no guidance (conditional) and skip_uncond_outside is on. Otherwise you're paying for both passes on every step, with only the scale changing.
A floor that flattens the curve. With normalized shapes the average equals your base scale, so a floor set high turns the schedule into a constant. Floor 4 with cfg 6 is close to a no-op.
The single CFG slot. If a stock RescaleCFG, Mahiro or RenormCFG node is chained after this one, it takes ComfyUI's CFG-function slot and the other rules go quiet. This node still schedules the scale, but the picture you're judging isn't the one you configured. CFG Plan Readout prints it all, stage by stage.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| shape | COMBO | constant | How the scale changes across the window. linear/cosine up and down, V and Lambda keep the window's average scale equal to cfg (Wang et al. 2024). tv_cfg peaks in the middle. beta_pdf follows the window's progress; c2fg_exp and cads_ramp follow the noise level itself. |
| start_percent | FLOAT | 0.000–1 | The window starts here (0 = the first step). ComfyUI's percent: measured on the model's own noise schedule, like its timestep-range nodes, so it can differ from the step count on karras-type schedulers. |
| end_percent | FLOAT | 1.000–1 | The window ends here (1 = the last step). |
| outside | COMBO | no guidance (conditional) | Outside the window: no guidance (the conditional prediction alone; the unconditional pass can be skipped there); the base scale or outside_scale with every other CFG Megapack node still applied; or plain CFG at the base scale with the other nodes off. |
| outside_scale | FLOAT | 1.00–100 | The scale outside the window with the fixed-scale mode. |
| floor | FLOAT | 0.00–100 | Lowest scheduled scale allowed (0 = no floor). |
| shape_a | FLOAT | -1.00-10–10 | Shape parameter a (-1 = the shape's default): tv_cfg peak position, beta_pdf alpha, c2fg rate, CADS tau1. |
| shape_b | FLOAT | -1.00-10–10 | Shape parameter b (-1 = default): beta_pdf beta, CADS tau2. |
| skip_uncond_outside | BOOLEAN | true | With outside = no guidance, skip the unconditional pass there (faster, same image). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |