# Tiny AutoEncoder Previews

import { Steps, Aside } from '@astrojs/starlight/components'

While a model denoises, InvokeAI shows a preview of the image after each step. By default the preview is a linear
projection of the latents: one pixel per latent, upscaled, so it is blurry and its colours are approximate. A
**Tiny AutoEncoder** (TAE) is a small decoder by [madebyollin](https://github.com/madebyollin/taesd) (MIT license)
that turns the same latents into a preview close to the final image, in a few tens of milliseconds on an RTX 4090. It is meant for
a GPU; decoding on the CPU is possible but slower (see [Running the decoder on the CPU](#running-the-decoder-on-the-cpu)).

TAE previews change only what you see while a generation runs. The finished image is decoded by the model's VAE as
always and is identical with the setting on or off.

## Enabling TAE previews

<Steps>
1. Set the option in `invokeai.yaml`, then restart InvokeAI:

   ```yaml
   tiny_autoencoder_previews: true
   ```

   It is a server setting and is off by default. See [All Settings](/configuration/invokeai-yaml/#all-settings).

2. In **Model Manager → Starter Models**, install the Tiny AutoEncoder for the families you generate with
   (search for *preview decoder*). Each one is 5 to 31 MB. Filtering by your model's family also shows its
   decoder, even when the decoder is filed under another family, and a selected bundle names its missing decoder
   in its summary line.
</Steps>

| Starter model | Previews for |
|---|---|
| TAESD (SD 1.x/2.x preview decoder) | SD 1.x, SD 2.x |
| TAESDXL (SDXL preview decoder) | SDXL, SDXL Refiner |
| TAESD3 (SD3 preview decoder) | SD 3 |
| TAEF1 (FLUX.1 preview decoder) | FLUX.1, Z-Image |
| TAEF2 (FLUX.2 preview decoder) | FLUX.2, FLUX.3, ERNIE-Image, Ideogram 4, MOSS-Image |
| TAEQI2.1 (Qwen-Image-2.1 preview decoder) | Qwen-Image-2.1 |
| TAEW2.1 (Wan 2.1 VAE preview decoder) | Wan 2.2 T2V and I2V A14B, Qwen-Image, Qwen-Image Edit, Krea-2, Anima |
| TAEW2.2 (Wan 2.2 TI2V-5B preview decoder) | Wan 2.2 TI2V-5B |
| TAELTX2.3 (LTX-2.5 preview decoder) | LTX-2.5 |

A TAE serves every family that denoises in its latent space, so you need only one per row. To install a TAE file
you already have, see [Preview decoders](/users-guide/models/model-format-support/#preview-decoders-tiny-autoencoders)
for the files InvokeAI accepts.

FLUX.1, FLUX.2, FLUX.3, ERNIE-Image, MOSS-Image, Anima and LTX-2.5 preview the image the model predicts, so the
preview is clean from the first step. Z-Image, SD 3, Qwen-Image-2.1, Qwen-Image, Krea-2, Wan 2.2 and Ideogram 4
preview the current noisy latent: early previews show sharp noise, which clears as denoising proceeds. SD 1.x/2.x and
SDXL depend on the scheduler: DDIM, DDPM, Euler, Euler a, Heun, LMS, KDPM2, KDPM2 a and DPM++ SDE report their
prediction and preview cleanly; DPM++ 2M, 2M SDE, 3M and 2S, UniPC, DEIS, PNDM, LCM, TCD and ER-SDE preview the noisy
latent.

A video preview shows the middle frame of the clip. For Wan 2.2 the TAE decodes it together with the frame before
it, which it needs as context for a sharp result; LTX-2.5 decodes the middle frame alone.

CogView4 keeps the linear preview. MiniMax H3 always previews with its own built-in decoder, whatever
this setting says.

## Cost and fallback

Only the preview frames that are actually sent to the UI are decoded, between two denoising steps. Previews are
capped on their long edge: at 512 pixels for TAEW2.1, whose decode would need about 2 GB of VRAM at 1024×1024, and
at 1024 pixels for every other TAE. Larger generations are previewed at reduced resolution and shown at full size.

Measured on an RTX 4090 in fp16, decoding one latent at the cap:

| TAE | Cap | Time per preview | VRAM while it decodes |
|---|---|---|---|
| TAESD, TAESDXL, TAESD3, TAEF1, TAEF2 | 1024 pixels | about 25 ms | about 0.65 GB |
| TAEQI2.1 | 1024 pixels | about 25 ms | about 0.16 GB |
| TAEW2.1 | 512 pixels | about 10–20 ms | about 0.54 GB |
| TAEW2.2 | 1024 pixels | about 24 ms | about 0.54 GB |
| TAELTX2.3 | 1024 pixels | about 29 ms | about 0.27 GB |

A Wan 2.2 video preview, which decodes two latent frames, takes under about 32 ms. InvokeAI reserves up to 617 MiB
of VRAM for it from 832×480 to 1280×720 and 1093 MiB at 1024×1024; on an RTX 4090 it used up to 599 and 1064 MiB. On a CPU a preview takes
from about 0.3 to 1.1 seconds for one frame (see [Running the decoder on the CPU](#running-the-decoder-on-the-cpu)).

InvokeAI spaces TAE preview frames so that previews cost at most about a tenth of the denoising time. On fast models
the preview therefore updates a few times per second rather than after every step. In practice the cost is lower: on
an RTX 4090, denoising a 1024×1024 SDXL image in 30 steps took about 4.44 s with TAE previews against 4.18 s
without, roughly 6% more.

InvokeAI falls back to the linear preview by itself, and the generation always continues:

- **No matching TAE installed:** linear previews. The server log says once which starter model to install, and
  under which family the starter list shows it.
- **The TAE does not fit in VRAM** next to the running model: linear previews for that generation, noted once in
  the server log (`Tiny AutoEncoder '...' does not fit in VRAM next to the running model`). This is the case whenever
  the main model is only partially loaded into VRAM, as on low-VRAM cards. To get TAE previews there anyway, run the
  decoder on the CPU.
- **Loading or decoding the TAE fails:** a warning with the error in the server log, once per kind of failure,
  then linear previews for the rest of that generation.

## Running the decoder on the CPU

The switch only matters while `tiny_autoencoder_previews` is on. If the log line above appears, or your GPU is busy
enough that you would rather keep its memory for the model, open the TAE in **Model Manager** and switch on
**Decode previews on CPU**. The setting is saved at once. The decoder then lives in system RAM, never needs VRAM, and
decodes in float32 on the CPU, so it also works while the generation model fills the GPU. The change applies from the
next generation.

Decoding on a CPU costs more time, so InvokeAI limits the work:

- The preview is decoded at no more than 512 pixels on its long edge, whatever the TAE's usual cap, and shown at full
  size.
- Measured on a Ryzen 9 7900 (8 threads, float32): TAESDXL and TAEF2 take about 0.3 to 0.4 s per frame at 512 pixels
  (1.7 s at 1024 pixels, which is why the cap exists). TAEW2.1 takes about 0.8 to 1.1 s for a single frame (Anima,
  Qwen-Image, Krea-2); a Wan two-frame window takes about 1.9 s at 1024×1024 and about 1.0 s at 832×480. TAEW2.2 and
  TAELTX2.3 were not measured on a CPU. Slower CPUs take longer.
- Frames are still spaced by their measured cost, so with a CPU decoder previews update less often: a frame costing
  0.4 s is followed by roughly 8 s without a new one. The last (100%) frame is always decoded, whatever the spacing.
  Each frame is decoded between two denoise steps, so the GPU waits for it: on an RTX 4090 with the model only partly
  in VRAM (1024×1024, 30 steps), a CPU decoder added about 7% (SDXL, a frame every 5 s) and 9% (Anima, a frame every
  12 s) to the denoise compared with linear previews.
- With several GPUs, a CPU decode competes with the other generation threads' CPU work.
- A CPU decode needs transient RAM that the model cache does not count: about 0.3 GB for TAESDXL at 512 pixels and
  about 1.2 GB for a TAEW2.1 two-frame window. If PyTorch reports that the allocation failed, previews fall back to
  linear for the rest of that generation; on a Linux host that overcommits memory, the system's out-of-memory killer
  may end the process instead.

CPU-only installs decode on the CPU in any case and are subject to the same 512-pixel cap.

<Aside type="note">
If more than one installed TAE fits a family, InvokeAI uses the one that is alphabetically first by name.
</Aside>