{"slug": "what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent", "title": "What Disappears When You Shrink an Image to 64×64: Stable Diffusion's Latent Space", "summary": "A round-trip test through the VAEs of Stable Diffusion 1.x/2.x, SDXL, FLUX.1 and FLUX.2 found that SD's 4-channel latent space corrupts small text: a 12 px \"Invoice 4729 due 03/18\" line came back reading 03/28 after encoding and decoding with no prompt or denoising, and 2 px stripes turned gray. FLUX.1's 16 channels preserved the 12 px text, while FLUX.2 keeps 32 channels on the same 64×64 grid for a 512×512 image. The author measured the SD 1.x/2.x VAE (stabilityai/sd-vae-ft-mse) on one A100 in fp32 at a median 28.46 ms to encode and 53.06 ms to decode, and counted 0.8 TFLOPs per denoising step on the 64×64 latent versus 545 TFLOPs at 512×512 for the 866M-parameter SD 2.x UNet.", "body_md": "# What Disappears When You Shrink an Image to 64×64: Stable Diffusion's Latent Space\n\nWe passed text, stripes and photos through the VAEs of SD 1.x/2.x, SDXL, FLUX.1 and FLUX.2 and back. With 4 latent channels, 12 px text came back with changed digits (03/18 became 03/28) and 2 px stripes turned gray. FLUX.1's 16 channels kept 12 px text. Code and per-size results included.\n\nWe drew the line \"Invoice 4729 due 03/18\" at a 12 px font on a white 512×512 page, sent it through Stable Diffusion's VAE and back, and nothing else. No prompt, no denoising. The line that came back still looked like clean type, but the date now read **03/28**. The \"1\" had been redrawn as a \"2\".\n\nEvery Stable Diffusion image comes out through this decoder, and every training image went in through its encoder. This post measures what it drops: how small text can get before it breaks, which patterns turn gray, and how much a photo loses. We tested four VAEs, from the 4-channel one in SD 1.x/2.x to the 32-channel one in FLUX.2.\n\n### Where the 64×64 comes from[#](#where-the-6464-comes-from)\n\nA diffusion model makes an image by starting from noise and removing a little of it at each step. Stable Diffusion does not do this on pixels. A separate network called a VAE first converts the image into a smaller grid of numbers, the **latent**, and the denoising happens there. When denoising is done, the VAE's decoder paints pixels back from the latent. Training works the same way: the model only ever sees latents.\n\nFor a 512×512 image, Stable Diffusion's latent is 64×64 with 4 numbers (channels) per position. Each position stands in for an 8×8 patch of pixels. That patch holds 8×8×3 = 192 pixel values, and the latent keeps 4.\n\nThe reason for the squeeze is cost. We counted the operations in one denoising step of the SD 2.x UNet (the network that removes noise, 866M parameters): 0.8 TFLOPs on the 64×64 latent, 545 TFLOPs when the same network takes a 512×512 input. That is about 680 times more work per step. Models that really run on pixels are built differently, so this compares one network at two sizes, not two products. Our earlier post on [latent diffusion](https://sotaaz.com/post/latent-diffusion-models-en) covers how this idea let models reach higher resolutions.\n\nThe price of that saving is whatever does not fit into 4 numbers per 8×8 patch. Newer models pay less of it: FLUX.1 keeps 16 channels per position and FLUX.2 keeps 32, still on a 64×64 grid for a 512×512 image.\n\nMoving in and out of the latent space takes a VAE pass. We ran the SD 1.x/2.x VAE (`stabilityai/sd-vae-ft-mse`) on one 512×512 image 30 times each on one A100 in fp32. The median was 28.46 ms to encode and 53.06 ms to decode, excluding model loading and file I/O. Text-to-image generation skips the encoder: it denoises in the latent space for many steps and decodes once at the end, so the VAE adds one decode per image.\n\n### The test: encode, decode, compare[#](#the-test-encode-decode-compare)\n\nWe used only the VAE. Each test image went through the encoder, we took the latent's mean (so there is no randomness and no seed), and the decoder turned it back into pixels. The diffusion model is trained only on latents this encoder produced, and everything it draws comes out through this decoder. What the round trip cannot carry, a better denoiser has no way to put back.\n\nWe ran four VAEs in fp32 on one A100:\n\n| VAE | Used by | Latent for 512×512 | \n|---|---|---|\n| `stabilityai/sd-vae-ft-mse` | SD 2.x; common drop-in replacement for SD 1.x | 4×64×64 | \n| `stabilityai/sdxl-vae` | SDXL | 4×64×64 | \n| FLUX.1-schnell VAE | FLUX.1 | 16×64×64 | \n| FLUX.2-dev VAE | FLUX.2 | 32×64×64 | \n\nThe VAE shipped with SD 2.x (we loaded it from SD-Turbo) has weights identical to ft-mse and gave identical numbers, so the tables show them as one row labeled SD 1.x/2.x.\n\nThere were three kinds of test image:\n\n- **Text.** Five lines full of digits (an invoice number and date, a room and time, a dollar amount, an order code, a phone number), each drawn at font sizes from 6 to 24 px. Each line starts at a slightly different position so that letters land on different spots of the 8-pixel grid.\n- **Stripes.** Black and white vertical stripes repeating every 2, 3, 4, 6, 8, 12, 16 and 32 pixels, drawn twice: once lined up with the 8-pixel grid and once shifted by 3 pixels.\n- **Photos.** Three public-domain sample photos from scikit-image (a coffee cup, a cat, a rocket), cropped and resized to 512×512.\n\nFor text, the grader is a machine reader, tesseract OCR 4.1.1, on a 4× enlargement of each line. A line counts as kept only if OCR reads the decoded line exactly as written. We only count lines that OCR also reads exactly on the original image. At 6 px OCR could not read any original line, and at 8 px it read three of five, so the chart starts at 8 px with three lines.\n\n### Text: 4 channels need 16 to 20 px[#](#text-4-channels-need-16-to-20-px)\n\n| Lines read exactly | 8 px (of 3) | 10 px | 12 px | 14 px | 16 px | 20 px | 24 px | \n|---|---|---|---|---|---|---|---|\n| SD 1.x/2.x (4 ch) | 0 | 0/5 | 0/5 | 1/5 | 4/5 | 5/5 | 4/5 | \n| SDXL (4 ch) | 0 | 0/5 | 0/5 | 2/5 | 5/5 | 5/5 | 5/5 | \n| FLUX.1 (16 ch) | 0 | 4/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | \n| FLUX.2 (32 ch) | 1 | 2/5 | 4/5 | 4/5 | 5/5 | 5/5 | 5/5 | \n\nBoth 4-channel VAEs dropped to zero at 12 px. That is not OCR being picky. We looked at all five 12 px lines from the SD 1.x/2.x VAE, and in every one of them at least one digit looks different to the eye: 03/18 became 03/28, $3,862.10 became $3,863.10, 846 became 346, room 615 became 015. At a glance the line still looks like clean type, which makes the changes easy to miss.\n\nOur reading of the threshold is about how many latent numbers each digit gets. In the font we used, a digit is 7.6 px wide at 12 px, about one 8-pixel patch, so roughly one column of positions, 4 numbers each, carries it. At 16 px a digit is 10.2 px wide and spreads over more positions. FLUX.1 uses the same 8×8 grid with 16 numbers per position and read every 12 px line, which fits this reading.\n\nFLUX.1's 16 channels moved the line down to 12 px, where OCR read all five lines exactly. FLUX.2's misses at 12 and 14 px look different from SD's. When we enlarged those lines (a comma read as a period, a 5 read as an S), the decoded text looked the same as the original to us; the strokes changed just enough to flip the OCR. The same holds for the one SD 1.x/2.x miss at 24 px, where OCR read \"4729\" as \"4/29\". Its miss at 16 px is real, though: the 3 in \"KX-5093\" came back bent toward an S.\n\n### Stripes: some turn gray, some turn pink[#](#stripes-some-turn-gray-some-turn-pink)\n\nText has letters the decoder has seen many times. Stripes test pure detail: fine repeats with nothing to guess from.\n\nWe measured how strong the stripes still are. For each band we averaged the columns and took the strength of the pattern at the stripes' own repeat length, so texture the decoder invents in some other shape does not count. 1.00 means the stripes came back as strong as they went in, 0 means they are gone. Values are for the grid-aligned version, with the 3 px-shifted version in parentheses.\n\n| Stripes kept | 2 px | 4 px | 8 px | 16 px | \n|---|---|---|---|---|\n| SD 1.x/2.x | 0.00 (0.00) | 0.46 (0.20) | 0.48 (0.75) | 0.95 (0.96) | \n| SDXL | 0.01 (0.03) | 0.48 (0.50) | 0.79 (0.87) | 0.98 (0.97) | \n| FLUX.1 | 0.65 (0.38) | 0.85 (0.88) | 0.94 (0.96) | 0.99 (0.99) | \n| FLUX.2 | 0.01 (0.03) | 0.24 (0.32) | 0.21 (0.18) | 0.96 (0.96) | \n\nStripes one pixel wide are gone for both 4-channel VAEs. The SD 1.x/2.x band looks like a gray wall. The SDXL band is not flat, but what it shows is a checker texture, not the stripes, so it scores 0.01. FLUX.1 keeps 0.65 of them, or 0.38 when shifted.\n\nThe VAEs also invented color. The input is pure black and white, so any difference between the red, green and blue channels in the output is made up. We averaged that difference per pixel on a 0 to 255 scale. For SD 1.x/2.x it was 24.0 on the 8 px stripes lined up with the grid, the pink fringes in the figure. Its next highest value was 11.7, so the tint was strongest there, and shifting those stripes by 3 px dropped it to 2.2. The others did it too in places: SDXL tinted the aligned 8 px stripes dark blue (12.0), and FLUX.1 tinted the 2 px stripes pale violet (15.7, 13.7 when shifted).\n\nFLUX.2 broke the pattern we expected from channel count. It has the most channels and read text nearly as well as FLUX.1, yet it kept 1 to 3% of the 2 px stripes, 24 to 32% of the 4 px stripes and 18 to 21% of the 8 px stripes, at both positions. FLUX.1, with half as many channels, kept 38 to 65%, 85 to 88% and 94 to 96%. More channels did not mean more of every kind of detail.\n\n### Photos: less loss, still not lossless[#](#photos-less-loss-still-not-lossless)\n\nPSNR measures how close the decoded photo is to the original; higher is closer, and each 10 dB is a tenfold drop in squared error.\n\n| PSNR (dB) | Coffee | Cat | Rocket | \n|---|---|---|---|\n| SD 1.x/2.x | 30.9 | 31.7 | 31.4 | \n| SDXL | 31.5 | 32.6 | 32.2 | \n| FLUX.1 | 36.5 | 40.0 | 35.9 | \n| FLUX.2 | 38.1 | 41.5 | 37.4 | \n\nEven in the zoomed corner, the four versions are hard to tell apart by eye. The gap between the SD 1.x/2.x and FLUX rows, 4.5 to 9.8 dB, is large in the numbers, but in a photo it shows up as slightly softer wood grain, not as changed content. Text and stripes are where the same loss becomes visible.\n\n### What to do with this[#](#what-to-do-with-this)\n\nIf you generate images with SD 1.x or SD 2.x, treat 20 px text on a 512×512 image as the smallest that came back intact in our test, and 16 px for SDXL. A better diffusion model does not lift this, because it only learns latents this encoder produced and its output decodes the same way. In our reading, below that size each digit gets too few latent numbers, and the decoder fills in a plausible digit that may not be the right one. For labels, prices and dates, render the image with space left for the text and add the text afterward, or move to a VAE with more channels; in our test FLUX.1 held text down to 12 px.\n\nBefore blaming a prompt for mush in fine fabric, screens or fences, run the image you want through the VAE alone. The script below does that. If the round trip already loses the pattern, no prompt will bring it back.\n\n``` python\nimport numpy as np, torch\nfrom PIL import Image\nfrom diffusers import AutoencoderKL\n\nvae = AutoencoderKL.from_pretrained(\"stabilityai/sd-vae-ft-mse\").to(\"cuda\").eval()\n\n@torch.no_grad()\ndef roundtrip(img):  # img: 512x512 RGB PIL image\n    x = torch.from_numpy(np.asarray(img, dtype=np.float32) / 127.5 - 1).permute(2, 0, 1)[None].to(\"cuda\")\n    z = vae.encode(x).latent_dist.mean        # 4 x 64 x 64\n    y = vae.decode(z).sample.clamp(-1, 1)\n    return Image.fromarray(((y[0].permute(1, 2, 0).cpu().numpy() + 1) * 127.5).round().astype(np.uint8))\n\nroundtrip(Image.open(\"mine.png\").convert(\"RGB\").resize((512, 512))).save(\"mine-roundtrip.png\")\n```\n\nFor SDXL, swap in `stabilityai/sdxl-vae`; for FLUX.1, `AutoencoderKL.from_pretrained(\"black-forest-labs/FLUX.1-schnell\", subfolder=\"vae\")`.\n\nSetup: one NVIDIA A100 80GB, fp32, PyTorch 2.7.1, diffusers 0.37.1, tesseract 4.1.1, DejaVu Sans font. The latent is the encoder's mean, so results do not depend on a seed. VAE timings are medians of 30 runs after 5 warmups on PyTorch 2.7.0 and diffusers 0.35.2.", "url": "https://wpnews.pro/news/what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent", "canonical_source": "https://sotaaz.com/post/sd-latent-64-en", "published_at": "2026-11-23 09:05:49+00:00", "updated_at": "2026-11-29 19:16:20.905588+00:00", "lang": "en", "topics": ["generative-ai", "ai-research", "machine-learning", "computer-vision"], "entities": ["Stable Diffusion", "SDXL", "FLUX.1", "FLUX.2", "stabilityai/sd-vae-ft-mse", "stabilityai/sdxl-vae", "A100", "SD 2.x UNet"], "also_reported_by": [], "takeaway": "Stable Diffusion's 4-channel latent cannot carry 12 px text — \"03/18\" decoded as \"03/28\" — while FLUX.1's 16 channels preserved it, so route small-text images through higher-channel VAEs.", "recommendation": {"advice": "When images contain small text, use a VAE with more latent channels (FLUX.1's 16 preserved 12 px text where SD's 4 channels corrupted it), and budget the VAE decode at roughly 53 ms per 512×512 image on an A100.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent", "markdown": "https://wpnews.pro/news/what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent.md", "text": "https://wpnews.pro/news/what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent.txt", "jsonld": "https://wpnews.pro/news/what-disappears-when-you-shrink-an-image-to-64x64-stable-diffusion-s-latent.jsonld"}}