Technical Article

P-Flux-2-Klein-4B-DWD & P-Q-Image-2.1-DWD: Image Generation Without a VAE Decoder

Every latent diffusion model ends the same way: the transformer finishes denoising, and a VAE decoder turns the latent into pixels. That last step is easy to forget, but it costs time and, at high resolution, a lot of memory. Today, we open-source two models that skip it: P-Flux-2-Klein-4B-DWD and P-Q-Image-2.1-DWD. They write the image's pixels directly from the transformer at the last sampling step, so the VAE decoder never runs. Time to read!

The Hidden Cost of the Last Step

When we optimize image models, we usually look at the transformer: fewer steps, caching, quantization, compilation. But once the transformer is fast, the parts around it start to matter. The VAE decode is one of them.

  • Time. On one B200, the VAE decode of FLUX.2 [klein] 4B takes 81 ms at 1 MP, out of a 316 ms generation. That's about a quarter of the end-to-end time for a 4-step model.

  • Memory. For Qwen-Image-2.1-Turbo at 2048 × 2048, the run with the VAE decode peaks at 28.19 GB of activation memory. Without it, the peak is 2.71 GB.

The faster the denoiser gets, the bigger the share of the decode. So how can be removed it?

What Is DWD?

DWD stands for Decoding Without a Decoder: Direct Pixel Prediction from Diffusion Transformers (Chen et al., 2026). The idea is simple: at the last sampling step, the transformer predicts pixels instead of a latent.

Our two models are replications of DWD. Both follow the same recipe:

  1. Keep almost everything. The text encoder, the early transformer blocks and the sampling schedule are the base model's.

  2. Fine-tune a "tail". A copy of the transformer's last 4 blocks, with its own time embedding, modulation and output norm, is fine-tuned for the last step.

  3. Add a small pixel head. A single linear layer turns each image token into a 16 × 16 pixel tile in normalized Oklab color space, which is then converted to sRGB.

At the last step, the head output is the image: no final Euler update, no VAE decode. The head and color conversion take about 0.5 ms on FLUX.2 [klein] 4B, against 81 ms for the VAE decode.

What Do You Get Without the VAE?


P-Flux-2-Klein-4B-DWD

P-Q-Image-2.1-DWD

Base model

FLUX.2 [klein] 4B

Qwen-Image-2.1-Turbo

Tasks

Text-to-image

Text-to-image and image editing

Steps

4, no CFG

8, no CFG

Extra weights

0.55B parameters, 1.1 GB (bf16)

0.98B parameters, 1.95 GB (bf16)

Speedup

Up to 1.35x

Up to 1.16x

Memory

~2 GB lower peak at 1 MP

~24 GB lower peak at 2K

License

Apache 2.0

Qwen Research License

P-Flux-2-Klein-4B-DWD: The Speed One

FLUX.2 [klein] 4B is already a fast open image model: 4 steps, no CFG. That's exactly why the VAE decode matters here, because it's a large part of what's left.

Mode

Resolution

With VAE decode

DWD

Speedup

eager

1024 × 1024

316 ms

234 ms

1.35x

torch.compile

1024 × 1024

186 ms

155 ms

1.20x

One NVIDIA B200, bf16, batch size 1, 4 steps, end-to-end (text encoder, 4 steps and decode, until the image is on the host).

With torch.compile, a 1 MP image now takes 155 ms. The tail replaces the last 4 of the 20 single-stream blocks; the text encoder, the 5 double-stream blocks, and the first 16 single-stream blocks are bit-identical to the base model.

P-Q-Image-2.1-DWD: The Memory One

On Qwen-Image-2.1-Turbo, the VAE decode is very memory-hungry at high resolution, and that's where DWD shines.

Mode

Resolution

Peak activation memory with VAE

DWD

eager

1024 × 1024

7.06 GB

0.69 GB

eager

2048 × 2048

28.19 GB

2.71 GB

torch.compile

1024 × 1024

9.21 GB

2.53 GB

torch.compile

2048 × 2048

36.78 GB

10.09 GB

The peak at 2048 × 2048 (eager) is about 24 GB lower. Generation is also 1.09x to 1.16x faster end-to-end, depending on resolution and compilation.

Steps 1 to 7 run on the stock model, unchanged. Only the last step goes through the fine-tuned tail and the pixel head. It also supports image editing with one or more condition images: the VAE encoder is still used to read the input images, but the decoder never runs.

What About Quality?

We compared each DWD image with the stock VAE image for the same prompt and seed.

  • P-Q-Image-2.1-DWD stays very close. Across 64 cases per set, PSNR is 34.8 to 36.5 dB and LPIPS (VGG) is about 0.05, for both text-to-image and editing, at 1 MP and 2K. Color and tone match; the head is slightly softer in the finest textures.

  • P-Flux-2-Klein-4B-DWD is close, not identical (25.5 dB PSNR, 0.137 LPIPS against the stock image). It was trained on real photos rather than on the stock model's outputs, so it isn't trying to copy the VAE pixel by pixel. On held-out real photos, its last step recovers the photo more closely than the base model plus VAE (22.2 dB vs 20.9 dB).

The trade-off is the same for both: dense, fine texture (fur, stone, foliage) is where the head differs most from the VAE. Check the side-by-side examples and 1:1 crops on the model cards to judge for yourself.

Same prompt and seed. Top: FLUX.2 [klein] 4B with its VAE decode. Bottom: P-Flux-2-Klein-4B-DWD, no VAE.

Same prompt and seed. Top: Qwen-Image-2.1-Turbo with its VAE decode. Bottom: P-Q-Image-2.1-DWD, no VAE. Right: an edit ("Add a small red hot-air balloon").

Limitations

Neither model is standalone: each needs its base model's text encoder and transformer, and runs with its own pipeline. All sampling steps still run, so the saving comes from skipping the VAE decode (and, for Qwen, the last Euler step), not from a faster transformer. Both were trained at about 1 MP with a fixed step count (4 for Klein, 8 for Qwen Turbo), so other sizes run but aren't evaluated. P-Flux-2-Klein-4B-DWD is text-to-image only, while P-Q-Image-2.1-DWD also supports editing. LoRAs are untested, and those that touch the last 4 blocks won't carry over. Finally, the output is RGB only, with no alpha channel.

How to use it

Both models are available in ComfyUI and as a Python pipeline built on Diffusers. Both need a CUDA GPU.

P-Flux-2-Klein-4B-DWD

ComfyUI. P-Flux-2-Klein-4B-DWD-Comfy has the same weights in ComfyUI format, a custom node and a ready-to-use workflow. It needs ComfyUI 0.46 or newer, and you don't need to download a VAE file. ComfyUI uses its own kernels and text encoder, so its images are close to the Python pipeline's but not identical.

Diffusers. Clone the repo and run the pipeline.

from dwd_klein.pipeline import DWDKleinPipeline

pipe = DWDKleinPipeline.from_pretrained("PrunaAI/P-Flux-2-Klein-4B-DWD")
image = pipe("a red fox in fresh snow at sunrise", width=1024, height=1024, seed=0)
image.save("fox.png")
from dwd_klein.pipeline import DWDKleinPipeline

pipe = DWDKleinPipeline.from_pretrained("PrunaAI/P-Flux-2-Klein-4B-DWD")
image = pipe("a red fox in fresh snow at sunrise", width=1024, height=1024, seed=0)
image.save("fox.png")
from dwd_klein.pipeline import DWDKleinPipeline

pipe = DWDKleinPipeline.from_pretrained("PrunaAI/P-Flux-2-Klein-4B-DWD")
image = pipe("a red fox in fresh snow at sunrise", width=1024, height=1024, seed=0)
image.save("fox.png")

For the best results, use one of the trained sizes: 1024 × 1024, 1152 × 896, 896 × 1152, 1344 × 768 or 768 × 1344. Prefer the command line? Run python scripts/generate.py --prompt "..." --out fox.png inside the clone.

P-Q-Image-2.1-DWD

ComfyUI. P-Q-Image-2.1-DWD-Comfy brings the head to ComfyUI for both text-to-image and editing, with no VAE decoder needed. As with Klein, its images are close to the Python package's but not identical.

Diffusers. Clone the repo and run the pipeline.

from PIL import Image
from pq_image_dwd import DWDPipeline

pipe = DWDPipeline.from_pretrained("PrunaAI/P-Q-Image-2.1-DWD")

# Text-to-image
image = pipe("a red fox standing in fresh snow at sunrise", width=2048, height=2048, seed=0)
image.save("fox.png")

# Image editing
edited = pipe("Add gently falling snow to the whole scene.", image=Image.open("photo.jpg"), seed=0)
edited.save("snow.png")
from PIL import Image
from pq_image_dwd import DWDPipeline

pipe = DWDPipeline.from_pretrained("PrunaAI/P-Q-Image-2.1-DWD")

# Text-to-image
image = pipe("a red fox standing in fresh snow at sunrise", width=2048, height=2048, seed=0)
image.save("fox.png")

# Image editing
edited = pipe("Add gently falling snow to the whole scene.", image=Image.open("photo.jpg"), seed=0)
edited.save("snow.png")
from PIL import Image
from pq_image_dwd import DWDPipeline

pipe = DWDPipeline.from_pretrained("PrunaAI/P-Q-Image-2.1-DWD")

# Text-to-image
image = pipe("a red fox standing in fresh snow at sunrise", width=2048, height=2048, seed=0)
image.save("fox.png")

# Image editing
edited = pipe("Add gently falling snow to the whole scene.", image=Image.open("photo.jpg"), seed=0)
edited.save("snow.png")

Width and height must be multiples of 32. From the command line, python scripts/generate.py does the same, and --compare also saves the stock VAE image next to yours.

Enjoy the Quality and Efficiency!

—

Thank you to Chen et al. for the DWD paper, and to Black Forest Labs and the Qwen team for the base models.

License: P-Flux-2-Klein-4B-DWD is based on FLUX.2 [klein] 4B and released under the Apache License 2.0. P-Q-Image-2.1-DWD is a derivative of Qwen-Image-2.1-Turbo: its weights are distributed under the Qwen Research License Agreement (Copyright (c) 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd.), so review its use restrictions before using or redistributing them, while its code is released under the Apache License 2.0. See the LICENSE and NOTICE files in each repository for details.

Curious what Pruna can do for your models?

Whether you're running GenAI in production or exploring what's possible, Pruna makes it easier to move fast and stay efficient.

Curious what Pruna can do for your models?

Whether you're running GenAI in production or exploring what's possible, Pruna makes it easier to move fast and stay efficient.

Curious what Pruna can do for your models?

Whether you're running GenAI in production or exploring what's possible, Pruna makes it easier to move fast and stay efficient.