JLC Flux2 ControlNet Latents Cache
The ControlNet cache node that makes multi-run iteration fast
- vae
- control_image_1
- control_image_2
- control_image_3
- control_image_4
- control_image_1
- cache_set
- cache_report
Every ControlNet run re-encodes your control hint (the canny map, depth map, pose skeleton, whatever you're conditioning on) into a latent before sampling. If you're iterating on a prompt with the same control images wired in, that VAE encode happens again and again for no reason. JLC Flux2 ControlNet Latents Cache exists to break that loop: run it once, it VAE-encodes your hints and stashes the latents in a bounded CPU cache, and the Apply/Orchestrator nodes downstream reuse them instead of re-encoding.
Why you'd reach for it
The real payoff is batch iteration. The author's recommended cache workflow looks like this: a cache-prep branch (these nodes, feeding cache_ready_image-style output to the setup side of JLC Conditional Save Image) runs first, warms the caches, then your actual sampling runs hit the cache. Change the seed, tweak the prompt, re-queue - the control latent work is already done. On 1024×1536 and higher resolutions that VAE encode is not free, and it adds up across a long tuning session.
How it works
You connect a VAE, up to four control images, and set the geometry:
width/height- the final inference latent's dimensions. Hint images don't have to match; they get resized to this before encoding.slot_count- how many of the four slots are active.clear_before_prepare- wipe the hint cache domain first, for when your source images actually changed.diagnostics- verbose logging/reporting.
The node resizes, normalizes, VAE-encodes each hint into the latent shape the Apply nodes expect, and stores the tensors as detached CPU tensors in a bounded process-local cache. It's keyed so that unchanged images hit on later runs. Outputs are control_image_1 (pass-through for wiring continuity), cache_set (boolean), and cache_report (string describing what got cached).
The important subtlety: the cache stores hint latents keyed to the control image, not to the sampling geometry alone. Change your canvas size mid-session and you'll get cache misses, not corruption - the node just falls back to inline preparation.
Installing it
Same pack, same install for every node in JLC-Flux2-ControlNet:
cd ComfyUI/custom_nodes
git clone https://github.com/Damkohler/JLC-Flux2-ControlNet.git
Or search "JLC Flux2 ControlNet" in ComfyUI Manager, then restart. You need a current ComfyUI with native FLUX.2 support, Python 3.10+, and the FLUX.2-dev Fun ControlNet Union checkpoint in ComfyUI/models/controlnet/ if you're actually going to sample. No pip dependencies.
Gotchas
Caches are per-process: restart ComfyUI and everything is cold again. Also, this is a specialist node kept for backwards compatibility - the newer JLC Flux2 Conditioning Cache Prep wraps this same hint cache plus the reference and inpaint caches in one surface, which is what the README points new workflows at. Don't wire a sampler output into anything here; the cache-prep path derives geometry from the same clean Empty Flux2 Latent your sampler uses. And clear_before_prepare is your friend when you swap in new source images - without it, stale cached hints keep being served.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — | |
| control_image_1 | IMAGE | — | |
| width | INT | 102416–16384 | Final output/image width used by the inference latent. Hint images may differ and will be resized to this width before VAE encoding. |
| height | INT | 102416–16384 | Final output/image height used by the inference latent. Hint images may differ and will be resized to this height before VAE encoding. |
| slot_count | INT | 41–4 | — |
| clear_before_prepare | BOOLEAN | false | — |
| diagnostics | BOOLEAN | true | — |
| control_image_2opt | IMAGE | — | |
| control_image_3opt | IMAGE | — | |
| control_image_4opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| control_image_1 | IMAGE | — |
| cache_set | BOOLEAN | — |
| cache_report | STRING | — |