Nodes/CMK Flow/CMK Refiner -Pipe-
ComfyUI Node

CMK Refiner -Pipe-

The second pass, executed without re-inventing it

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Refiner -Pipe-
  • REFINER
  • VISUAL
  • IMAGE 1ST PASS
  • IMAGE REFINED
  • VISUAL

This is the execute half of CMK's refiner stage. CMK Refiner Prepare SDXL -Pipe- assembles the working bundle - the refiner model, its own prompts, the latent to start from, the seed, steps, CFG, sampler, scheduler, and a start percent. This node runs it.

Two inputs: the REFINER bundle (required) and an optional VISUAL chain. Three outputs: IMAGE 1ST PASS, IMAGE REFINED, VISUAL.

What it does mechanically

It pulls the refiner model, both conditionings, the latent and the VAE off the bundle and calls core's KSamplerAdvanced - with noise disabled and a start step taken from the prepared bundle. That's the whole trick of a refiner: you don't re-diffuse the image from scratch, you take the first pass's latent, add no new noise, and let the model clean up only the last slice of the schedule. The prepare side computes start_at_step from its start-percent setting (80% by default), so "the last 20% of 25 steps" arrives here as literal step numbers 20 through 25.

It then decodes both images: the refined result, and the source. The source comes from the bundle's stored first-pass image if it's there; if not, the node decodes the same latent it sampled from. Either way you get a genuine before picture on IMAGE 1ST PASS and the after on IMAGE REFINED, which is what makes the module's comparison view possible without decoding twice.

Three side effects worth knowing, since none of them are visible on the canvas:

It sends a live preview. The refined image is pushed to the node's latent preview slot immediately, so you see the finished second pass in the node itself during a run rather than only at the end. For previews to work during sampler and refiner runs, ComfyUI's Execution → Live preview method needs to be auto.

It registers the stage on the visual chain. IMAGE 1ST PASS and IMAGE REFINED are registered as a before/after pair at sequence 20 under the label "2nd-Pass SDXL", so the CMK Visualizer can show the refiner as a comparison stage. If VISUAL isn't wired, it just starts an empty chain and nothing downstream sees it.

It unloads models when it's done. By default (unload_models_after_use) the phase models are released after the refiner completes. That's the pack's answer to the fact that a second pass can otherwise leave you holding two checkpoints' worth of VRAM into whatever comes next.

The part I like

If the refiner was bypassed, or its global enable is off, this node does not fail. It skips sampling entirely, VAE-decodes the latent it was handed, and returns that same image as both outputs. Downstream consumers get valid images in the right shapes, the comparison shows no difference because there is none, and the pipeline keeps going. Graceful degradation beats a "refiner disabled but the graph still expects its image" mess, and it's the kind of decision that makes a pack feel designed rather than assembled.

Installing the pack

ComfyUI Manager → search CMK Flow → install the entry from CMKFlow → restart ComfyUI. Registry package name: cmk-flow.

git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

You want CMK dependency check: OK before you touch a workflow. The helper finds the interpreter ComfyUI is actually running - on Desktop installs there can be a system Python, a standalone-env and a .venv all present - installs requirements.txt into it, and verifies the imports. The pack loads all of its nodes in one graph, so a dependency that fails to build can take unrelated nodes down with it.

Updates: git -C custom_nodes/cmk_nodes pull --ff-only and then the installer again. A manual clone never runs pip.

The refiner needs a separate checkpoint - the pack's resource checker lists which ones the bundled workflows expect, and can fetch the ones with a clean public source (Civitai-gated files prompt for an API key that's kept in memory only):

python3 custom_nodes/cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/ComfyUI-shared"

Vue Nodes / Nodes 2.0 must be enabled for the pack's dynamic nodes to behave; this one is CMK/Developer/, so it's in node search but not the Flow Browser catalogue.

Two things that go wrong

If the refined image looks like a completely different picture rather than a slightly crisper version, check the start percent before anything else. Start at 0% with noise disabled and you're effectively asking for a full re-generation from the same latent - different result, and usually a worse one.

If the refiner appears to do nothing at all, the usual cause is the same model on both sides. A refiner checkpoint is supposed to be a different network refining the first pass's output; pointing it at your base checkpoint and running 20% of the schedule will produce a barely-perceptible change, which reads as "broken" but isn't. CMK Pipe Peek Refiner will show you what model is actually in the bundle.

CategoryCMK/Flow/PostProcess

Inputs (2)

NameTypeDefaultDescription
REFINERCMK_REFINER_PIPE—
VISUALoptCMK_VISUAL_PIPE—

Outputs (3)

NameTypeDescription
IMAGE 1ST PASSIMAGE—
IMAGE REFINEDIMAGE—
VISUALCMK_VISUAL_PIPE—