Nodes/RES4LYF/ClownGuide SelfRefine
ComfyUI Node Runs on cloud

ClownGuide SelfRefine

Refine an image against its own estimate, no reference

By ClownsharkBatwing·Created 2 years ago·Updated 22 days ago· 1,222
ClownGuide SelfRefine
  • mask
  • weights
  • guides
guide_modeself_refine_epsilon
channelwise_modefalse
projection_modefalse
weight1.00
weight_schedulerconstant
start_step0
end_step15
invert_masksfalse
self_refine_threshold0.20
self_refine_cutoff0.99
self_refine_metricL1

Most of RES4LYF's guides steer your generation toward an external reference image. SelfRefine is the odd one that doesn't need one. It guides the image toward its own evolving denoised estimate - a self-consistency pass that can tighten coherence and clean up wobble without importing anything from outside. Notice there's no guide latent input here: that absence is the whole idea.

Like the rest of the family, it builds a GUIDES bundle that plugs into the sampler's guides input and acts during sampling. The self-refine guide modes also appear inside the bigger dual-guide node, but this dedicated node exposes just them, with their own threshold and metric controls, so you can add a refinement pass without wading through the kitchen-sink guide's options.

How it works

During sampling the model is constantly forming a prediction of the finished image. SelfRefine takes that internal estimate and feeds it back as a soft guide, encouraging the trajectory to stay consistent with where it's already heading rather than drifting. Two modes are on offer - self_refine_epsilon and self_refine_pseudoimplicit - differing in the math of how the refinement is applied. A threshold and cutoff decide when the refinement kicks in and stops, and you choose whether the comparison uses an L1 or L2 distance metric.

The inputs and outputs that matter

  • guide_mode (enum: self_refine_epsilon, self_refine_pseudoimplicit; default the former) - which refinement method. Start with the default.
  • weight (FLOAT, default 1) - how strongly to pull toward the self-estimate.
  • self_refine_threshold (FLOAT, default 0.2) and self_refine_cutoff (default 0.99) - the window, in normalized terms, where refinement is active. These gate when it engages.
  • self_refine_metric (enum: L1, L2; default L1) - the distance used to compare against the estimate. L1 is more forgiving of outliers, L2 punishes big deviations harder.
  • weight_scheduler, start_step / end_step, mask - the shared scheduling, step-window, and regional controls.

Output is a guides (GUIDES) bundle for the sampler or the next guide.

How to install it

ComfyUI Manager: search RES4LYF, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/ClownsharkBatwing/RES4LYF/, pip install -r requirements.txt in the venv (portable: embedded python's pip), restart, hard-refresh F5. Nested sampler menu: rgthree-comfy with "Auto Nest Subdirectories" on.

Common issues

The failure mode to watch is over-refinement. Push weight too high or open the threshold/cutoff window too wide and the image can lock onto its early estimate and stop developing - you get something over-smoothed, plasticky, or weirdly rigid, because the guide keeps dragging it back to an unfinished prediction. If detail collapses, lower the weight and tighten the window.

It's also genuinely subtle. On an already-clean flow-matching generation with a good sampler and beta57, SelfRefine may do very little visible work - its value shows up more on trickier cases where sampling would otherwise wander. Don't expect a dramatic before/after on an easy prompt. And since this is deep, thinly-documented sampler territory, use a fixed seed and change one control at a time; the difference between "helped" and "over-refined" is a small move on weight, and you won't see it if the seed is also moving.

CategoryRES4LYF/sampler_extensions

Inputs (13)

NameTypeDefaultDescription
guide_modeCOMBOself_refine_epsilonSelf-refine guide mode.
channelwise_modeBOOLEANfalse
projection_modeBOOLEANfalse
weightFLOAT1.00-100–100Set the strength of the guide.
weight_schedulerCOMBOconstant12 options: constant, simple, sgm_uniform, karras, exponential, ddim_uniform, +6
start_stepINT00–10000
end_stepINT15-1–10000
invert_masksBOOLEANfalse
self_refine_thresholdFLOAT0.200–1Self-refine threshold for masking. (Use much lower value for L2 versus L1 metric (eg. 0.05 vs 0.20))
self_refine_cutoffFLOAT0.990–1Skip remaining iterations when certain mask coverage exceeds this fraction.
self_refine_metricCOMBOL1Self-refine metric for thresholding.
maskoptMASK
weightsoptSIGMAS

Outputs (1)

NameTypeDescription
guidesGUIDES