KVAE 3.0: Image tokenizer
KVAE-2D-3.0 is an image variational autoencoder for latent diffusion. It encodes RGB images into a compact continuous representation with 8× spatial downsampling and 32 latent channels. Semantic feature alignment shapes the latent space for downstream diffusion generation, alongside the reconstruction objective.
The model has 85.6M parameters, approximately 61% fewer than KVAE-2D-2.1. It achieves higher reconstruction PSNR and SSIM than FLUX.2 VAE and a lower generation FD-CLIP after 200K diffusion-transformer training steps.
Model zoo
Compression is shown as H × W for images and T × H × W for videos. For audio, it is the number of waveform samples per latent timestep; both audio models operate at 48 kHz.
Current models
| Model | Modality | Compression | Latent channels |
|---|---|---|---|
| KVAE-Image 3.0 | Image | 8 × 8 | 32 |
| KVAE-Video 3.0 | Video | 4 × 32 × 32 | 128 |
| KVAE-Audio-Stereo | Stereo audio | 960 | 128 |
Previous models
| Model | Modality | Compression | Latent channels |
|---|---|---|---|
| KVAE-Image 2.0 | Image | 8 × 8 | 32 |
| KVAE-Image 1.0 | Image | 8 × 8 | 16 |
Architecture and training
KVAE-2D-3.0 compresses image height and width by a factor of 8 and uses 32 latent channels. Compared with KVAE-2D-2.1, the deepest residual stage is reduced from 1,024 to 512 channels, and self-attention is added to both the encoder and decoder bottlenecks.
During training, an eight-block probe based on SiT-XL/2 predicts features extracted from clean images by a frozen DINOv2 ViT-B/14 encoder. The probe receives noisy VAE latents and is conditioned on the noise level. Its alignment loss jointly trains the probe and the VAE encoder.
The tokenizer and probe are trained jointly for 600,000 steps on 256 × 256 crops from an internal dataset. The encoder is then frozen, and the decoder is refined on random 512 × 512 crops using pixelwise, perceptual, and adversarial losses. This stage refines image reconstruction while preserving the learned latent representation.
Inference
Run from the KVAE source repository root with the KVAE 3.0 code. The reference environment uses Python 3.11, PyTorch 2.8.0, and CUDA 12.8.
pip install -r requirements.txt
import torch
from data import read_image
from kvae import KVAEImage
device = torch.device("cuda:0")
dtype = torch.bfloat16
model = (
KVAEImage.from_pretrained("kandinskylab/KVAE-2D-3.0", strict=True)
.eval()
.to(device=device, dtype=dtype)
)
image = read_image("path/to/image.png").unsqueeze(0)
image = image.to(device=device, dtype=dtype)
with torch.no_grad():
latent = model.encode(image).latent_dist.mode()
reconstruction = model.decode(latent).clip(-1, 1)
read_image loads RGB pixels into [-1, 1]. The model input has shape [B, 3, H, W]; image height and width must be divisible by 8.
Evaluation
Image reconstruction
Reconstruction is evaluated on all 5,000 COCO val2017 images at native scale. Each spatial dimension is center-cropped to a multiple of 32, and the posterior mean is decoded in bfloat16. PSNR, SSIM, and AlexNet LPIPS are averaged over images.
| Tokenizer | Latent channels | Parameters | PSNR (dB) ↑ | SSIM ↑ | LPIPS (AlexNet) ↓ |
|---|---|---|---|---|---|
| FLUX.1-dev | 16 | 83.8M | 29.89 | 0.8662 | 0.0234 |
| FLUX.2-dev | 32 | 84.0M | 31.37 | 0.8924 | 0.0167 |
| KVAE-2D-2.1 | 32 | 218.4M | 32.15 | 0.9057 | 0.0264 |
| KVAE-2D-3.0 | 32 | 85.6M | 32.18 | 0.9070 | 0.0258 |
Generation during diffusion training
To compare the latent spaces for generation, separate 2B-parameter Kandinsky 5 text-to-image diffusion transformers are trained using each tokenizer. All three runs use the same training setup, with 64 GPUs per run. Generation quality is measured by FD-CLIP, the Fréchet distance between generated and reference images in CLIP ViT-L/14 feature space.
Evaluation uses 3,000 English prompts, 256 × 256 images, 50 sampling steps, guidance scale 5, and sampling shift 5. At 100K training steps, FLUX.2 and KVAE-2D-3.0 have similar FD-CLIP scores of 13.63 and 13.66. At 200K steps, KVAE-2D-3.0 has the lowest score among the three tokenizers:
| Tokenizer | FD-CLIP at 100K DiT steps ↓ | FD-CLIP at 200K DiT steps ↓ |
|---|---|---|
| KVAE-2D-3.0 | 13.66 | 12.72 |
| KVAE-2D-2.1 | — | 13.30 |
| FLUX.2 VAE | 13.63 | 13.05 |
Human preferences
The KVAE-2D-3.0 and FLUX.2 generators are compared at 200K DiT training steps using the same prompt and random seed for each image pair. The KVAE-based generator receives tie-adjusted preference shares of 52.5% for prompt following, 50.8% for visual quality, and 50.5% for semantic quality. Visual and semantic preferences are close to parity. Both-good ratings give half credit to each system; both-poor ratings are excluded.
DiffusionBench
In a separate text-to-image experiment, a 0.61B-parameter generator trained on KVAE-2D-3.0 latents is evaluated using exponential moving average (EMA) weights at 100K steps. It achieves the highest GenAI-Bench score (0.726) and the second-highest three-metric mean (0.745) in the reported ranking, behind E2E-Qwen-Image-VAE (0.747).
The table shows three of the 12 tokenizer configurations used for ranking. The separate FLUX.2-VAE + REG configuration is excluded from the ranking.
| Tokenizer | GenEval | DPG-Bench | GenAI-Bench | Mean |
|---|---|---|---|---|
| E2E-Qwen-Image-VAE | 0.691 | 0.835 | 0.714 | 0.747 |
| KVAE-2D-3.0 | 0.673 | 0.837 | 0.726 | 0.745 |
| FLUX.2-VAE | 0.675 | 0.830 | 0.712 | 0.739 |
- Downloads last month
- -


