KSampler with Refiner
KSampler with Refiner
- base_model
- refiner_model
- base_positive
- base_negative
- refine_positive
- refine_negative
- base_vae
- refine_vae
- latent_image
- mask
- LATENT
- VAE
This node does the whole base-then-refiner dance in a single box. Instead of chaining two Advanced KSamplers and manually threading leftover noise between them - the classic SDXL base+refiner setup that everyone gets slightly wrong the first time - you plug two models in, say where to switch, and it handles the swap, including re-encoding the latent through a different VAE if the two models need it.
Why you'd reach for it
The base+refiner pattern is genuinely useful: run most of your steps on a model that's good at composition, then finish on one that's good at fine detail. SDXL shipped with an actual refiner checkpoint for exactly this, but the pattern generalizes to any two models. The problem is that wiring it by hand is finicky - you're juggling return_with_leftover_noise, matching step windows, and remembering to re-VAE if the models don't share a latent space. Miss one and you get mush or a hard seam. refine collapses all of that into one node with sane defaults.
The optional mask is the quietly powerful part. Give it one and it sets the latent noise mask, so the refinement pass only reworks the masked region - which turns this into a tidy inpaint-style refiner, the same detect-crop-resample logic that packs like Impact Pack built their reputation on, just expressed as a single sampler.
How it works
It generates with base_model from step 0 up to refine_step, then switches to refiner_model for the remaining steps up to total_steps. If base_vae and refine_vae are different objects, it decodes and re-encodes the latent at the switch so the refiner sees it in the right space; if they're the same, it skips that and just keeps sampling. Each stage gets its own conditioning and its own denoise, so you can prompt the refiner differently from the base.
The inputs that matter
- base_model / refiner_model - your two checkpoints. They can be the same model if you just want a two-stage prompt/denoise change.
- total_steps / refine_step - total step budget and the step at which the switch happens.
refine_stepof 10 out of 20 means a 50/50 split. - base_positive / base_negative and refine_positive / refine_negative - separate conditioning per stage. Feed the refiner a detail-focused prompt if you like.
- base_vae / refine_vae - pass both. Same VAE = no re-encode; different = automatic re-encode at the switch.
- base_denoise / refine_denoise, seed, cfg, sampler_name, scheduler, latent_image - the usual sampler controls.
- mask (optional) - sets the latent noise mask, confining the work to that region.
Outputs are a LATENT (decode it to see the image) and the VAE that was active at the end - handy so you can pass the correct VAE straight to a decode node without guessing which of the two to use.
Installing it
ComfyUI Manager → search antrobots ComfyUI Nodepack. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/antrobot1234/antrobots-comfyUI-nodepack
Restart ComfyUI. No model downloads beyond the checkpoints and VAEs you were going to load anyway; the node itself has no special dependencies.
Common issues
The number-one mistake is refine_step set to or past total_steps - then the refiner never runs and you've just done a plain generation on the base. Keep refine_step comfortably below total_steps.
Second: if the switch produces a visible color shift or a soft seam, you've almost certainly got mismatched VAEs where you didn't mean to, or a refine_denoise set too high (which lets the refiner repaint composition, not just detail). Drop the refiner denoise toward 0.5–0.7 and confirm both VAEs actually match your models. And remember the output VAE slot exists precisely so your decode uses the correct one - wire it, don't hardcode.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| base_model | MODEL | — | |
| refiner_model | MODEL | — | |
| total_steps | INT | 201–10000 | — |
| refine_step | INT | 100–10000 | — |
| base_positive | CONDITIONING | — | |
| base_negative | CONDITIONING | — | |
| refine_positive | CONDITIONING | — | |
| refine_negative | CONDITIONING | — | |
| base_vae | VAE | — | |
| refine_vae | VAE | — | |
| base_denoise | FLOAT | 1.000.01–1 | — |
| refine_denoise | FLOAT | 1.000.01–1 | — |
| seed | INT | 00–18446744073709550000 | The random seed used for creating the noise. |
| cfg | FLOAT | 8.00–100 | The Classifier-Free Guidance scale balances creativity and adherence to the prompt. Higher values result in images more closely matching the prompt however too high values will negatively impact quality. |
| sampler_name | COMBO | The algorithm used when sampling, this can affect the quality, speed, and style of the generated output. | |
| scheduler | COMBO | The scheduler controls how noise is gradually removed to form the image. | |
| latent_image | LATENT | The latent image to denoise. | |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | The denoised latent. |
| VAE | VAE | — |