Set Reference Latent
The tiny node that feeds edit models their target
- conditioning
- latent
- CONDITIONING
Somewhere in your Qwen-Edit or other edit-model workflow there's a step where the model needs to know what image it's editing. This is that step. Set Reference Latent (node id ReferenceLatent) takes a CONDITIONING and - if you give it a latent - tacks that latent onto the conditioning as a reference. Output: the same conditioning, now carrying the image the edit model should keep consistent with.
The mechanism is a single dictionary append. The node copies your conditioning and adds reference_latents: [latent["samples"]] to it (appending, not overwriting). That's the whole thing. It's why the description notes you can chain multiple instances to stack several reference images - each call appends another entry to the list, and edit models that support multi-reference will read all of them. Leave the latent input unconnected and the node is a pure passthrough, which is how you build a workflow where reference supply is optional.
The inputs: conditioning (required, from your text encode) and latent (optional, typically from a VAEEncode of the image being edited, or the latent you're conditioning against). The output is a single CONDITIONING. Nothing else to tune - no strength, no blend. It's deliberately dumb, and that's the point: it exists because edit models (the nodes_edit_model.py family) consume reference images through the conditioning dict rather than through a separate image input, so something has to move your latent into that dict.
Where you'll actually see it: Qwen-Image-Edit workflows. The Qwen edit text-encode node (TextEncodeQwenImageEdit) can embed a reference image itself when you pass it vae + image, but the reference-latent path is the general one - and it's how multi-reference editing gets built. Combine it with TextEncodeQwenImageEditPlus's separate image slots if you want more than one reference.
It's core (comfy_extras/nodes_edit_model.py), ships with ComfyUI, nothing to install. ReferenceLatent itself is a genuinely recent helper - the whole edit-model file is new-ish.
The practical gotcha is subtle and worth knowing: the reference latent must come from a VAE that matches the edit model's latent space. Encode your reference with the wrong VAE and the model will faithfully reproduce... wrong-shaped noise, which reads as "it ignored my reference." Also, since it appends rather than replaces, chaining it after a node that already set a reference adds one rather than swapping it - if you're iterating between one and two references, make sure the graph structure actually removes the old branch instead of stacking them.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| latentopt | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |