Nodes/ComfyUI fabric/FABRIC Patch Model (Advanced)
ComfyUI Node

FABRIC Patch Model (Advanced)

Bring your own empty conditioning

By ssitu·Created 3 years ago·Updated 2 years ago· 94
FABRIC Patch Model (Advanced)
  • model
  • null_pos
  • null_neg
  • pos_latents
  • neg_latents
  • MODEL
pos_weight1.00
neg_weight1.00

If you've read the plain FABRIC Patch Model, this is its slightly fussier sibling. Same job - patch a model so its self-attention steers generation toward your liked reference images and away from your disliked ones (the "personal RLHF" trick from the FABRIC paper, arXiv 2307.10159) - but instead of accepting a clip and building the internal "empty" conditioning for you, it makes you supply the two conditioning inputs yourself. You trade a little convenience for a little control, and occasionally you want that control.

What changed. The basic node takes a CLIP input and runs an empty CLIPTextEncode internally to produce the null conditioning FABRIC needs. This one exposes that step as two required CONDITIONING inputs:

  • null_pos - the conditioning used to compute the hidden states of the positive reference latents.
  • null_neg - same thing for the negative latents.

"Intended to just be an empty clip text embedding," the README says, "but it might be interesting to experiment with." That last clause is the reason this node exists: the null embedding is what the reference images get encoded against, so changing it changes what "reference" means to the sampler. In practice almost everyone feeds the same empty-string embedding into both. If you want to see why anyone bothers, encode an empty prompt with CLIPTextEncode, feed that into both ports, and then try a meaningful phrase - it's an odd little dial.

Everything else is identical to the basic patch: model, pos_weight, neg_weight (both default 1.0 - the README warns that's usually too high), optional pos_latents / neg_latents, and a patched MODEL out that you can hand to any regular KSampler. No reference latents, no patch - it returns the model untouched.

Mechanism, briefly. The node clones the model and wraps its self-attention. The reference latents are noised to the current timestep, passed through the U-Net against the null conditioning, and their per-block hidden states get captured. During actual denoising, those states are appended to the keys and values of the live attention, scaled by the pos/neg weights. Training-free, no extra weights - the whole technique rides on attention injection.

Install. Same as the rest of the pack - no dependencies, no model files:

cd ComfyUI/custom_nodes
git clone https://github.com/ssitu/ComfyUI_fabric

Restart ComfyUI (or use Manager, searching "ComfyUI fabric"). Everything lands under the FABRIC/ menu.

Gotchas worth knowing before you wire it up. All three latents (input, pos, neg) should match in size - mismatches get bilinear-resized with a warning, and the author explicitly says that's not a good way to resize latents; do it in pixel space. Memory is the other classic trap: reference latents mean extra forward passes, so OOM complaints are common. The README's fixes are to switch cross-attention methods (xformers vs. pytorch) or trim the number of reference latents, and if you're on pytorch attention, the nightly build has better memory behavior. And remember the patch applies feedback on every denoising step - there's no window control here. The researchers recommend limiting feedback to the first half of sampling, which is something only the KSampler FABRIC nodes from this pack let you actually do.

CategoryFABRIC

Inputs (7)

NameTypeDefaultDescription
modelMODEL
null_posCONDITIONING
null_negCONDITIONING
pos_weightFLOAT1.000–1
neg_weightFLOAT1.000–1
pos_latentsoptLATENT
neg_latentsoptLATENT

Outputs (1)

NameTypeDescription
MODELMODEL