Nodes/JLC Flux2 ControlNet/ JLC Flux2 Reference Latents Cache
ComfyUI Node

 JLC Flux2 Reference Latents Cache

Pre-encode your reference images so editing stays fast

By Damkohler·Created 2 months ago·Updated 26 days ago· 20
 JLC Flux2 Reference Latents Cache
  • vae
  • reference_image_1
  • reference_image_2
  • reference_image_3
  • reference_image_4
  • reference_image_5
  • reference_image_6
  • reference_image_7
  • reference_image_8
  • reference_image_9
  • reference_image_10
  • reference_image_1
  • cache_set
  • cache_report
slot_count2
clear_before_preparefalse
diagnosticstrue

FLUX.2's big selling point is multi-reference editing: show the model a couple of images and tell it what to change. The catch is that every reference image gets VAE-encoded into a latent before the sampler runs, and if you're doing a dozen edits against the same reference set, that's a dozen redundant encodes. JLC Flux2 Reference Latents Cache is the specialist node that prewarms those reference latents into a CPU cache so the Reference Image Orchestrator doesn't re-encode them every run.

Why you'd reach for it

Think character-consistency work: you have three reference images of a person and you're iterating on poses, outfits, lighting. The references never change; only the prompt and seed do. That's exactly the "unchanged input, repeated run" pattern a cache exists for. The author's validated 1024×1536 reference workflow explicitly runs warmed reference, ControlNet, and inpaint caches, and this node is the reference half of that.

How it works

It's deliberately simple - no reference-method dropdown, no weighting, no scaling. The node takes a VAE and up to ten reference images, VAE-encodes each one, and stores the latents as detached, contiguous CPU tensors in a bounded process-local cache.

  • slot_count - active reference slots (1–10).
  • clear_before_prepare - drop the existing reference-latent cache before re-encoding.
  • diagnostics - reporting toggle.

The cache is method-agnostic: native FLUX.2 reference methods (offset, index, and so on) only change how tokens are positioned downstream; they don't change the encoded latent, so one cached latent is safe under any method you select in the Reference Image Orchestrator. Outputs are reference_image_1 (pass-through), cache_set, and cache_report.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/Damkohler/JLC-Flux2-ControlNet.git

Restart ComfyUI, or install "JLC Flux2 ControlNet" via ComfyUI Manager. Requires current ComfyUI with native FLUX.2 support and Python 3.10+; the ControlNet checkpoint only matters if you're also running a ControlNet branch. No pip dependencies.

Gotchas

Resizing and cropping are your job - the node encodes exactly the image tensor it receives, so prepare references to the final aspect you'll use. The cache is per-process, so a restart means a cold re-encode, and if your references change, hit clear_before_prepare or you'll keep getting the old latents served. And like all the JLC cache nodes, this is the specialist path kept for existing workflows; new graphs should use JLC Flux2 Conditioning Cache Prep, which fronts this same reference cache plus the hint and inpaint caches in one node. If you're building a fresh workflow, start there.

CategoryFlux2 Latents Cache/utils

Inputs (14)

NameTypeDefaultDescription
vaeVAE
reference_image_1IMAGE
slot_countINT21–10
clear_before_prepareBOOLEANfalse
diagnosticsBOOLEANtrue
reference_image_2optIMAGE
reference_image_3optIMAGE
reference_image_4optIMAGE
reference_image_5optIMAGE
reference_image_6optIMAGE
reference_image_7optIMAGE
reference_image_8optIMAGE
reference_image_9optIMAGE
reference_image_10optIMAGE

Outputs (3)

NameTypeDescription
reference_image_1IMAGE
cache_setBOOLEAN
cache_reportSTRING