Reference Latent Batch (CRT)
Reference Latent Batch (CRT)
- conditioning
- latent
- CONDITIONING
Reference Latent Batch (CRT) takes a batch of latents and registers every single frame of it as a separate reference for edit-model conditioning - doing in one node what used to take a chain of N ReferenceLatent nodes. It's aimed squarely at FLUX.2-class edit models (the ones with a reference_latents conditioning slot), and it's the rare CRT node whose most interesting feature is a subtle correctness fix.
First, the context. Edit models like flux2klein condition their sampling on reference latents - pre-encoded images that tell the model "this is the content you're editing from." The stock ReferenceLatent node registers one latent per node call. Fine for a single reference; awkward when you want to hand over several frames at once. That's the problem this node collapses: instead of N nodes in a row, you wire one latent batch (say, N keyframes you've pre-encoded) plus your conditioning, and every frame becomes a reference. One node, N references.
The subtle part is what the node's own description makes a point of. ComfyUI's downstream code counts tokens per reference entry from the spatial dimensions alone, so if you wrapped a whole [N, C, H, W] batch as one entry, frames 2 through N would be silently ignored and the KV-cache slicing would be wrong. This node iterates the batch and appends each [1, C, H, W] frame as its own entry - which is what makes N frames in one batch genuinely equivalent to chaining N ReferenceLatent nodes.
And then there's the permutation guarantee. Because frames are sorted by a full-content SHA-1 hash before registration, any reordering of the same input latents produces byte-identical conditioning - including identical memory strides, via a contiguous() call. That's the difference between "same images, different order → different result" and "same images, any order → same result." For reproducibility (matching seeds, comparing workflows, running batches in shuffled order), that determinism is a real property, not a gimmick.
The inputs are just conditioning (your CONDITIONING to attach the references to) and latent (the batch to register). The single output is the modified CONDITIONING, which then feeds your sampler exactly like any other conditioned input. Wire it after your CLIP text encode and before the KSampler; the reference latents ride along inside the conditioning object.
The honest catch: this node only means something if your model consumes reference_latents - it's a no-op for models that don't support edit conditioning. And it presumes your latent batch actually is the reference set you want; frames get registered wholesale, so feed it exactly the frames you intend to reference. Install with the pack (ComfyUI Manager → search "CRT-Nodes", or clone https://github.com/plugcrypt/CRT-Nodes.git into custom_nodes and restart) - no models or heavy deps involved.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| latent | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |