(This post was authored by hlky and Sayak).

When operating with latent-space diffusion models for high-resolution image and video synthesis, the VAE decoder can consume quite a bit more memory. This makes it hard for the owners to run these models on consumer GPUs without going through latency sacrifices and others alike. (Related: IShowSpeed breaks down in tears after finishing GTA 6 i...)

For example, with offloading, there is a device transfer overhead, causing delays in the overall inference latency. Tiling is another solution that lets us operate on so-called β€œtiles” of inputs. However, it can have a negative impact on the quality of the final image.

Therefore, we want to pilot an idea with the community β€” delegating the decoding process to a remote endpoint.

According to recent reports, no data is stored or tracked, and code is open source. We made some changes to huggingface-inference-toolkit and use custom handlers. (Related: Tech Report: Taco Bell adds β€˜Make It Flamin’ Hot’ optio...)

This experimental feature is developed by Diffusers 🧨.

Below, we cover three use cases where we think this remote VAE inference would be beneficial.

First, we have created a helper method for interacting with Remote VAEs.

Install diffusers from main to run the code. pip install git+https://github.com/huggingface/diffusers@main.

Here, we show how to use the remote VAE on random tensors.

Sources indicate that usage for Flux is slightly different. Flux latents are packed so we need to send the height and width.

Finally, an example for HunyuanVideo.

But we want to use the VAE on an actual pipeline to get an actual image, not random noise. The example below reveals how to do it with SD v1.5.

Here’s another example with Flux.

Here’s an example with HunyuanVideo.

Sources indicate that one of the great benefits of using a remote VAE is that we can queue multiple generation requests. While the current latent is being processed for decoding, we can already queue another one. This helps improve concurrency.

According to recent reports, these tables demonstrate the VRAM requirements with different GPUs. Memory usage % determines whether owners of a certain GPU will need to offload. Offload times vary with CPU, RAM and HDD/NVMe. Tiled decoding increases inference time.

If you like the idea and feature, please help us with your feedback on how we can make this better and whether you’d be interested in having this kind of feature more natively integrated into the Hugging Face ecosystem. If this pilot goes well, we blueprint on creating optimized VAE endpoints for more models, including the ones that can generate high-resolution videos!

The article is not so clear about some points:.

I am not sure how this is unclear but in the interest of completeness.

is vae tiling always happening ?

We never mention this to be happening.

what do you mean by tiled memory / tiled time ?

Tiled memory / time mean we are applying tiling..

"time" does mean "inference time" or "offloading time".

Total round-trip time. If it meant anything else, it would have been specified like others.

Do we need Pro account for this?

Hello there.Very nice implementation, works flawlessly, 2-4 seconds to decode, depending on image size.

Simple question, is there a possibility to create a local endpoint on other machine (not HF) and use it as vae-decode machine?

So a Comfy Ui implementation for example.

Comfy implementation: https://github.com/kijai/ComfyUI-HFRemoteVae.

You can host the endpoint on a local machine and use it as is as shown in the blog post if the input and output schemas match.

Alright, I'll give it another read.Thank you.

πŸ“» πŸŽ™οΈ Hey, I generated an AI podcast about this blog post, check it out!

This podcast is generated via ngxson/kokoro-podcast-generator, using DeepSeek-R1 and Kokoro-TTS.

It has been revealed that great work! Just posted a video short to LinkedIn showcasing this. Check it out! https://www.linkedin.com/posts/activity-7301008441123164161-rTau?utm_source=social_share_send&utm_medium=member_desktop_web&rcm=ACoAAAI2QycBC7JU4jV0Vw61G4AWBGaE_MlKUtU.

Can we get also a Wan Video 2.1 VAE for remote Decode?

β†’ Read original article