Nodes/ComfyUI-RefSampling/Apply Ref Style
ComfyUI Node

Apply Ref Style

Steal the look, leave the subject

By logtd·Created 2 years ago·Updated 2 years ago· 5
Apply Ref Style
  • model
  • ref_latents
  • style_positive
  • style_negative
  • MODEL
enabledtrue
attention_count4
start_percent0.00
end_percent0.70

Where its sibling copies the subject, Apply Ref Style copies the look. This is the Visual Style Prompting half of the pack - an implementation of the technique from NAVER AI's Visual Style Prompting paper, which the README links straight to. The demo says it all: prompt "orange gorilla stripes", reference style "black and orange stripes", and the gorilla stays a gorilla while the stripe treatment transfers over. Content and style, cleanly separated.

Why you'd reach for it

Apply Ref Style ships in ComfyUI-RefSampling, a proof-of-concept pack from logtd (also behind ComfyUI-Fluxtapoz and the ComfyUI port of InstanceDiffusion). It's the "steal the vibe" companion to Apply Ref Content - the pair sits in the same model chain, content first, style second, both before the KSampler. Where IP-Adapter gives you style transfer via a trained adapter you have to download and slot in, this does it with attention injection and a couple of text prompts, no extra weights at all.

How it works

Same attention-banking foundation as Apply Ref Content, different payload. The node runs your reference latent through the UNet with a style prompt as the conditioning, and banks the key/value pairs from the last few output blocks of the network. When the real generation runs, the model's keys and values get swapped for the reference's banked ones - so every query in your generated image is answered by the style tokens you described, not by your content prompt's tokens. That's why you give it both a reference image and text: the reference is interpreted through the style description.

The inputs that matter

  • ref_latents (LATENT) - VAEEncode'd reference image, same checkpoint's VAE.
  • style_positive / style_negative (CONDITIONING) - the text that says what style you're after ("black and orange stripes", "blue dragon, flames"). These do real work; a vague prompt gives you a vague transfer.
  • attention_count (default 4) - how many of the final output blocks' key/value pairs get banked. Too high and the reference smears over everything; too low and nothing lands.
  • start_percent / end_percent (default 0→0.7) - style is active during the first ~70% of denoising: early structure, then freedom to settle.

The enabled toggle and the single MODEL output work exactly like the content node - chain it into the KSampler and go.

Install

# Easiest - ComfyUI Manager:
#   Manager → Install Custom Nodes → search "ComfyUI-RefSampling" → Install → restart ComfyUI

# Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/logtd/ComfyUI-RefSampling
# restart ComfyUI

No requirements.txt, no pip install, no model files. Just a working SD 1.5 or SDXL environment.

Where people get burned

  • ApplyRefUNetNode must be in the chain before this node, or nothing happens. The example workflow order is Checkpoint → ApplyRefUNetNode → ApplyRefContentNode → ApplyRefStyleNode → KSampler.
  • SD 1.5/SDXL UNets only. No BasicTransformerBlock (Flux, Qwen, any DiT) means silent no-op, not an error.
  • The style conditioning isn't decoration. Visual Style Prompting transfers style through the text description - it's not a pure pixel-level style clone. Describe what you want in the prompt, not just what's in the picture.
  • Watch attention_count. Four is a sane start. Crank it and you'll get that muddy "everything looks like the reference" smear that makes style-transfer tools feel useless.

One honest note: this is a proof-of-concept pack, and you can feel it. Expect to tune the window and count per image. But when you've got a subject you want to keep and a look you want to borrow, watching the two nodes work together is genuinely satisfying - and you'll understand attention injection better for having played with it.

Categoryflow

Inputs (8)

NameTypeDefaultDescription
modelMODEL
ref_latentsLATENT
enabledBOOLEANtrue
style_positiveCONDITIONING
style_negativeCONDITIONING
attention_countINT40–10
start_percentFLOAT0.000–1
end_percentFLOAT0.700–1

Outputs (1)

NameTypeDescription
MODELMODEL