KSampler FABRIC
Full control over when FABRIC feedback kicks in
- model
- positive
- negative
- latent_image
- null_pos
- null_neg
- pos_latents
- neg_latents
- LATENT
FABRIC - "Feedback via Attention-Based Reference Image Conditioning" (arXiv 2307.10159) - is the training-free trick that steers a diffusion model toward reference images you like and away from ones you don't, by injecting their attention states during denoising. This node is the version of that idea with the training wheels off: a regular KSampler plus every FABRIC control, most importantly the ability to say exactly which denoising steps get feedback.
Don't let the name confuse you. The display name here is just "KSampler FABRIC," and it's built on top of a plain (non-advanced) KSampler - model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise. The "Adv" in the class name refers to the FABRIC inputs being the full, advanced set, not the sampler backend. The genuinely advanced sampler variant is KSamplerAdvFABRICAdv, which is a different node in this pack.
The inputs that matter. Over and above a normal KSampler:
null_pos/null_neg- the conditioning used when computing the reference latents' hidden states. These are required, and "intended to just be an empty clip text embedding." Feed them from a CLIPTextEncode with an empty string (into both ports) and you're doing it right.feedback_start/feedback_end- the explicit step window for feedback. Defaults are 0 and 10000 (i.e. the whole run). This is the dial the Simple sampler hides behindfeedback_percent: want feedback only in the first half? Setfeedback_endto roughly half your steps. Want to skip the chaotic early steps and only steer late? Pushfeedback_startup. The researchers recommend feedback in the first half of denoising, but with explicit steps you get to disagree.pos_weight/neg_weight- both default 1.0; the README warns that's usually too strong, so expect to dial down.pos_latents/neg_latents- your liked/disliked references as VAE-encoded latent batches. Wire neither in and it just samples like a normal KSampler.
How it works. Under the hood it converts seed to the advanced sampler's noise_seed, and hands off to fabric_sample, which does the actual work: it noises each reference latent to the current timestep, pushes them through the U-Net against the null conditioning, captures per-block self-attention hidden states, then appends those states to the live keys and values during denoising - scaled by your weights - only within the feedback_start/feedback_end window. The name's all capslock, but it's just an inference-time attention injection. No training, no extra weights.
Install. Same drill as 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 grab "ComfyUI fabric" from ComfyUI Manager). It lives in the FABRIC/ menu.
Gotchas. Keep input, pos, and neg latents the same pixel size - mismatches get bilinear-resized, which the author explicitly says is a poor way to resize latents; fix sizes in pixel space. Memory is the recurring complaint since each reference adds forward passes - switch cross-attention backends or trim the reference batch if you OOM. And remember the pack is unmaintained since May 2024 and monkeypatches attention functions, so after a big ComfyUI update this node may break or silently fall back to normal sampling - check the console for the [FABRIC] prints if it looks like it stopped steering.
Inputs (18)
| 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. |
| 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 | — |