JLC Flux2 Reference Latents Cache
Pre-encode your reference images so editing stays fast
- 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
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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — | |
| reference_image_1 | IMAGE | — | |
| slot_count | INT | 21–10 | — |
| clear_before_prepare | BOOLEAN | false | — |
| diagnostics | BOOLEAN | true | — |
| reference_image_2opt | IMAGE | — | |
| reference_image_3opt | IMAGE | — | |
| reference_image_4opt | IMAGE | — | |
| reference_image_5opt | IMAGE | — | |
| reference_image_6opt | IMAGE | — | |
| reference_image_7opt | IMAGE | — | |
| reference_image_8opt | IMAGE | — | |
| reference_image_9opt | IMAGE | — | |
| reference_image_10opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| reference_image_1 | IMAGE | — |
| cache_set | BOOLEAN | — |
| cache_report | STRING | — |