Nodes/ComfyUI fabric/KSampler FABRIC
ComfyUI Node

KSampler FABRIC

Full control over when FABRIC feedback kicks in

By ssitu·Created 3 years ago·Updated 2 years ago· 94
KSampler FABRIC
  • model
  • positive
  • negative
  • latent_image
  • null_pos
  • null_neg
  • pos_latents
  • neg_latents
  • LATENT
seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00
pos_weight1.00
neg_weight1.00
feedback_start0
feedback_end10000

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 behind feedback_percent: want feedback only in the first half? Set feedback_end to roughly half your steps. Want to skip the chaotic early steps and only steer late? Push feedback_start up. 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.

CategoryFABRIC

Inputs (18)

NameTypeDefaultDescription
modelMODELThe model used for denoising the input latent.
seedINT00–18446744073709550000The random seed used for creating the noise.
stepsINT201–10000The number of steps used in the denoising process.
cfgFLOAT8.00–100The 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_nameCOMBOThe algorithm used when sampling, this can affect the quality, speed, and style of the generated output.
schedulerCOMBOThe scheduler controls how noise is gradually removed to form the image.
positiveCONDITIONINGThe conditioning describing the attributes you want to include in the image.
negativeCONDITIONINGThe conditioning describing the attributes you want to exclude from the image.
latent_imageLATENTThe latent image to denoise.
denoiseFLOAT1.000–1The amount of denoising applied, lower values will maintain the structure of the initial image allowing for image to image sampling.
null_posCONDITIONING
null_negCONDITIONING
pos_weightFLOAT1.000–1
neg_weightFLOAT1.000–1
feedback_startINT00–10000
feedback_endINT100000–10000
pos_latentsoptLATENT
neg_latentsoptLATENT

Outputs (1)

NameTypeDescription
LATENTLATENT