KSampler FABRIC (Advanced)
FABRIC for multi-stage and img2img workflows
- model
- positive
- negative
- latent_image
- null_pos
- null_neg
- pos_latents
- neg_latents
- LATENT
This is the FABRIC node for people whose workflow doesn't fit inside a single plain KSampler. FABRIC, in one line, is the training-free "personal RLHF" technique (paper arXiv 2307.10159): reference images you like and dislike get their attention states injected during denoising, pulling the output toward the liked ones and away from the disliked ones. The other sampler nodes in ComfyUI_fabric wrap a regular KSampler; this one wraps KSamplerAdvanced, which means it comes with add_noise, start_at_step, end_at_step, and return_with_leftover_noise on top of the full FABRIC input set.
When you'd reach for it. Two situations. First, img2img and partial-denoise passes: the advanced sampler's start_at_step/end_at_step let you denoise only part of the schedule, which matters when your input latent already carries content you want to keep. Second, multi-stage pipelines - refiner passes, upscale-then-denoise, or any workflow where a plain denoise value doesn't cut it. If you just want FABRIC steering from a text-to-image, the plain "KSampler FABRIC" or the Simple variant will serve you better and annoy you less.
The FABRIC inputs are the full set, shared with the plain KSamplerFABRICAdv:
null_pos/null_neg- required conditionings (feed both an emptyCLIPTextEncodestring; that's the intended setup).pos_weight/neg_weight- both default 1.0; the README warns that's usually too strong.feedback_start/feedback_end- the explicit step window for feedback. Defaults 0 and 10000 (the whole run). The researchers recommend feedback only in the first half of denoising.pos_latents/neg_latents- your liked/disliked references as VAE-encoded latent batches.
One quirk to know up front: denoise is not an input here - the source hard-codes it to 1.0. The advanced KSampler it's built on normally offers denoise alongside start_at_step/end_at_step, but this node silently forces full denoise and uses those two fields for scheduling instead. If you're coming from stock KSamplerAdvanced muscle memory, that's the difference that will trip you up.
How it works. Everything funnels into fabric_sample: it computes the sampler's timestep schedule, translates feedback_start/feedback_end into that schedule, and wraps the model so that during the feedback window each reference latent gets noised to the current timestep, run through the U-Net against the null conditioning, and has its per-block attention states appended to the live keys and values - scaled by your weights. Pure inference-time attention injection, no training, no extra weights. Outside the window it samples completely normally.
Install. Identical to the rest of the pack - no dependencies, no model downloads:
cd ComfyUI/custom_nodes
git clone https://github.com/ssitu/ComfyUI_fabric
Restart ComfyUI (or find "ComfyUI fabric" in Manager). It's under the FABRIC/ menu.
Gotchas. The usual FABRIC trio: keep input, pos, and neg latents the same pixel size (mismatches get bilinear-resized, which the author says is a poor way to do it - resize in pixel space), expect memory pressure because each reference adds forward passes (switch cross-attention backends or shrink the reference batch on OOM), and remember this pack hasn't been updated since May 2024 and monkeypatches attention internals, so a big ComfyUI update may break it or silently degrade it to a plain sampler. If generations stop reacting to your references, check the console - the [FABRIC] prints will tell you what it's doing.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| add_noise | COMBO | 2 options: enable, disable | |
| noise_seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.00–100 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| start_at_step | INT | 00–10000 | — |
| end_at_step | INT | 100000–10000 | — |
| return_with_leftover_noise | COMBO | 2 options: disable, enable | |
| null_pos | CONDITIONING | — | |
| null_neg | CONDITIONING | — | |
| pos_weight | FLOAT | 1.000–1 | — |
| neg_weight | FLOAT | 1.000–1 | — |
| feedback_start | INT | 00–10000 | — |
| feedback_end | INT | 100000–10000 | — |
| pos_latentsopt | LATENT | — | |
| neg_latentsopt | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |