task_categories:
- unconditional-image-generation
tags:
- vae
- diffusion-models
- imagenet
- image-generation
REPA-E: Generated Samples and Artifacts
This repository hosts the generated image samples and artifacts associated with the paper REPA-E: Unlocking VAE for End-to-End Tuning with Latent Diffusion Transformers. These samples are instrumental for quantitative evaluation of the REPA-E method, which enables end-to-end tuning of latent diffusion models and VAEs, achieving state-of-the-art image generation performance.
- π Project Page
- π Paper
- π» Code Repository
Overview
We address a fundamental question: Can latent diffusion models and their VAE tokenizer be trained end-to-end? While training both components jointly with standard diffusion loss is observed to be ineffective β often degrading final performance β we show that this limitation can be overcome using a simple representation-alignment (REPA) loss. Our proposed method, REPA-E, enables stable and effective joint training of both the VAE and the diffusion model.
REPA-E significantly accelerates training β achieving over 17Γ speedup compared to REPA and 45Γ over the vanilla training recipe. Interestingly, end-to-end tuning also improves the VAE itself: the resulting E2E-VAE provides better latent structure and serves as a drop-in replacement for existing VAEs (e.g., SD-VAE), improving convergence and generation quality across diverse LDM architectures. Our method achieves state-of-the-art FID scores on ImageNet 256Γ256: 1.12 with CFG and 1.69 without CFG. The generated .npz files for these evaluations can be found within this repository (e.g., under labelsampling-equal-run1).
Sample Usage
This section shows how to load and use the REPA-E fine-tuned VAE (E2E-VAE) in latent diffusion training, demonstrating how E2E-VAE acts as a drop-in replacement for the original VAE, enabling significantly accelerated generation performance.
β‘οΈ Quickstart
from diffusers import AutoencoderKL
# Load end-to-end tuned VAE (ImageNet VAE example)
vae = AutoencoderKL.from_pretrained("REPA-E/e2e-vavae-hf").to("cuda")
# Or load a text-to-image VAE
vae = AutoencoderKL.from_pretrained("REPA-E/e2e-flux-vae").to("cuda")
# Use in your pipeline with vae.encode(...) / vae.decode(...)
π§© Complete Example
Full workflow for encoding and decoding images:
from io import BytesIO
import requests
from diffusers import AutoencoderKLQwenImage
import numpy as np
import torch
from PIL import Image
response = requests.get("https://raw.githubusercontent.com/End2End-Diffusion/fuse-dit/main/assets/example.png")
device = "cuda"
image = torch.from_numpy(
np.array(
Image.open(BytesIO(response.content))
)
).permute(2, 0, 1).unsqueeze(0).to(torch.float32) / 127.5 - 1
image = image.to(device)
vae = AutoencoderKLQwenImage.from_pretrained("REPA-E/e2e-qwenimage-vae").to(device)
# Add frame dimension (required for QwenImage VAE)
image_ = image.unsqueeze(2)
with torch.no_grad():
latents = vae.encode(image_).latent_dist.sample()
reconstructed = vae.decode(latents).sample
# Remove frame dimension
latents = latents.squeeze(2)
reconstructed = reconstructed.squeeze(2)
Quantitative Results
Tables below report generation performance using gFID on 50k samples, with and without classifier-free guidance (CFG). We compare models trained end-to-end with REPA-E and models using a frozen REPA-E fine-tuned VAE (E2E-VAE). Lower is better. All linked checkpoints below are hosted on our π€ Hugging Face Hub. To reproduce these results, download the respective checkpoints to the pretrained folder and run the evaluation script as detailed in the GitHub repository.
A. End-to-End Training (REPA-E)
| Tokenizer | Generation Model | Epochs | gFID-50k β | gFID-50k (CFG) β |
|---|---|---|---|---|
| SD-VAE* | SiT-XL/2 | 80 | 4.07 | 1.67a |
| IN-VAE* | SiT-XL/1 | 80 | 4.09 | 1.61b |
| VA-VAE* | SiT-XL/1 | 80 | 4.05 | 1.73c |
* The "Tokenizer" column refers to the initial VAE used for joint REPA-E training. The final (jointly optimized) VAE is bundled within the generation model checkpoint.
B. Traditional Latent Diffusion Model Training (Frozen VAE)
| Tokenizer | Generation Model | Method | Epochs | gFID-50k β | gFID-50k (CFG) β |
|---|---|---|---|---|---|
| SD-VAE | SiT-XL/2 | SiT | 1400 | 8.30 | 2.06 |
| SD-VAE | SiT-XL/2 | REPA | 800 | 5.84 | 1.28 |
| VA-VAE | LightningDiT-XL/1 | LightningDiT | 800 | 2.05 | 1.25 |
| E2E-VAVAE (Ours) | SiT-XL/1 | REPA | 800 | 1.69 | 1.12β |
In this setup, the VAE is kept frozen and only the generator is trained. Models using our E2E-VAE (fine-tuned via REPA-E) consistently outperform baselines such as SD-VAE and VA-VAE, achieving state-of-the-art performance when incorporating the REPA alignment objective.
Note: The results for the last three rows (REPA, LightningDiT, and E2E-VAE) are obtained using the class-balanced sampling protocol (50 images per class).
Citation
If you find our work useful, please consider citing:
@article{leng2025repae,
title={REPA-E: Unlocking VAE for End-to-End Tuning with Latent Diffusion Transformers},
author={Xingjian Leng and Jaskirat Singh and Yunzhong Hou and Zhenchang Xing and Saining Xie and Liang Zheng},
year={2025},
journal={arXiv preprint arXiv:2504.10483},
}