Anima Latent Mean Correction
Fix the color cast your CFG is secretly adding
- model
- MODEL
Oversaturation at high CFG isn't only about contrast. Classifier-free guidance doesn't just scale up the difference between conditioned and unconditioned predictions - over many steps it also drifts the latent mean away from zero, per channel. In pixel terms that reads as a color cast and over-cooked saturation that no amount of VAE tweaking fixes, because it's baked in before the VAE ever sees the latent. Anima Latent Mean Correction subtracts that drift, channel by channel, and pulls the color balance back to neutral.
It's one of the realism nodes in Danrisi's AnimaDynamicCFG pack (same author as the UltraReal Anima fine-tune), and it's the color counterpart to Anima CFG Rescale. If you think of it as stats, Rescale normalizes the standard deviation (the contrast range) while this normalizes the mean (the overall color). Run them together and you've corrected the full first-order statistics of your latent.
How the mechanism works
Each step, it computes the mean of the denoised prediction over the spatial dimensions, keeping it per channel, then subtracts a fraction of that mean from every pixel:
denoised - channel_mean * strength
Subtracting the per-channel DC offset re-centers each channel toward zero, which is where diffusion latents are supposed to live. The VAE then decodes with the color balance the model actually intended rather than the CFG-inflated version. It's a post_cfg_function patch gated by start_percent/end_percent, so you can apply it for the whole run (default) or only in a late window where color decisions settle.
The inputs that matter
strength(0.5, range 0–1) - how much of the drift to remove. README recommends 0.3–0.5. At 1.0 it fully zero-centers every channel, which is aggressive.start_percent/end_percent(0 / 1) - the window. Unlike the noise and frequency nodes, this one defaults to the full run, which makes sense: color drift accumulates, so correcting early is fine.
Wiring it in
Same pattern as every node in the pack - MODEL in, MODEL out, between loader and sampler:
Checkpoint Loader → Anima CFG Schedule (Advanced) → Anima Latent Mean Correction → KSampler
Because it's a post-CFG patch, it stacks freely with Frequency Boost and Noise Sculpt. If you're also using Rescale, the order between them doesn't matter much (both are per-step on the same prediction), but they do pair well - mean correction fixes the cast, rescale fixes the contrast.
Installing
ComfyUI Manager (search "AnimaDynamicCFG") or:
cd ComfyUI/custom_nodes
git clone https://github.com/DanrisiUA/ComfyUI-AnimaDynamicCFG.git
Restart, find it under Anima/realism. No dependencies beyond torch, nothing to download.
Gotchas
- 1.0 is a lot. Fully zero-centering every channel can wash color out of an image whose model legitimately wants a warm or cool palette. If your output looks drained or colorless, you've likely overshot - back
strengthdown to 0.3–0.4. - It's a global per-channel correction, not a white-balance. It shifts whole channels, so it can't fix a local color cast on one region of the image. That's a different (usually inpainting) job.
- Pair it with the schedule rather than assuming it alone fixes deep-fried output. If colors are still burning after correction, your CFG is too high for the model, and no post-hoc stats node is going to fully rescue that.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| strength | FLOAT | 0.500–1 | — |
| start_percent | FLOAT | 0.000–1 | — |
| end_percent | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |