Nodes/ComfyUI_LucidNFT/LucidNFT VAE Patch (F16, optional)
ComfyUI Node

LucidNFT VAE Patch (F16, optional)

One Dropdown, Twice the Resolution — With a Catch

By smthemex·Created 7 months ago·Updated 6 days ago· 21
LucidNFT VAE Patch (F16, optional)
  • vae
  • VAE

What it's for

ComfyUI assumes every Flux-family VAE is /8 - eight latent pixels per output pixel, one downsampling stage of three. UltraFlux's F16 VAE isn't. It's /16, so loading it the normal way and decoding a 128×128 latent gives you a 1024×1024 image when the model intends 2048. Half resolution, no error message, and the only clue is that your "2K" output is the same size as everything else.

LucidNFT VAE Patch fixes the semantics. You drop it between VAELoader and VAEDecode, and the same latent decodes at double the pixel size. (A 1024×1024 latent becomes a 2048×2048 image. Yes, that costs what you'd expect.)

How it works

The patch reaches into the AutoencodingEngine, sets the encoder's input conv to stride 2, and wraps the decoder's final conv so it does a nearest-neighbour ×2 before the convolution. Then it overwrites downscale_ratio and upscale_ratio on the VAE object to 16, because that's the number the rest of ComfyUI reads when it converts between pixel and latent space. End result: the model still thinks in 8s, the VAE now reports 16s, and a latent of half the usual size produces the image you asked for.

Two properties of the implementation are worth knowing because they change how you wire it:

It mutates the VAE in place. The node returns the same object it was handed, patched. So put it inline on the one path that needs it - VAELoader(UltraFlux) → LucidNFT VAE Patch → VAEDecode - rather than tapping that loader for something else as well.

It's idempotent. There's a guard flag on the decoder, so a double application is a no-op rather than a mess. Running the graph twice won't stack a second ×2.

Inputs and output

One input, vae, one output, VAE of the same type. That's it - there's nothing to configure and nothing to get right except placement.

The node raises if what it's given isn't a comfy AutoencodingEngine with a decoder attribute. In practice that means TAESD and other stripped preview VAEs won't work, which is fine because they're the wrong tool here anyway.

Installing it

It's part of the pack, so: ComfyUI Manager → search LucidNFT → install → restart, or

cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_LucidNFT

No extra Python packages - torch and einops, both already present. The only file this node cares about is the VAE you point at it:

ComfyUI/models/vae/UltraFlux.safetensors   # optional; only if you're going for 2K

You can skip the whole thing. The official LucidNFT path uses the ordinary Flux AE at /8 and goes straight from VAELoader to VAEDecode. This node is the 2K branch.

Where people get burned

Using it with the Flux AE. If you patch a /8 VAE you don't get a bigger, better image - you get a 2× stretched decode of a latent that was already correct, which looks like a badly upscaled render. The pack's own comment on the class is unambiguous: with the flux ae, don't connect it. Different but same: an FP8 or scalar-quantised Flux VAE is still a Flux VAE, so it's still /8.

Forgetting to halve the latent. The patch changes what the latent means, not how big it is. If you leave EmptySD3LatentImage at 1024 while chasing 2K you'll get 2048 - but if you also set DiffBIR's width/height to 2048 you'll have fed the condition branches a hint twice the size they expect (they want latent × 8, i.e. 1024) and the Condition node will bilinearly shrink it back. Keep the latent at half the target, keep DiffBIR at latent × 8, and the geometry lines up.

Reading the size as a quality win. It isn't, by itself. The KB's upscaling notes put it plainly: more pixels and more detail are different jobs. The F16 VAE gets you the 2K output the model was trained for; it doesn't invent anything extra. And every node after VAEDecode now handles four times the pixels - Color Align included, which is where you'll feel it on a batch.

CategoryLucidNFT

Inputs (1)

NameTypeDefaultDescription
vaeVAE—

Outputs (1)

NameTypeDescription
VAEVAE—