Nodes/NK2E/NK2E Set Reference
ComfyUI Node

NK2E Set Reference

The node that hands your edit its source image

By Nynxz·Created 2 months ago·Updated about a month ago· 13
NK2E Set Reference
  • conditioning
  • reference
  • CONDITIONING

Here's the thing about NK2E's reload-free editing: the model wrapper is only half the setup. Someone has to actually tell it what image you're editing, and that's NK2E Set Reference. It's the conditioning-side half of the pair - the node you drop between your text prompt and the KSampler so the "In-Context (Model)" wrapper knows what your source image is.

The nice part is that it's a plain conditioning node. It takes the conditioning stream, stuffs one reference image into it, and passes it along. You never touch the model with it, and swapping the reference image doesn't reload anything - the refs ride along in the conditioning and a global that the model wrapper reads at generation time. Change image, hit run, done. That decoupling is the whole reason the two-node pair beats the legacy single-node edit.

Wiring it

CLIPTextEncode (your instruction) -> NK2E Set Reference -> KSampler (positive)

The two inputs:

  • conditioning (CONDITIONING) - the positive prompt stream from CLIPTextEncode.
  • reference (LATENT) - a VAEEncode of the source image, same as the legacy node takes.

The output is a CONDITIONING that continues on into the KSampler's positive slot. Then wire your model through NK2E In-Context (Model), and the KSampler gets both halves of the puzzle.

Chaining references is the trick worth knowing

Wire one Set Reference after another and each adds its own reference block:

CLIPTextEncode -> Set Reference (front view) -> Set Reference (profile) -> KSampler

That accumulates multiple references for a single edit - two or three angles of a subject, say, to lock identity harder. The mechanism supports it cleanly: every reference becomes its own token block with its own position tag, and they don't even need to match the target's resolution, since each block is sized independently. One reference is the common case; a chain is how you push past the model's weaker identity preservation.

Gotchas

  • It must be on the path that reaches the KSampler. If Set Reference is wired somewhere the positive conditioning doesn't flow through, the model wrapper reads nothing and you get an unedited generation. The wrapper logs [NK2E] in-context active to the console when it runs, which makes this failure obvious fast.
  • Stale references are handled, but check the chain. The node deliberately never caches - it has to execute every prompt or the global would keep a previous run's reference around and silently sample with a stale extra image. If you're chaining, make sure every link in the chain is actually connected; a dangling node is the usual suspect.
  • The deprecation flag is confusing. The author marked this one deprecated in the schema, alongside the legacy edit node - but it's still the only feeder for the (non-deprecated) In-Context Model node. Read it as "the pack is being reshuffled," not "don't use this." You can't run the reload-free path without it.

Install

Standard pack install: git clone https://github.com/Nynxz/ComfyUI-NK2E into custom_nodes (or ComfyUI Manager → search NK2E), restart. No pip dependencies. You still need the full Krea 2 stack - model, Qwen3-VL text encoder, Qwen-Image VAE from Comfy-Org/Krea-2 - plus the NK2E edit LoRA from nynxz/NK2E. Run at Turbo settings (denoise 1.0, low steps, CFG 1) and remember the empty ConditioningZeroOut negative. And know going in: the whole pack is experimental, so budget for rough edges.

CategoryNK2E

Inputs (2)

NameTypeDefaultDescription
conditioningCONDITIONING
referenceLATENT

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING