KSampler FABRIC (Simple)
The FABRIC sampler the author actually intends
- model
- positive
- negative
- latent_image
- clip
- pos_latents
- neg_latents
- LATENT
FABRIC is the training-free "personal RLHF" trick from the 2023 paper of the same name (arXiv 2307.10159): give a diffusion model reference images you like and images you don't, and it steers the generation toward the first and away from the second by injecting their attention states during denoising. This node is the version of that idea the author calls "intended" - the one you should reach for first, before its more fiddly siblings in the same ComfyUI_fabric pack.
What you get. It's a regular KSampler - model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise - with the FABRIC controls bolted on. The two things that make it "simple" compared to the pack's other samplers:
clipreplaces the explicit null conditioning. It runs an emptyCLIPTextEncodeinternally (FABRIC's reference latents are encoded against an empty text embedding, not your prompt), so you don't have to build that conditioning by hand.feedback_percentreplaces the start/end step pair. Default 0.8, meaning feedback runs during the first 80% of steps - which lines up neatly with the researchers' recommendation to only apply feedback to the first half of denoising. Set it to 1.0 for the whole run or drop it to 0.5 for a gentler touch.
pos_weight and neg_weight (both default 1.0) scale how strongly the liked/disliked references pull. Ignore the README's advice at your peril: the default 1.0 is "probably too high in most cases," so treat those two as your tuning dials and expect to go lower.
pos_latents and neg_latents are the actual reference images, as VAE-encoded LATENT batches. Leave them empty and this node quietly becomes a normal KSampler - it prints a note to the console and samples normally, so don't expect a fancy error if you forgot to wire them up.
How it works under the hood. Internally it's a thin wrapper: it encodes the empty conditioning, converts feedback_percent into a start/end step range, and delegates to the pack's full-control sampler (KSamplerFABRICAdv). That one, in turn, handles the real machinery - noising your reference latents to each timestep, running them through the U-Net to capture per-block attention states, then appending those states to the live keys/values during sampling, scaled by your weights. All inference-time, no training.
Install. No dependencies, no model downloads:
cd ComfyUI/custom_nodes
git clone https://github.com/ssitu/ComfyUI_fabric
Restart ComfyUI (or find "ComfyUI fabric" in ComfyUI Manager). It's in the FABRIC/ menu.
Where people get burned. Size consistency is the big one: input latent, pos_latents, and neg_latents should all match in pixel dimensions. Mismatches get bilinear-resized, which the author flatly says is a poor way to resize latents - resize your references in pixel space first. Memory is the second: each reference latent adds a forward pass per feedback step, and OOM is the usual failure. Switch your cross-attention method or use a smaller batch of references. And since this pack hasn't been touched since May 2024 and monkeypatches attention backends directly, treat it as fragile after big ComfyUI updates - if the node suddenly does nothing or throws, that's the first suspect.
A practical companion: the author's README links to chrisgoringe/cg-image-picker's Image Chooser, which has built-in FABRIC support - it can emit positive and negative latent batches straight into this node, which turns the "round-by-round feedback" workflow (like one image, dislike another, rerun) into something you can actually run without hand-editing batch nodes.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | The model used for denoising the input latent. | |
| seed | INT | 00–18446744073709550000 | The random seed used for creating the noise. |
| steps | INT | 201–10000 | The number of steps used in the denoising process. |
| 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. | |
| positive | CONDITIONING | The conditioning describing the attributes you want to include in the image. | |
| negative | CONDITIONING | The conditioning describing the attributes you want to exclude from the image. | |
| latent_image | LATENT | The latent image to denoise. | |
| denoise | FLOAT | 1.000–1 | The amount of denoising applied, lower values will maintain the structure of the initial image allowing for image to image sampling. |
| clip | CLIP | — | |
| pos_weight | FLOAT | 1.000–1 | — |
| neg_weight | FLOAT | 1.000–1 | — |
| feedback_percent | FLOAT | 0.800–1 | — |
| pos_latentsopt | LATENT | — | |
| neg_latentsopt | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |