Latent Diffusion Mega Modifier
The one node that fixes CFG burn, sharpens detail, and stacks every latent trick ComfyUI won't let you stack
- model
- MODEL
You know the failure. You nudge CFG from 7 to 11 chasing prompt adherence, and the image comes back deep-fried - oversaturated, burned, face melting at the edges. ComfyUI has a whole drawer of fixes for this - dynamic thresholding, CFG rescaling, sharpening - but they're scattered across different packs and they fight each other, because ComfyUI only lets one of these hooks live on a model at a time. That's the problem the Latent Diffusion Mega Modifier from Clybius' ComfyUI-Latent-Modifiers pack exists to solve. It bundles nine separate latent-modification techniques into one node, so you can stack them without them clobbering each other.
Think of it as a post-processing bay for the sampler's internals rather than for your image. You patch it onto your checkpoint model, and at every denoising step it intercepts the conditioning and rescues it before the sampler commits.
How it actually works
Under the hood it's one big set_model_sampler_cfg_function hijack - the README is refreshingly honest that this is a workaround, because ComfyUI's single CFG-function slot means you normally get exactly one trick per model. The author chose to fuse everything into one function rather than ask you to chain hooks.
At each step the node grabs the conditioned and unconditioned predictions and runs them through a fixed pipeline: add extra noise to conditioning → sharpen → convert to a noise prediction → tonemap → spectral modification → adjust contrast → rescale CFG → divisive normalization → center out CFG drift. Every stage is a no-op at its default, so the node is a blank wire until you actually turn something on.
The two biggest draws are the tonemapping and the sharpening. Tonemapping clamps the noise prediction so you can push CFG well past a checkpoint's sweet spot without the burn - pick from seven methods, from Reinhard (borrowed from comfyanonymous' experiments) through quantile, gated, and a CFG-mimic mode that fakes a different CFG entirely. Sharpening comes straight from Fooocus' sampling code, giving you the same perceptual-detail boost that made that UI famous, with four methods (anisotropic, joint-anisotropic, gaussian, cas) to pick from.
The dials that matter
The info panel lists ~20 inputs, which looks terrifying until you notice almost everything defaults to 0 (off). You'll realistically touch five:
- sharpness_multiplier and sharpness_method - the detail boost. Start around 2–4 with
anisotropicand compare. - tonemap_multiplier and tonemap_method - the anti-burn clamp. The README's own starting points:
arctanat 5/90,quantileat 1/99. - tonemap_percentile - how aggressively the clamp bites; closer to 100 is stronger.
- contrast_multiplier - a secondary CFG slider that adds "pop" without moving subject pose. Negative values invert the operation.
- rescale_cfg_phi - dynamically scales CFG back by comparing noise standard deviations, the old rescale-CFG trick.
There's also an optional seed input that seeds the extra-noise generator, so your noise-based effects stay reproducible.
The output is a single MODEL, which you wire straight into your existing KSampler. Placement matters: it needs to sit between your checkpoint loader and the sampler, and because it patches the model, it won't stack with other nodes that also hijack the CFG function.
Installing it
No dependencies, no model downloads, no torch extras beyond what ComfyUI already ships - the pack is one Python file. Install it with the Manager (search "ComfyUI-Latent-Modifiers") or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Clybius/ComfyUI-Latent-Modifiers
Then restart ComfyUI. The node shows up as "Latent Diffusion Mega Modifier" under the clybNodes category. It's a small pack - this is the only node in it - and it's by Clybius, the same person behind the Chroma-GGUF and fp8 quantizations people run for Chroma checkpoints.
Gotchas
The README's warnings are worth heeding. Spectral modification has a dragon zone: percentiles above 15 and multipliers above 5 can make the latent "noise out" into nonsense, especially early in sampling. Combat CFG drift, which recenters the latent to fight the mean drifting off zero at high CFG, can also discolor output. And since every dial defaults off, a common "it's not working" report is just… nothing having been turned on. Set one thing at a time, fixed seed, and compare a handful of generations - the usual CFG-tuning discipline. It's an SD-lineage tool, so reach for it on SDXL/Pony/Illustrious, not on guidance-distilled models where CFG shouldn't be cranked at all.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| sharpness_multiplier | FLOAT | 0.0-100–100 | — |
| sharpness_method | COMBO | 4 options: anisotropic, joint-anisotropic, gaussian, cas | |
| tonemap_multiplier | FLOAT | 0.000–100 | — |
| tonemap_method | COMBO | 7 options: reinhard, reinhard_perchannel, arctan, quantile, gated, cfg-mimic, +1 | |
| tonemap_percentile | FLOAT | 100.0000–100 | — |
| contrast_multiplier | FLOAT | 0.0-100–100 | — |
| combat_method | COMBO | 4 options: subtract, subtract_channels, subtract_median, sharpen | |
| combat_cfg_drift | FLOAT | 0.00-10–10 | — |
| rescale_cfg_phi | FLOAT | 0.00-10–10 | — |
| extra_noise_type | COMBO | 6 options: gaussian, uniform, perlin, pink, green, pyramid | |
| extra_noise_method | COMBO | 7 options: add, add_scaled, speckle, cads, cads_rescaled, cads_speckle, +1 | |
| extra_noise_multiplier | FLOAT | 0.00–100 | — |
| extra_noise_lowpass | INT | 1000–1000 | — |
| divisive_norm_size | INT | 1271–255 | — |
| divisive_norm_multiplier | FLOAT | 0.000–1 | — |
| spectral_mod_mode | COMBO | 2 options: hard_clamp, soft_clamp | |
| spectral_mod_percentile | FLOAT | 5.000–50 | — |
| spectral_mod_multiplier | FLOAT | 0.00-15–15 | — |
| affect_uncond | COMBO | 2 options: None, Sharpness | |
| dyn_cfg_augmentation | COMBO | 3 options: None, dyncfg-halfcosine, dyncfg-halfcosine-mimic | |
| seedopt | INT | 0–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |