SamplerCustomWithNAG
NAG bolted straight onto SamplerCustom
- model
- positive
- negative
- nag_negative
- sampler
- sigmas
- latent_image
- output
- denoised_output
Here's the honest version first: this is the least-discussed node in the whole ComfyUI-NAG pack. Search for it and you'll come up mostly empty - the community has overwhelmingly settled on either KSamplerWithNAG for the simple case or the NAGCFGGuider + SamplerCustomAdvanced combo for the modular one. SamplerCustomWithNAG exists for a narrower audience: people who already have a graph built around ComfyUI's older all-in-one SamplerCustom node - the one that takes a sampler and sigmas directly rather than routing through a separate guider - and want to add NAG without restructuring that graph.
What it actually is
SamplerCustom is ComfyUI's single-node version of custom sampling: instead of chaining RandomNoise → Guider → SamplerCustomAdvanced, it folds noise, CFG, conditioning, sampler and sigmas into one node. SamplerCustomWithNAG is that same node with the NAG parameters - nag_scale, nag_tau, nag_alpha, nag_sigma_end - and a nag_negative conditioning slot added in. Same mechanism as the rest of the pack: NAG extrapolates away from nag_negative inside attention space, so it still does something on guidance-distilled models where CFG is stuck at 1 and a normal negative prompt has no pass to run through.
The inputs and outputs that matter
Three conditioning inputs, same pattern as the guider nodes: positive, negative (only active if cfg is above 1), and nag_negative (the one NAG actually reads). You also need a sampler (from a KSamplerSelect node) and sigmas (from a scheduler node like BasicScheduler) - this node doesn't pick those for you the way KSamplerWithNAG does internally.
The rest of the required inputs: model, add_noise (boolean, default on), noise_seed, cfg (default 8), latent_image, and the four NAG knobs at their usual defaults (nag_scale 5, nag_tau 2.5, nag_alpha 0.25, nag_sigma_end 0).
Two outputs, which is the other thing that sets this apart from the simpler KSampler-style nodes: output is the final latent, and denoised_output is the fully-denoised version with any leftover noise stripped out - useful if you're chaining into a preview or a second sampling stage and want the clean version rather than whatever add_noise left behind.
Installing it
Via ComfyUI Manager: search "ComfyUI-NAG", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ChenDarYen/ComfyUI-NAG
then restart. No extra models, no heavy pip dependencies - it operates on the model you've already loaded.
Troubleshooting
Given how little this specific node shows up in the wild, most of what's worth knowing is inherited from the rest of the pack rather than specific to this one:
nag_negative left unwired or empty is the number one reason NAG "isn't doing anything." It's a separate slot from negative - plugging your negative conditioning into only one of the two is an easy mistake, especially if you're used to nodes where one negative input covers everything.
Core ComfyUI updates can break the guider machinery underneath this node. The pack's guider classes track ComfyUI's own sampler internals closely, and a core update that changes that interface (a new keyword argument on the internal sampling call, for instance) has broken sibling nodes in this pack with a TypeError before. If sampling suddenly errors out after updating ComfyUI, check whether ComfyUI-NAG has a newer release before you go digging further.
If you don't already have a sampler/sigmas graph built, this isn't the easiest way in. Most people get more mileage from KSamplerWithNAG, which wraps sampler selection and scheduling into the widgets you already know from plain KSampler. Reach for this node specifically because you're maintaining an existing SamplerCustom-based workflow, not as your first stop.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| add_noise | BOOLEAN | true | — |
| noise_seed | INT | 00–18446744073709550000 | — |
| cfg | FLOAT | 8.00–100 | — |
| nag_scale | FLOAT | 5.00–100 | — |
| nag_tau | FLOAT | 2.51–10 | — |
| nag_alpha | FLOAT | 0.250–1 | — |
| nag_sigma_end | FLOAT | 0.000–20 | — |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| nag_negative | CONDITIONING | The conditioning describing the attributes you want to exclude from the image for NAG. | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — | |
| latent_image | LATENT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output | LATENT | — |
| denoised_output | LATENT | — |