Video Linear CFG Guidance
The CFG ramp that keeps early video frames from burning out
- model
- MODEL
If you've generated video and watched the first few frames come out overexposed, oversaturated, or just "more prompt than image," you've hit the problem VideoLinearCFGGuidance exists to solve. It's a model patch that ramps your CFG strength across the clip instead of holding it constant - weak on the early frames, full strength by the end.
Video models (the Wan line especially) run into a specific failure mode: at high guidance, early frames - where there's barely any structure yet - get pushed hard toward the prompt and come out burnt, while later frames that have actual content to refine benefit from the push. The fix is to make guidance a ramp rather than a flat line. That's this node.
How it works
The node clones your model and installs a custom linear_cfg function in place of the standard CFG formula. For a batch of frames, it computes a per-frame scale:
scale = linspace(min_cfg, cond_scale, num_frames)
output = uncond + scale * (cond - uncond)
Frame 0 gets min_cfg, the last frame gets your full cond_scale (the CFG you set on the guider), and everything between is evenly interpolated. Because it's implemented as a patch on the model rather than a separate sampler, it composes with whatever guider and sampler you're already using.
The input that matters
Just one real control: min_cfg (FLOAT, 0–100, default 1.0) - the guidance at the start of the clip. Default 1.0 is the sensible floor: at exactly 1, ComfyUI skips the negative pass entirely for that frame, so early frames are essentially unconditional and cost half the compute. Raise min_cfg if fully-unconditional early frames are too chaotic for your style; lower it toward 0 if you want a longer, gentler ramp.
The MODEL output is a patched model - you feed that into your guider (BasicGuider or CFGGuider), not the original checkpoint. Easy to miss if you grab the wrong model wire.
How you get it
Ships with ComfyUI core - no install. It lives in the video-model node file and has been around since the Wan-era video work, so any recent ComfyUI has it. There's also a VideoTriangleCFGGuidance sibling that does the same thing in a triangle wave (ramp up, ramp down) - useful when you want strong middle frames and gentle ends.
Common issues
- It does nothing on a single image. The ramp keys off the batch dimension. One latent = one frame = a flat, fixed CFG. If you attach this to an image workflow expecting magic, you'll get none - it's a video tool.
- Batch order matters. The ramp assumes frames are ordered in the batch. If your video node shuffles the batch, the "ramp" hits random frames.
- It's not a CFG dial. It only shapes guidance across frames; the actual strength still comes from your guider's cfg value. Set the guider first, then shape with
min_cfg.
One light aside: it won't fix a fundamentally wrong CFG - ramping from 1 to 40 is still ramping into a burn. Start from a sane cfg, then let the ramp smooth the edges.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| min_cfg | FLOAT | 1.00–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |