Instructions to use PrunaAI/P-Q-Image-2.1-DWD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Pruna AI
How to use PrunaAI/P-Q-Image-2.1-DWD with Pruna AI:
from pruna import PrunaModel model = PrunaModel.from_pretrained("PrunaAI/P-Q-Image-2.1-DWD") - Notebooks
- Google Colab
- Kaggle
β‘ P-Q-Image-2.1-DWD
Qwen-Image-2.1-Turbo without the VAE decode
No VAE decode Β· Up to 1.16x faster Β· 24 GB less memory at 2K Β· Text-to-image and image editing
Built with Qwen.
P-Q-Image-2.1-DWD is a decoder-free pixel head for
Qwen/Qwen-Image-2.1-Turbo. At the end of the model's 8
sampling steps, a fine-tuned copy of the transformer's last 4 blocks and a small linear head write the image's pixels
directly, so the last Euler step and the VAE decode never run. Steps 1 to 7 are the stock model, unchanged. It is our
replication of DWD, Decoding Without a Decoder by Chen et al.
(arXiv 2611.22287), on Qwen-Image-2.1-Turbo.
This repository holds the weights and the pq_image_dwd Python package for text-to-image and image editing. For
ComfyUI, see PrunaAI/P-Q-Image-2.1-DWD-Comfy.
| Tasks | Text-to-image and image editing (one or more condition images) |
| Sampling | The Turbo model's 8 steps, no CFG; the head replaces the last step |
| Resolution | Trained at about 1 MP; evaluated at about 1 MP and at the model's 2K sizes |
| Weights | dwd_tail.safetensors: 0.98B parameters, 1.95 GB (bf16) |
| VAE | Decoder not needed; the encoder is used for editing only |
Quickstart
Needs a CUDA GPU. The base model is downloaded from
Qwen/Qwen-Image-2.1-Turbo on first use (bf16 transformer
14.2 GB and text encoder 16.3 GB); the head adds 1.95 GB.
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/PrunaAI/P-Q-Image-2.1-DWD
cd P-Q-Image-2.1-DWD
pip install -e .
The package pins diffusers==0.41.0 and transformers==5.23.0, the versions it was tested with, and needs
PyTorch 2.6 or newer (tested with 2.12.1).
from PIL import Image
from pq_image_dwd import DWDPipeline
pipe = DWDPipeline.from_pretrained("PrunaAI/P-Q-Image-2.1-DWD") # base: Qwen/Qwen-Image-2.1-Turbo
# 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")
# The stock VAE image for the same seed, for comparison (loads the VAE decoder)
dwd, vae = pipe("a red fox standing in fresh snow at sunrise", seed=0, return_vae=True)
# Optional: torch.compile the transformer blocks (one compile per resolution)
pipe.enable_compile()
Or from the command line:
python scripts/generate.py --prompt "a red fox standing in fresh snow at sunrise" --width 2048 --height 2048 --out fox.png
python scripts/generate.py --prompt "Add gently falling snow to the whole scene." --image photo.jpg --out snow.png
Add --compare to also write the stock VAE image as <out>_vae.png. Width and height must be multiples of 32.
Full options, the latency benchmark, the weight export and the tests are described in docs/usage.md.
Examples
Stock Qwen-Image-2.1-Turbo with its VAE decode next to P-Q-Image-2.1-DWD, with the same prompt and seed. Panels are downscaled; the PSNR in each caption compares the two full-size images. Prompts, sizes and seeds are in assets/examples/examples.json.
Text-to-image at 2K
"a close-up portrait of an elderly fisherman with a grey beard, soft window light, 85mm photo", 2048 Γ 2048, 34.7 dB
"bird of paradise flower", 2528 Γ 1696, 39.7 dB
![]() |
![]() |
| "a red fox standing in fresh snow at sunrise, professional wildlife photograph", 1696 Γ 2528, 33.2 dB | "a futuristic city street after rain with neon reflections, cinematic film still", 1536 Γ 2752, 35.4 dB |
"a purple and white ice cream shop with a purple and white striped awning", 2752 Γ 1536, 34.7 dB
"a stone wall with plants and flowers in it", 2048 Γ 2048, 29.7 dB: dense fine texture is where the head differs most
Image editing at 1 MP
Input, stock VAE image and DWD head image. The input images were generated with the stock model.
"Turn this photo into a watercolor painting with soft washes and visible paper texture.", 1344 Γ 768, 31.2 dB
"Make it look like a faded vintage 1970s photograph.", 1152 Γ 896, 33.3 dB
"Add a small red hot-air balloon in the upper part of the image.", 1024 Γ 1024, 31.3 dB
"Add gently falling snow to the whole scene.", 896 Γ 1152, 33.0 dB
1:1 crops
512 Γ 512 pixel crops at full resolution, stock VAE decode (left) vs DWD head (right).
![]() |
![]() |
![]() |
![]() |
Benchmark
Speed
One NVIDIA B200, bf16, batch size 1, 8 steps, text-to-image. End to end: prompt encoding, the 8 steps and the decode, until the uint8 image is on the host. Both paths run interleaved on the same GPU with the same code; median of 10 runs, and the saving is the median of paired differences with a bootstrap 95% interval. PyTorch 2.12.1 (CUDA 13.0), diffusers 0.41.0, transformers 5.23.0. Measured with scripts/benchmark_latency.py; raw results in assets/benchmark.json.
| Mode | Resolution | With VAE decode | P-Q-Image-2.1-DWD | Saved (95% CI) | Speedup |
|---|---|---|---|---|---|
| eager | 1024 Γ 1024 | 767 ms | 696 ms | 67 ms (58β80) | 1.10x |
| eager | 2048 Γ 2048 | 3500 ms | 3213 ms | 282 ms (273β298) | 1.09x |
torch.compile |
1024 Γ 1024 | 597 ms | 513 ms | 82 ms (78β88) | 1.16x |
torch.compile |
2048 Γ 2048 | 2797 ms | 2500 ms | 293 ms (290β310) | 1.12x |
torch.compile compiles every transformer block (stock and tail); the VAE runs eager. The VAE decode alone takes
72 ms at 1024 Γ 1024 and 283 ms at 2048 Γ 2048. The DWD last step takes 87 ms and 407 ms (eager), against 160 ms and
691 ms for the stock last step plus the VAE decode. For reference, the diffusers QwenImage21Pipeline itself takes
796 ms and 3604 ms (eager) on the same GPU.
Memory
Peak activation memory during one text-to-image run (peak allocated minus the resident weights), same setup:
| Mode | Resolution | With VAE decode | P-Q-Image-2.1-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 |
Resident weights: transformer 14.23 GB and text encoder 16.29 GB (both needed either way), plus 1.95 GB for the head; the 0.52 GB VAE decoder is not loaded (editing loads the 0.16 GB VAE encoder). Net, the peak at 2048 Γ 2048 eager is about 24 GB lower.
Fidelity to the stock VAE image
Same prompt, seed and steps 1 to 7; the DWD image compared with the stock VAE image. 64 cases per set; the edit sets are edits of real photos. Higher PSNR and lower LPIPS mean closer to the VAE image.
| Set | PSNR β | LPIPS (VGG) β | LPIPS (AlexNet) β |
|---|---|---|---|
| Text-to-image, 1 MP | 34.79 dB | 0.045 | 0.021 |
| Text-to-image, 2K | 35.93 dB | 0.046 | 0.018 |
| Editing, 1 MP | 35.30 dB | 0.048 | 0.029 |
| Editing, 2K | 36.50 dB | 0.057 | 0.033 |
Colour and tone stay with the VAE image; the main difference is in the finest texture, where the head is slightly softer.
How it works
- Steps 1 to 7 run on the stock Qwen-Image-2.1-Turbo, unchanged: the same noise, sigmas, prefix KV cache and Euler updates as the stock pipeline, so every latent up to the last step is the stock one.
- Last step. The stock input embeddings and first 28 blocks run as usual. A fine-tuned copy of the last 4 blocks, with its own time embedding, modulation, and output norm, takes over on the whole sequence (text and condition-image tokens included).
- Head. A
Linear(4096 β 768)turns each image token into a 16 Γ 16 pixel tile in normalized Oklab, which is converted to sRGB. No output projection, no last Euler step, no VAE decode. - Editing. Condition images enter exactly as in the stock pipeline (VAE-encoded latents and Qwen3-VL image tokens), so editing needs the VAE encoder but never the decoder.
- Training. About 18,000 runs of the stock model at about 1 MP (16,000 text-to-image and 2,000 edits), with the stock VAE image of each run as the target. The released weights are an EMA, stored in bf16; they give exactly the images of the full-precision weights under bf16 autocast.
Limitations
- Close to, not identical with, the VAE image. The head is slightly softer than the VAE in the finest texture; dense texture (stone, fur, foliage) differs most.
- Heavy restyles can drift further. Edits that re-texture the whole image strongly scored lower than the averages above in our spot checks (about 27 to 28 dB on crisp generated inputs).
- RGB only. The head outputs no alpha channel, so there is no transparency output.
- Trained sizes. Trained at about 1 MP and evaluated at 1024 Γ 1024, 1152 Γ 896, 896 Γ 1152, 1344 Γ 768, 768 Γ 1344 and at 2048 Γ 2048, 2528 Γ 1696, 1696 Γ 2528, 2752 Γ 1536, 1536 Γ 2752. Other sizes run but were not evaluated. Width and height must be multiples of 32.
- Turbo sampler only. The head is trained for the last of the 8 Turbo steps. No CFG and no negative prompt.
- LoRAs are untested. A LoRA on the last 4 blocks, the time embedding, the modulation or the output norm will not carry over to the last step.
- Benchmarked on one B200 with bf16 and batch size 1; speed and memory vary with hardware, resolution, batch size, and software.
License
The end model is based on Qwen-Image-2.1-Turbo.
P-Q-Image-2.1-DWD is a derivative of Qwen-Image-2.1-Turbo and its weights (dwd_tail.safetensors) are
distributed under the Qwen RESEARCH LICENSE AGREEMENT, see LICENSE and NOTICE. Review its use
restrictions before using or redistributing the weights.
The code in src/, scripts/ and tests/ is released under the Apache License 2.0, see
LICENSE-APACHE.
Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.
Citation
If you use this model, please cite the DWD paper and this release.
@article{chen2026dwd,
title = {Decoding Without a Decoder: Direct Pixel Prediction from Diffusion Transformers},
author = {Chen, Hansheng and Cai, Shengqu and Ackermann, Jan and Zirvi, Rayhan and Wetzstein, Gordon
and Yan, Xinchen and Guibas, Leonidas},
journal = {arXiv preprint arXiv:2611.22287},
year = {2026}
}
@software{pruna2026pqimagedwd,
title = {P-Q-Image-2.1-DWD: Decoding Without a Decoder for Qwen-Image-2.1-Turbo},
author = {{Pruna AI}},
year = {2026},
version = {0.1.0},
url = {https://huggingface.co/PrunaAI/P-Q-Image-2.1-DWD}
}
What's next?
- Use P-Q-Image-2.1-DWD to generate and edit images with Qwen-Image-2.1-Turbo without the VAE decode.
- Compress your own models with Pruna and give us a βοΈ for more efficiency!
- Want to use our optimized image models right away? Check P-Image-Ideogram and P-Image-Edit.
- Downloads last month
- 12













