{"slug": "vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no", "title": "VaeZip: store VAE-encoded latent datasets in 5-10x fewer space with almost no quality loss", "summary": "TensorForger released VaeZip, a PyTorch library that stores VAE-encoded latent tensors in Safetensors files 5-10x smaller than fp32 by quantizing values to 2-8 bits, with pixel MSE of 0.0003 after decoding at roughly 3 bits per value. The codecs were chosen from the LatentStorageBenchmark comparison of about 50 algorithms across 8 image and video VAEs, and a separate VaeZipTrainBench run found the loss curve for pre-training a small T2I flow-matching DiT indistinguishable from the fp32 baseline at 6-bit storage.", "body_md": "[VaeZip](https://github.com/tensorforger/VaeZip) is a PyTorch-based library that implements several latent quantization codecs and stores the compressed tensors in common Safetensors files that are much smaller then if you store these tensors in fp32.\n\nThe main use cases of this are\n\nThe codecs are designed specifically for VAE latents: some of them exploit both spatial redundancy and that the VAE latent distribution is usually normal. That allows to store latent tensor with about 3 bits/value precision (10x smaller files) while keeping pixel MSE at 0.0003 after decoding.\n\nFor example, one of the best codecs uses a combination of global range scaling, local range scaling with square spatial blocks and so called “Lloyd-Max table” which is essentially codebook that is tuned for the sample distribution. After that it quantizes values to 2-8 bits and packs them.\n\nThe codecs were selected from the [benchmark](https://github.com/tensorforger/LatentStorageBenchmark) that compared ~50 algorithms on 8 image and video VAEs by the reconstruction quality, fidelity, space usage and I/O latency.\n\nI have also [measured](https://github.com/tensorforger/VaeZipTrainBench) the impact on pre-training a small T2I flow matching DiT with latents compressed with different codecs. In one run the loss curve is indistinguishable from the fp32 baseline with just 6 bit storage.", "url": "https://wpnews.pro/news/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no", "canonical_source": "https://discuss.huggingface.co/t/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no-quality-loss/190688#post_1", "published_at": "2026-10-16 22:20:44+00:00", "updated_at": "2026-10-16 22:27:52.839074+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "developer-tools", "ai-infrastructure"], "entities": ["VaeZip", "TensorForger", "PyTorch", "Safetensors", "LatentStorageBenchmark", "VaeZipTrainBench", "Lloyd-Max"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no", "markdown": "https://wpnews.pro/news/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no.md", "text": "https://wpnews.pro/news/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no.txt", "jsonld": "https://wpnews.pro/news/vaezip-store-vae-encoded-latent-datasets-in-5-10x-fewer-space-with-almost-no.jsonld"}}