AutoGuidance CFG Guider (good+bad)
Guide the sampler with a bad version of itself
- good_model
- bad_model
- positive
- negative
- GUIDER
CFG already makes your model predict twice every step - once with your prompt, once without - and amplifies the difference. This node makes it predict a third time, against a deliberately worse copy of the same model, and steers relative to that. It's the ComfyUI implementation of "Guiding a Diffusion Model with a Bad Version of Itself" (Karras et al., 2024, arXiv 2406.02507), and the name is literal, not a gimmick: you point it at a second checkpoint you loaded. No API, no key, no downloads.
Why bother? Classic CFG pushes the image toward your prompt, and the failure mode is pushing too hard - oversaturation, that deep-fried look, faces falling apart. AutoGuidance adds a separate axis: "good minus bad." If your bad model is the same model, just trained less, then that difference points at what the extra training actually bought, and you can lean on it without cranking CFG into burn territory. The README's own recipe runs it at cfg 1.1 with a distilled DMD2/LCM stack - the regime where normal CFG is basically off - and gets its guidance from AutoGuidance instead. That's the sweet spot for this thing: a guidance axis that doesn't re-apply doubled CFG on a model that was trained to run without it.
What it is
It's a guider node, the same abstraction as the built-in CFGGuider. Feed it good_model, bad_model, positive, negative, and connect its GUIDER output to the guider input on SamplerCustomAdvanced. That's the whole swap: your normal sampler setup, with the guidance replaced.
The inputs that matter
cfg- your normal CFG value (default 5). The good model's prediction is combined with this exactly like the stock guider.w_autoguide- how hard to push the good-minus-bad direction.1.0is off,2.0is the default and moderate,3.0is strong.swap_mode- the input that decides your VRAM budget.shared_safe_low_vram(default) keeps one model loaded and swaps state between good and bad: slowest, least VRAM.shared_fast_extra_vramtrades a little VRAM for faster swapping.dual_models_2x_vramloads both models and is the only fast mode - but it needs two genuinely distinct model instances. More on that below.
The rest you'll actually touch: ag_max_ratio caps the AutoGuidance push relative to the CFG update (the source comment says it plainly - if the effect is too subtle, raise the default 0.35 toward 0.75 first); ag_ramp_mode picks where in the denoise the effect bites (flat, detail_late, compose_early, mid_peak); ag_combine_mode switches between the default sequential_delta and multi_guidance_paper, which reimplements the paper's parameterization (cfg = total g, w_autoguide = 1+α) but ignores the ramping and ratio controls.
Install
Painless - one clone, no pip dependencies, no model files:
cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-AutoGuidance
then restart ComfyUI. ComfyUI Manager finds it if you search "AutoGuidance." The checkpoints themselves you bring - you need a good one and a weak one.
Where people get burned
dual_models_2x_vramwith both loaders pointing at the same file path. ComfyUI dedupes the load into one shared instance and you get washed-out or identical output. Copy the safetensors under a new name (SDXL_base_BADCOPY.safetensors) and load that asbad_model. In shared modes, if output still looks wrong,safe_force_clean_swap(on by default) is the author's named fix.- Shared swap modes are not just slower. The author reports the sampling pass can run an order of magnitude slower while juggling LoRA state between good and bad. Budget for it.
- Scope. It's SDXL/SD 1.5 territory (Z-Image support landed after release); modern DiT models are untested and the author expects them to crash.
- The bad model has to be a degraded version of the same model, not a random different one. The paper assumes aligned error patterns - fewer training steps, a weaker LoRA, reduced capacity. Grab something off-distribution and "good minus bad" stops pointing at quality and starts pointing at artifacts. The author's own recipe uses an early-epoch LoRA on the bad path at 4x weight.
One honest caveat: the release thread's most substantive reply argues two full models is a heavy hardware ask for a gain that's hard to see in quick tests. The method is real, but do what the author asks - fixed seed, A/B against plain CFG, several images per setting - before you commit the VRAM.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| good_model | MODEL | — | |
| bad_model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| cfg | FLOAT | 5.00–50 | — |
| w_autoguide | FLOAT | 2.001–5 | — |
| swap_mode | COMBO | shared_safe_low_vram | 3 options: shared_safe_low_vram, shared_fast_extra_vram, dual_models_2x_vram |
| ag_combine_modeopt | COMBO | sequential_delta | 2 options: sequential_delta, multi_guidance_paper |
| ag_delta_modeopt | COMBO | bad_conditional | 4 options: bad_conditional, raw_delta, project_cfg, reject_cfg |
| ag_max_ratioopt | FLOAT | 0.350–5 | — |
| ag_allow_negativeopt | BOOLEAN | true | — |
| ag_ramp_modeopt | COMBO | flat | 4 options: flat, detail_late, compose_early, mid_peak |
| ag_ramp_poweropt | FLOAT | 2.00.5–8 | — |
| ag_ramp_flooropt | FLOAT | 0.150–1 | — |
| ag_post_cfg_modeopt | COMBO | keep | 3 options: keep, apply_after, skip |
| safe_force_clean_swapopt | BOOLEAN | true | — |
| uuid_only_noopopt | BOOLEAN | false | — |
| debug_swapopt | BOOLEAN | true | — |
| debug_metricsopt | BOOLEAN | true | — |
| debug_metrics_allopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GUIDER | GUIDER | — |