RenormCFG (Ray)
Keep High CFG From Exploding Into Burn
- ray_actors
- ray_actors
The classic burn problem: crank CFG up for prompt adherence, and the magnitude of the CFG-extrapolated prediction balloons past what the model expects. RenormCFG is the fix that says "fine, extrapolate - but don't let the result get bigger than the conditional prediction was." It's a sibling of RescaleCFG with a different philosophy: instead of rescaling the whole result by a fixed multiplier, it clamps the extrapolated prediction's norm to a ceiling derived from the conditional prediction itself. RayRenormCFG brings that patch to Raylight's workers.
Two inputs, both with forgiving defaults:
cfg_trunc(default 100) - a timestep threshold. Below this timestep (i.e., late in denoising, in the detail-refining phase), the renorm logic applies. Above it, early in generation, the node just uses the plain conditional prediction. The default of 100 means "always on" for practical purposes; lower it if you want the correction to only kick in for the final steps. Its real job is avoiding weirdness at the very start of sampling where the schedule can be noisy.renorm_cfg(default 1.0) - how much of the conditional prediction's norm the result is allowed to reach. 1.0 caps the extrapolated prediction at exactly the conditional's norm - the correction is active, but the ceiling is the "honest" one. Values below 1.0 clamp harder (flatter, safer), values above let some overshoot through.
The implementation detail that matters: it only renormalizes the epsilon channels (the noise-prediction part of the tensor) and leaves the rest of the channel space alone - a video-model-friendly touch. It's a direct port of the DiffSynth-style RenormCFG node, and in Raylight it applies on every worker via the ray_actors stream like all its siblings.
Where it fits
This is a high-CFG tool. RenormCFG earns its place on SD 1.5/SDXL-class models running in Raylight's CFG-parallel mode where people genuinely push CFG 7–12, or on any model where you've raised CFG deliberately and the output is burning. On guidance-distilled models at CFG 1 there's no extrapolation to clamp, and the node sits idle - the KB's concepts essay is blunt that CFG > 1 on those models is "applying the correction twice."
Install
Standard raylight:
cd ComfyUI/custom_nodes
git clone https://github.com/komikndr/raylight
cd raylight
pip install -r requirements.txt
Restart, or install "raylight" via ComfyUI Manager.
Gotchas
Don't stack RenormCFG and RescaleCFG and expect additive magic. They both fix CFG magnitude, and two competing corrections can flatten the image into a washed-out mess. Pick one - Renorm if you want an adaptive clamp, Rescale if you want the proven 0.7 multiplier. And remember cfg_trunc is in timestep units, not percent: if you set it low, the correction quietly switches off for most of the run, which reads as "the node stopped working."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| ray_actors | RAY_ACTORS | — | |
| cfg_trunc | FLOAT | 100.000–100 | — |
| renorm_cfg | FLOAT | 1.000–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ray_actors | RAY_ACTORS | — |