PromptZone - AI Prompts, Guides and Tools for Builders

Cover image for SDXL VAE Explained: Which File to Use, Where to Put It, and Fixes
Quinn Saito
Quinn Saito

Posted on Edited on

SDXL VAE Explained: Which File to Use, Where to Put It, and Fixes

Use your checkpoint's included SDXL VAE unless you need a specific replacement. For a standalone download, choose Stability AI's sdxl_vae.safetensors; for half-precision NaN failures, consider madebyollin's fp16-fix.

The official VAE card and fp16-fix card identify those choices. Installation requires both the correct folder and an active selection in your application; downloading the file alone does not establish which VAE a workflow uses.

What the VAE does in SDXL

A variational autoencoder, or VAE, connects images to the compact latent representation used by diffusion. Its encoder turns an input image into latents; its decoder turns latents into a visible image. A1111's VAE explanation

In text-to-image generation, decoding happens after sampling. In image-to-image generation, the VAE also encodes your starting picture. This makes it relevant to both the input and output sides of an editing workflow.

Stability explains that diffusion performs most semantic composition, while autoencoder improvements affect local detail and reconstruction. Evaluate a VAE swap by inspecting the decoded image. SDXL VAE model card

Latent size and latent scaling are different

SDXL-compatible latents have four channels and spatial dimensions one-eighth of the image width and height. A 1024×1024 image therefore corresponds to 128×128 spatial latents. The TAESD author's explanation documents that shape.

Separately, Stability's VAE configuration sets scaling_factor to 0.13025. This scales latent values; it is not an image-size setting or a quality slider.

Let the application's SDXL implementation handle this conversion. If you are comparing custom workflows, record the model family and VAE together so that an incompatible component is easier to spot.

Which SDXL VAE file should you download?

Choice File or packaging When to choose it
Stability AI SDXL VAE sdxl_vae.safetensors You need the official standalone VAE
Madebyollin fp16-fix sdxl.vae.safetensors in the author's A1111 instructions You need the modified VAE for half-precision stability
Checkpoint's included VAE Stored with the checkpoint The model author recommends it and it works

The fp16-fix file list contains similarly named downloads. Follow the author's installation link and keep a note of its repository. The same filename in a different repository does not establish the same weights.

Download the standalone weights appropriate for your GUI. A model repository can also contain library-oriented files; use the model card's explicit application instructions where available.

Baked-in VAEs in community checkpoints

“Baked in” means the checkpoint already contains the VAE weights. For example, the Juggernaut XL v9 model card explicitly says its VAE is included and an external one is unnecessary.

Check the exact checkpoint version you downloaded. Do not generalize from one release to every model in a family, and do not assume that a separate VAE download is an upgrade over the author's intended combination.

Before replacing a working VAE, write down the reason: a decoding failure, a precision constraint, or a controlled visual comparison. That gives the experiment a concrete success criterion.

Where to put and select the VAE

Application Default standalone VAE folder Selection
Automatic1111 stable-diffusion-webui/models/VAE Settings → VAE → SD VAE
ComfyUI ComfyUI/models/vae Load VAE / VAELoader node
Fooocus Fooocus/models/vae Advanced → Developer Debug Mode → Debug Tools → VAE

These are application-relative paths. Use the installation you actually launch, particularly if you keep several copies of the same interface. Folder names and capitalization differ between the applications.

Automatic1111

  1. Copy the standalone file into stable-diffusion-webui/models/VAE.
  2. Open Settings → VAE and refresh SD VAE if necessary.
  3. Select the file explicitly and apply settings.
  4. Generate a comparison image before changing anything else.

The folder is documented in the fp16-fix installation instructions. A1111's VAE selection implementation also resolves command-line overrides, checkpoint metadata, nearby files, and the global selection.

None uses the VAE from the checkpoint. Automatic enables automatic selection, including a matching external file. If a test seems to ignore your choice, check Selected VAE overrides per-model preferences and any launch override.

Avoid treating None as “disable decoding.” It means no separate VAE override in this control. Return to the included VAE when you want a clean checkpoint baseline. A1111 settings reference

ComfyUI: connect the VAE Loader node

Copy the file into ComfyUI/models/vae, refresh the interface, and add Load VAE, the node documented as VAELoader. Select your file in vae_name. Official node documentation

Connect its VAE output to VAE Decode. For an image-to-image workflow, also connect the intended VAE to VAE Encode. Those nodes explicitly consume a VAE input in the ComfyUI implementation.

Follow the wires through the entire workflow. Merely adding a loader does not replace an existing connection from the checkpoint loader. Make sure the final image path actually reaches the decoder you meant to change.

For a controlled comparison, decode the same sampled latent through each candidate VAE. This isolates the decoder comparison more clearly than rerunning generation with different prompts or seeds.

Fooocus: use the advanced VAE control

Fooocus defines models/vae as the default standalone VAE directory. Its configuration reference also exposes path_vae and default_vae for installations with customized paths or defaults.

  1. Put the file into Fooocus/models/vae.
  2. Enable the Advanced checkbox, then open the Advanced tab.
  3. Enable Developer Debug Mode and open Debug Tools.
  4. Select the file in VAE; use Models → Refresh All Files if the list needs refreshing.

Those controls are present in the official Fooocus interface source. Choose Default (model) to return to the model's VAE; that label is defined in the application flags.

Fooocus loads the selected external VAE into the base-model pipeline. Its pipeline implementation also prints the loaded VAE path, which can help confirm a selection during troubleshooting.

Use the Fooocus guide for the surrounding workflow. Keep the VAE comparison separate from changes to styles, refiners, or other advanced controls.

Black images, NaNs, and the fp16-fix

The fp16-fix author explains that the original VAE can produce NaNs when internal activations exceed what half precision handles. The modified weights reduce those activations while aiming to preserve the decoded output. Model card

A black image alone is not a diagnosis. Read the error and identify whether it names the VAE, sampling, or memory allocation before choosing a fix.

For an A1111 VAE precision failure, try the automatic full-precision fallback or --no-half-vae. The latter prevents half-precision VAE processing; it does not switch the entire checkpoint to full precision. Settings; flags

Alternatively, select fp16-fix and rerun the same case. Once it works, evaluate whether your explicit full-precision VAE flag is still needed. Keep a record of the working configuration before removing a workaround.

If the error concerns memory, A1111's --medvram-sdxl targets SDXL memory usage. It addresses a different issue from invalid VAE values. Do not disable NaN checks to make a precision error disappear.

Does swapping the VAE improve image quality?

It can change reconstruction and fine detail. Stability's VAE model card reports reconstruction metrics; those measurements do not establish a universal improvement for every generated image or every community checkpoint.

The fp16-fix author reports slight output differences from the original VAE. Judge it primarily on whether it solves your precision problem, then inspect the actual images you intend to use.

For a useful visual test, keep the checkpoint, prompt, sampler, seed, dimensions, and processing stages unchanged. Save both outputs and name them by the VAE used.

Inspect small textures, edges, smooth color transitions, and any area where you noticed an artifact. Decide in advance whether you value closer reconstruction, reliable decoding, or lower memory use for that workflow.

Keep the included VAE if the replacement offers no useful benefit. A successful comparison can end with retaining the original configuration.

TAESD previews versus final decoding

TAESD is a small autoencoder designed for fast previews and lightweight decoding. SDXL uses the taesdxl_* weights. Its author describes a tradeoff in fine detail compared with the full VAE. TAESD README

In A1111, enable TAESD previews under Settings → Live Previews. Preview selection is separate from choosing TAESD as the final encoder or decoder under Settings → VAE.

For ComfyUI SDXL previews, place taesdxl_decoder.pth in models/vae_approx and launch with --preview-method taesd. The ComfyUI README documents the preview files and flag.

Keep a full VAE connected to the final decoder when that is the output you want. Judge the saved image, since a fast preview is not necessarily the final decoding result.

FAQ

Is an external VAE required for SDXL?

No, when your checkpoint includes a suitable one. Follow the exact model card; Juggernaut XL v9 is a documented example with an included VAE.

Where does sdxl_vae.safetensors go?

Use A1111's models/VAE, ComfyUI's models/vae, or Fooocus's models/vae, relative to the application directory. Then select it in the relevant control or loader.

Will fp16-fix repair every black image?

No. It targets half-precision VAE instability. Confirm that the failure occurs in the VAE before assuming the replacement addresses your problem.

Should TAESD replace my final SDXL VAE?

Use it when its speed and detail tradeoff suits your task. For a full-quality decoding comparison, keep the full VAE for the saved output and use TAESD for previews.

Sources

Top comments (0)